Port of audio to GStreamer 1.0
[mediagoblin.git] / docs / source / siteadmin / media-types.rst
CommitLineData
473a4431
CAW
1.. MediaGoblin Documentation
2
ffbf9c8b 3 Written in 2011, 2012, 2014 by MediaGoblin contributors
473a4431
CAW
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
9bc2fc6c
CAW
14.. _media-types-chapter:
15
16====================
d34757dc 17Media Types
9bc2fc6c
CAW
18====================
19
20In the future, there will be all sorts of media types you can enable,
ffbf9c8b
OHO
21but in the meanwhile there are six additional media types: video, audio,
22raw image, ascii art, STL/3d models, PDF and Document.
9bc2fc6c
CAW
23
24First, you should probably read ":doc:`configuration`" to make sure
25you know how to modify the mediagoblin config file.
26
d34757dc
JW
27Enabling Media Types
28====================
29
91bee92e
RE
30.. note::
31 Media types are now plugins
32
d34757dc
JW
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
91bee92e
RE
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::
d34757dc 45
91bee92e
RE
46 [plugins]
47 [[mediagoblin.media_types.image]]
48 [[mediagoblin.media_types.video]]
d34757dc 49
9d5cd0b9
CAW
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
d34757dc
JW
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
9bc2fc6c
CAW
73Video
74=====
75
76To enable video, first install gstreamer and the python-gstreamer
77bindings (as well as whatever gstremaer extensions you want,
3a8b18f8 78good/bad/ugly). On Debianoid systems
9bc2fc6c 79
3a8b18f8
JW
80.. code-block:: bash
81
82 sudo apt-get install python-gst0.10 \
83 gstreamer0.10-plugins-base \
84 gstreamer0.10-plugins-bad \
85 gstreamer0.10-plugins-good \
86 gstreamer0.10-plugins-ugly \
7798f911 87 gstreamer0.10-ffmpeg
582958e3 88
9bc2fc6c 89
91bee92e
RE
90Add ``[[mediagoblin.media_types.video]]`` under the ``[plugins]`` section in
91your ``mediagoblin_local.ini`` and restart MediaGoblin.
5ef7ab08 92
3a8b18f8
JW
93Run
94
95.. code-block:: bash
3fe3b222 96
5ef7ab08
CAW
97 ./bin/gmg dbupdate
98
9bc2fc6c
CAW
99Now you should be able to submit videos, and mediagoblin should
100transcode them.
101
7798f911
WKG
102.. note::
103
104 You almost certainly want to separate Celery from the normal
105 paste process or your users will probably find that their connections
106 time out as the video transcodes. To set that up, check out the
107 ":doc:`production-deployments`" section of this manual.
efd69313
CAW
108
109
d34757dc
JW
110Audio
111=====
112
113To enable audio, install the gstreamer and python-gstreamer bindings (as well
114as whatever gstreamer plugins you want, good/bad/ugly), scipy and numpy are
115also needed for the audio spectrograms.
116To install these on Debianoid systems, run::
117
118 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
119 gstreamer0.10-ffmpeg python-numpy python-scipy
120
121The ``scikits.audiolab`` package you will install in the next step depends on the
122``libsndfile1-dev`` package, so we should install it.
3a8b18f8
JW
123On Debianoid systems, run
124
125.. code-block:: bash
d34757dc
JW
126
127 sudo apt-get install libsndfile1-dev
128
34a85313 129.. note::
8518e95e 130 scikits.audiolab will display a warning every time it's imported if you do
34a85313 131 not compile it with alsa support. Alsa support is not necessary for the GNU
8518e95e
JW
132 MediaGoblin application but if you do not wish the alsa warnings from
133 audiolab you should also install ``libasound2-dev`` before installing
134 scikits.audiolab.
34a85313 135
d34757dc
JW
136Then install ``scikits.audiolab`` for the spectrograms::
137
138 ./bin/pip install scikits.audiolab
139
91bee92e 140Add ``[[mediagoblin.media_types.audio]]`` under the ``[plugins]`` section in your
5ef7ab08
CAW
141``mediagoblin_local.ini`` and restart MediaGoblin.
142
3a8b18f8
JW
143Run
144
145.. code-block:: bash
3fe3b222 146
5ef7ab08
CAW
147 ./bin/gmg dbupdate
148
149You should now be able to upload and listen to audio files!
d34757dc
JW
150
151
ffbf9c8b
OHO
152Raw image
153=========
154
155To enable raw image you need to install pyexiv2. On Debianoid systems
156
157.. code-block:: bash
158
159 sudo apt-get install python-pyexiv2
160
161Add ``[[mediagoblin.media_types.raw_image]]`` under the ``[plugins]``
162section in your ``mediagoblin_local.ini`` and restart MediaGoblin.
163
164Run
165
166.. code-block:: bash
167
168 ./bin/gmg dbupdate
169
170Now you should be able to submit raw images, and mediagoblin should
171extract the JPEG preview from them.
172
173
efd69313
CAW
174Ascii art
175=========
176
177To enable ascii art support, first install the
178`chardet <http://pypi.python.org/pypi/chardet>`_
3a8b18f8
JW
179library, which is necessary for creating thumbnails of ascii art
180
181.. code-block:: bash
efd69313
CAW
182
183 ./bin/easy_install chardet
184
185
186Next, modify (and possibly copy over from ``mediagoblin.ini``) your
91bee92e
RE
187``mediagoblin_local.ini``. In the ``[plugins]`` section, add
188``[[mediagoblin.media_types.ascii]]``.
efd69313 189
3a8b18f8
JW
190Run
191
192.. code-block:: bash
3fe3b222 193
5ef7ab08
CAW
194 ./bin/gmg dbupdate
195
efd69313 196Now any .txt file you uploaded will be processed as ascii art!
5ef7ab08
CAW
197
198
199STL / 3d model support
200======================
201
202To enable the "STL" 3d model support plugin, first make sure you have
203a recentish `Blender <http://blender.org>`_ installed and available on
204your execution path. This feature has been tested with Blender 2.63.
205It may work on some earlier versions, but that is not guaranteed (and
206is surely not to work prior to Blender 2.5X).
207
91bee92e 208Add ``[[mediagoblin.media_types.stl]]`` under the ``[plugins]`` section in your
5ef7ab08
CAW
209``mediagoblin_local.ini`` and restart MediaGoblin.
210
3a8b18f8
JW
211Run
212
213.. code-block:: bash
3fe3b222 214
5ef7ab08
CAW
215 ./bin/gmg dbupdate
216
217You should now be able to upload .obj and .stl files and MediaGoblin
218will be able to present them to your wide audience of admirers!
a80ebf3b
AL
219
220PDF and Document
221================
222
376dcbb4
AL
223To enable the "PDF and Document" support plugin, you need:
224
2251. pdftocairo and pdfinfo for pdf only support.
226
2272. unoconv with headless support to support converting libreoffice supported
228 documents as well, such as doc/ppt/xls/odf/odg/odp and more.
229 For the full list see mediagoblin/media_types/pdf/processing.py,
230 unoconv_supported.
231
232All executables must be on your execution path.
a80ebf3b
AL
233
234To install this on Fedora:
235
236.. code-block:: bash
237
3606316e 238 sudo yum install -y poppler-utils unoconv libreoffice-headless
a80ebf3b 239
376dcbb4
AL
240Note: You can leave out unoconv and libreoffice-headless if you want only pdf
241support. This will result in a much smaller list of dependencies.
242
a80ebf3b
AL
243pdf.js relies on git submodules, so be sure you have fetched them:
244
245.. code-block:: bash
246
247 git submodule init
248 git submodule update
249
250This feature has been tested on Fedora with:
251 poppler-utils-0.20.2-9.fc18.x86_64
252 unoconv-0.5-2.fc18.noarch
253 libreoffice-headless-3.6.5.2-8.fc18.x86_64
254
255It may work on some earlier versions, but that is not guaranteed.
256
91bee92e 257Add ``[[mediagoblin.media_types.pdf]]`` under the ``[plugins]`` section in your
a80ebf3b
AL
258``mediagoblin_local.ini`` and restart MediaGoblin.
259
260Run
261
262.. code-block:: bash
263
264 ./bin/gmg dbupdate
265
266
b7d854bf
CAW
267Blog (HIGHLY EXPERIMENTAL)
268==========================
269
270MediaGoblin has a blog media type, which you might notice by looking
271through the docs! However, it is *highly experimental*. We have not
272security reviewed this, and it acts in a way that is not like normal
273blogs (the blogposts are themselves media types!).
274
2352f7c8
CAW
275So you can play with this, but it is not necessarily recommended yet
276for production use! :)