Try ipython-based shell first, falling back to plain shell
[mediagoblin.git] / docs / source / siteadmin / media-types.rst
... / ...
CommitLineData
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
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 three additional media types: video, audio
22and ascii art.
23
24First, you should probably read ":doc:`configuration`" to make sure
25you know how to modify the mediagoblin config file.
26
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
46Note that after enabling new media types, you must run dbupdate like so::
47
48 ./bin/gmg dbupdate
49
50If you are running an active site, depending on your server
51configuration, you may need to stop it first (and it's certainly a
52good idea to restart it after the update).
53
54
55How does MediaGoblin decide which media type to use for a file?
56===============================================================
57
58MediaGoblin has two methods for finding the right media type for an uploaded
59file. One is based on the file extension of the uploaded file; every media type
60maintains a list of supported file extensions. The second is based on a sniffing
61handler, where every media type may inspect the uploaded file and tell if it
62will accept it.
63
64The file-extension-based approach is used before the sniffing-based approach,
65if the file-extension-based approach finds a match, the sniffing-based approach
66will be skipped as it uses far more processing power.
67
68
69Video
70=====
71
72To enable video, first install gstreamer and the python-gstreamer
73bindings (as well as whatever gstremaer extensions you want,
74good/bad/ugly). On Debianoid systems::
75
76 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
77 gstreamer0.10-ffmpeg
78
79
80Now you should be able to submit videos, and mediagoblin should
81transcode them.
82
83.. note::
84
85 You almost certainly want to separate Celery from the normal
86 paste process or your users will probably find that their connections
87 time out as the video transcodes. To set that up, check out the
88 ":doc:`production-deployments`" section of this manual.
89
90
91Audio
92=====
93
94To enable audio, install the gstreamer and python-gstreamer bindings (as well
95as whatever gstreamer plugins you want, good/bad/ugly), scipy and numpy are
96also needed for the audio spectrograms.
97To install these on Debianoid systems, run::
98
99 sudo apt-get install python-gst0.10 gstreamer0.10-plugins-{base,bad,good,ugly} \
100 gstreamer0.10-ffmpeg python-numpy python-scipy
101
102The ``scikits.audiolab`` package you will install in the next step depends on the
103``libsndfile1-dev`` package, so we should install it.
104On Debianoid systems, run::
105
106 sudo apt-get install libsndfile1-dev
107
108.. note::
109 scikits.audiolab will display a warning every time it's imported if you do
110 not compile it with alsa support. Alsa support is not necessary for the GNU
111 MediaGoblin application but if you do not wish the alsa warnings from
112 audiolab you should also install ``libasound2-dev`` before installing
113 scikits.audiolab.
114
115Then install ``scikits.audiolab`` for the spectrograms::
116
117 ./bin/pip install scikits.audiolab
118
119Add ``mediagoblin.media_types.audio`` to the ``media_types`` list in your
120``mediagoblin_local.ini`` and restart MediaGoblin. You should now be able to
121upload and listen to audio files!
122
123
124Ascii art
125=========
126
127To enable ascii art support, first install the
128`chardet <http://pypi.python.org/pypi/chardet>`_
129library, which is necessary for creating thumbnails of ascii art::
130
131 ./bin/easy_install chardet
132
133
134Next, modify (and possibly copy over from ``mediagoblin.ini``) your
135``mediagoblin_local.ini``. In the ``[mediagoblin]`` section, add
136``mediagoblin.media_types.ascii`` to the ``media_types`` list.
137
138For example, if your system supported image and ascii art media types, then
139the list would look like this::
140
141 media_types = mediagoblin.media_types.image, mediagoblin.media_types.ascii
142
143Now any .txt file you uploaded will be processed as ascii art!