Transcoding to Theora

Theora is a free software video codec. This document describes various ways of transcoding video files into Theora.

Operating System and Platform

It is best to use a recent Ubuntu install or an up-to-date Debian testing/unstable machine running a recent linux kernel for video transcoding work, for two reasons:

  • Video encoders and decoders are relatively new and rapidly improving in Linux. Using a recent install ensures that the latest and greatest codecs are supported
  • There are a large number of packages required due to the large number of video codecs in use. A system with automatic dependency resolution (e.g. that provided by apt-get) dramatically simplifies installation of video transcoding tools

Gstreamer 0.10 commandline transcoder

This should transcode pretty much any AV material into ogg, assuming you've got the appropriate codecs installed:

gst-launch-0.10  oggmux name="mux" ! filesink location="output.ogg"  \
       filesrc location="input.ext" ! decodebin name="d" \
           { d. ! queue ! ffmpegcolorspace ! theoraenc ! queue ! mux. } \
           { d. ! queue ! audioconvert ! audioresample ! vorbisenc ! queue ! mux. }

Be aware, you will need gstreamer0.10-plugins-ugly and gstreamer0.10-plugins-bad (and, if on dapper, gstreamer0.10-plugins-bad-multiverse) to handle many non-free file formats.

Transcoding using ffmpeg2theora

Often you will be able to perform the transcoding in a single step:

ffmpeg2theora input.ext -o output.ogg

However, sometimes your format will be one not understood by ffmpeg's decoder implementations. In these cases you will need to use:

mencoder input.ext -oac lavc -ovc lavc -o output.avi
ffmpeg2theora output.avi -o output.ogg

Note that this process is markedly slower than the gstreamer process, however it also appears to be less prone to errors / cut-out for certain codecs (e.g. FAAD).

Building a faster ffmpeg2theora

The existing libtheora release does not have mmx optimisations enabled. To build a version with these optimisations:

  • ensure you have UNINSTALLED libtheora-dev and ffmpeg2theora
  • use svn to checkout the libtheora source and build it:
    svn co http://svn.xiph.org/trunk/theora theora
    cd theora
    ./autogen.sh
    make
    sudo make install
    
  • use svn to checkout the ffmpeg2theora source and build it:
    svn co http://svn.xiph.org/trunk/ffmpeg2theora ffmpeg2theora
    cd ffmpeg2theora
    ./get_ffmpeg_svn.sh
    export PKG_CONFIG_PATH=ffmpeg
    ./autogen.sh
    make
    sudo make install
    

NOTE: it is not certain that this version is significantly faster.