Missing codecs processing with gst 1.4
[mediagoblin.git] / docs / source / siteadmin / media-types.rst
... / ...
CommitLineData
1.. MediaGoblin Documentation
2
3 Written in 2011, 2012, 2014 by MediaGoblin contributors
4
5 To the extent possible under law, the author(s) have dedicated all
6 copyright and related and neighboring rights to this software to
7 the public domain worldwide. This software is distributed without
8 any warranty.
9
10 You should have received a copy of the CC0 Public Domain
11 Dedication along with this software. If not, see
12 <http://creativecommons.org/publicdomain/zero/1.0/>.
13
14.. _media-types-chapter:
15
16====================
17Media Types
18====================
19
20In the future, there will be all sorts of media types you can enable,
21but in the meanwhile there are six additional media types: video, audio,
22raw image, ascii art, STL/3d models, PDF and Document.
23
24First, you should probably read ":doc:`configuration`" to make sure
25you know how to modify the mediagoblin config file.
26
27Enabling Media Types
28====================
29
30.. note::
31 Media types are now plugins
32
33Media types are enabled in your mediagoblin configuration file, typically it is
34created by copying ``mediagoblin.ini`` to ``mediagoblin_local.ini`` and then
35applying your changes to ``mediagoblin_local.ini``. If you don't already have a
36``mediagoblin_local.ini``, create one in the way described.
37
38Most media types have additional dependencies that you will have to install.
39You will find descriptions on how to satisfy the requirements of each media type
40on this page.
41
42To enable a media type, add the the media type under the ``[plugins]`` section
43in you ``mediagoblin_local.ini``. For example, if your system supported image
44and video media types, then it would look like this::
45
46 [plugins]
47 [[mediagoblin.media_types.image]]
48 [[mediagoblin.media_types.video]]
49
50Note that after enabling new media types, you must run dbupdate like so::
51
52 ./bin/gmg dbupdate
53
54If you are running an active site, depending on your server
55configuration, you may need to stop it first (and it's certainly a
56good idea to restart it after the update).
57
58
59How does MediaGoblin decide which media type to use for a file?
60===============================================================
61
62MediaGoblin has two methods for finding the right media type for an uploaded
63file. One is based on the file extension of the uploaded file; every media type
64maintains a list of supported file extensions. The second is based on a sniffing
65handler, where every media type may inspect the uploaded file and tell if it
66will accept it.
67
68The file-extension-based approach is used before the sniffing-based approach,
69if the file-extension-based approach finds a match, the sniffing-based approach
70will be skipped as it uses far more processing power.
71
72
73Video
74=====
75
76To enable video, first install gstreamer and the python-gstreamer
77bindings (as well as whatever gstremaer extensions you want,
78good/bad/ugly). On Debianoid systems
79
80.. code-block:: bash
81
82 sudo apt-get install python-gi python3-gi \
83 gstreamer1.0-tools \
84 gir1.2-gstreamer-1.0 \
85 gir1.2-gst-plugins-base-1.0 \
86 gstreamer1.0-plugins-good \
87 gstreamer1.0-plugins-ugly \
88 gstreamer1.0-plugins-bad \
89 gstreamer1.0-libav
90
91
92Add ``[[mediagoblin.media_types.video]]`` under the ``[plugins]`` section in
93your ``mediagoblin_local.ini`` and restart MediaGoblin.
94
95Run
96
97.. code-block:: bash
98
99 ./bin/gmg dbupdate
100
101Now you should be able to submit videos, and mediagoblin should
102transcode them.
103
104.. note::
105
106 You almost certainly want to separate Celery from the normal
107 paste process or your users will probably find that their connections
108 time out as the video transcodes. To set that up, check out the
109 ":doc:`production-deployments`" section of this manual.
110
111
112Audio
113=====
114
115To enable audio, install the gstreamer and python-gstreamer bindings (as well
116as whatever gstreamer plugins you want, good/bad/ugly), scipy and numpy are
117also needed for the audio spectrograms.
118To install these on Debianoid systems, run::
119
120 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
121 gstreamer0.10-ffmpeg python-numpy python-scipy
122
123The ``scikits.audiolab`` package you will install in the next step depends on the
124``libsndfile1-dev`` package, so we should install it.
125On Debianoid systems, run
126
127.. code-block:: bash
128
129 sudo apt-get install libsndfile1-dev
130
131.. note::
132 scikits.audiolab will display a warning every time it's imported if you do
133 not compile it with alsa support. Alsa support is not necessary for the GNU
134 MediaGoblin application but if you do not wish the alsa warnings from
135 audiolab you should also install ``libasound2-dev`` before installing
136 scikits.audiolab.
137
138Then install ``scikits.audiolab`` for the spectrograms::
139
140 ./bin/pip install scikits.audiolab
141
142Add ``[[mediagoblin.media_types.audio]]`` under the ``[plugins]`` section in your
143``mediagoblin_local.ini`` and restart MediaGoblin.
144
145Run
146
147.. code-block:: bash
148
149 ./bin/gmg dbupdate
150
151You should now be able to upload and listen to audio files!
152
153
154Raw image
155=========
156
157To enable raw image you need to install pyexiv2. On Debianoid systems
158
159.. code-block:: bash
160
161 sudo apt-get install python-pyexiv2
162
163Add ``[[mediagoblin.media_types.raw_image]]`` under the ``[plugins]``
164section in your ``mediagoblin_local.ini`` and restart MediaGoblin.
165
166Run
167
168.. code-block:: bash
169
170 ./bin/gmg dbupdate
171
172Now you should be able to submit raw images, and mediagoblin should
173extract the JPEG preview from them.
174
175
176Ascii art
177=========
178
179To enable ascii art support, first install the
180`chardet <http://pypi.python.org/pypi/chardet>`_
181library, which is necessary for creating thumbnails of ascii art
182
183.. code-block:: bash
184
185 ./bin/easy_install chardet
186
187
188Next, modify (and possibly copy over from ``mediagoblin.ini``) your
189``mediagoblin_local.ini``. In the ``[plugins]`` section, add
190``[[mediagoblin.media_types.ascii]]``.
191
192Run
193
194.. code-block:: bash
195
196 ./bin/gmg dbupdate
197
198Now any .txt file you uploaded will be processed as ascii art!
199
200
201STL / 3d model support
202======================
203
204To enable the "STL" 3d model support plugin, first make sure you have
205a recentish `Blender <http://blender.org>`_ installed and available on
206your execution path. This feature has been tested with Blender 2.63.
207It may work on some earlier versions, but that is not guaranteed (and
208is surely not to work prior to Blender 2.5X).
209
210Add ``[[mediagoblin.media_types.stl]]`` under the ``[plugins]`` section in your
211``mediagoblin_local.ini`` and restart MediaGoblin.
212
213Run
214
215.. code-block:: bash
216
217 ./bin/gmg dbupdate
218
219You should now be able to upload .obj and .stl files and MediaGoblin
220will be able to present them to your wide audience of admirers!
221
222PDF and Document
223================
224
225To enable the "PDF and Document" support plugin, you need:
226
2271. pdftocairo and pdfinfo for pdf only support.
228
2292. unoconv with headless support to support converting libreoffice supported
230 documents as well, such as doc/ppt/xls/odf/odg/odp and more.
231 For the full list see mediagoblin/media_types/pdf/processing.py,
232 unoconv_supported.
233
234All executables must be on your execution path.
235
236To install this on Fedora:
237
238.. code-block:: bash
239
240 sudo yum install -y poppler-utils unoconv libreoffice-headless
241
242Note: You can leave out unoconv and libreoffice-headless if you want only pdf
243support. This will result in a much smaller list of dependencies.
244
245pdf.js relies on git submodules, so be sure you have fetched them:
246
247.. code-block:: bash
248
249 git submodule init
250 git submodule update
251
252This feature has been tested on Fedora with:
253 poppler-utils-0.20.2-9.fc18.x86_64
254 unoconv-0.5-2.fc18.noarch
255 libreoffice-headless-3.6.5.2-8.fc18.x86_64
256
257It may work on some earlier versions, but that is not guaranteed.
258
259Add ``[[mediagoblin.media_types.pdf]]`` under the ``[plugins]`` section in your
260``mediagoblin_local.ini`` and restart MediaGoblin.
261
262Run
263
264.. code-block:: bash
265
266 ./bin/gmg dbupdate
267
268
269Blog (HIGHLY EXPERIMENTAL)
270==========================
271
272MediaGoblin has a blog media type, which you might notice by looking
273through the docs! However, it is *highly experimental*. We have not
274security reviewed this, and it acts in a way that is not like normal
275blogs (the blogposts are themselves media types!).
276
277So you can play with this, but it is not necessarily recommended yet
278for production use! :)