Added note about libasound2-dev to docs.
[mediagoblin.git] / docs / source / siteadmin / media-types.rst
CommitLineData
473a4431
CAW
1.. MediaGoblin Documentation
2
3 Written in 2011, 2012 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
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,
d34757dc
JW
21but in the meanwhile there are three additional media types: video, audio
22and ascii art.
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
27
28Enabling Media Types
29====================
30
31Media types are enabled in your mediagoblin configuration file, typically it is
32created by copying ``mediagoblin.ini`` to ``mediagoblin_local.ini`` and then
33applying your changes to ``mediagoblin_local.ini``. If you don't already have a
34``mediagoblin_local.ini``, create one in the way described.
35
36Most media types have additional dependencies that you will have to install.
37You will find descriptions on how to satisfy the requirements of each media type
38on this page.
39
40To enable a media type, edit the ``media_types`` list in your
41``mediagoblin_local.ini``. For example, if your system supported image and
42video media types, then the list would look like this::
43
44 media_types = mediagoblin.media_types.image, mediagoblin.media_types.video
45
46How does MediaGoblin decide which media type to use for a file?
47===============================================================
48
49MediaGoblin has two methods for finding the right media type for an uploaded
50file. One is based on the file extension of the uploaded file; every media type
51maintains a list of supported file extensions. The second is based on a sniffing
52handler, where every media type may inspect the uploaded file and tell if it
53will accept it.
54
55The file-extension-based approach is used before the sniffing-based approach,
56if the file-extension-based approach finds a match, the sniffing-based approach
57will be skipped as it uses far more processing power.
58
59
9bc2fc6c
CAW
60Video
61=====
62
63To enable video, first install gstreamer and the python-gstreamer
64bindings (as well as whatever gstremaer extensions you want,
e91a4dcb 65good/bad/ugly). On Debianoid systems::
9bc2fc6c 66
7798f911
WKG
67 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
68 gstreamer0.10-ffmpeg
582958e3 69
9bc2fc6c
CAW
70
71Now you should be able to submit videos, and mediagoblin should
72transcode them.
73
7798f911
WKG
74.. note::
75
76 You almost certainly want to separate Celery from the normal
77 paste process or your users will probably find that their connections
78 time out as the video transcodes. To set that up, check out the
79 ":doc:`production-deployments`" section of this manual.
efd69313
CAW
80
81
d34757dc
JW
82Audio
83=====
84
85To enable audio, install the gstreamer and python-gstreamer bindings (as well
86as whatever gstreamer plugins you want, good/bad/ugly), scipy and numpy are
87also needed for the audio spectrograms.
88To install these on Debianoid systems, run::
89
90 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
91 gstreamer0.10-ffmpeg python-numpy python-scipy
92
93The ``scikits.audiolab`` package you will install in the next step depends on the
94``libsndfile1-dev`` package, so we should install it.
95On Debianoid systems, run::
96
97 sudo apt-get install libsndfile1-dev
98
34a85313
JW
99.. note::
100 scikits.audiolab will display a warning every time it's imported if you don
101 not compile it with alsa support. Alsa support is not necessary for the GNU
102 MediaGoblin application, but if you do not wish to have the alsa warnings
103 from audiolab pop up everywhere you should also install ``libasound2-dev``
104 before you install scikits.audiolab.
105
d34757dc
JW
106Then install ``scikits.audiolab`` for the spectrograms::
107
108 ./bin/pip install scikits.audiolab
109
110Add ``mediagoblin.media_types.audio`` to the ``media_types`` list in your
111``mediagoblin_local.ini`` and restart MediaGoblin. You should now be able to
112upload and listen to audio files!
113
114
efd69313
CAW
115Ascii art
116=========
117
118To enable ascii art support, first install the
119`chardet <http://pypi.python.org/pypi/chardet>`_
120library, which is necessary for creating thumbnails of ascii art::
121
122 ./bin/easy_install chardet
123
124
125Next, modify (and possibly copy over from ``mediagoblin.ini``) your
7798f911
WKG
126``mediagoblin_local.ini``. In the ``[mediagoblin]`` section, add
127``mediagoblin.media_types.ascii`` to the ``media_types`` list.
128
129For example, if your system supported image and ascii art media types, then
130the list would look like this::
efd69313
CAW
131
132 media_types = mediagoblin.media_types.image, mediagoblin.media_types.ascii
133
134Now any .txt file you uploaded will be processed as ascii art!