Theora

From OLPC
Jump to navigation Jump to search

Theora is the preferred video codec for the OLPC.

Useful Encoding software

You can encode Theora files using the command line application ffmpeg2theora.

Recommended settings

[This file] plays back well on a B4 laptop, running build 623. Ogg multiplexed audio/video file, Theora/Vorbis, length 1m14s, 320×240 pixels, 148kbps overall.

These settings created a file which played back from the local disk successfully:

ffmpeg2theora -x 320 -y 256 -V 148 -A 32 "inputfilename.ogg"

3 June 08--For the latest version of ffmpeg2theora(version 0.21), I needed to use the following command to convert an AVI formatted movie: ffmpeg2theora-0.21.exe -x 320 -y 256 -o output.ogg --no-skeleton -A 32 -V 148 input.avi

The output video produced by this was some2what blurry, but file size was small.

I used the following to increase video quality and it worked pretty well, but filesize was about 10 times larger: ffmpeg2theora-0.21.exe -x 320 -y 256 -o output.ogg --no-skeleton -A 32 input.avi

After creating the .ogg file, I loaded it into the OLPC (Build 656) using a USB flash drive. I loaded Watch and Listen (v.10) on the OLPC and played the file from Journal selecting the Browse activity.

Testing

I have done a few simple libtheora tests needed for the theora encoder ticket (http://dev.laptop.org/attachment/ticket/5988/) using theora-svn.

I have used 2 simple raw yuv file (ftp://ftp.ldv.e-technik.tu-muenchen.de/dist/test_sequences/601) as input, encoded with ffmpeg and converted the video to yuv4mjpeg format (mplayer input.avi -vo yuv4mpeg) needed by thetheoraencoder. I have used the encoder from theora-tools-svn (should be the same encoder as the one in the thero svn examples/ folder)

theoraenc stream.yuv -o output.ogg

I compared 3 theora configurations with the unpatched encoder and with the patched encoder which enables super fast encoding (patch: http://dev.laptop.org/attachment/ticket/5988/speed_example.diff)

The theora builds/configurations I used are the following:

default: standard theora library on my G1G1 OLPC (/usr/lib/libtheora.so.0.2.0)

gcc4.3-geode: CFLAGS= -O3--force-addr -fomit-frame-pointer -finline-functions -funroll-loops -march=geode -mtune=geode

gcc4.3-geode-nommx: configure theora with --disable-asm (most of the mmx specific code is hand assembly, and the mno-mmx. mno-3dnow} do not make a difference) and CFLAGS = -O3--force-addr -fomit-frame-pointer -finline-functions -funroll-loops -mno-mmx -mno-3dnow

Numbers below are in seconds:

video input 1 (576i25_mobcal_ter.yuv)

 library            | patched | unpatched 
 default            | 79.5    | 119.5 
 gcc4.3geode        | 84.3    | 118.5 
 gcc4.3geodenommx   | 137     | 347    


video input 2 (576i25_parkrun_ter.yuv)


 library            | patched | unpatched 
 default            | 89      | 197       
 gcc4.3 geode       | 92.4    | 190 
 gcc4.3 geode nommx | 147     | 892 


- the patch for super fastmode seems to give an impressive speedup. Depending on video input, encoding time is reduced by 33%-55% for the default org cc4.3-geode library.

- the gcc4.3 geode-aware configuration/compilation does not seem to provide performance gains against the default libtheora. In fact the default libtheora seems to be slightly faster for the superfast encoder mode - do we know the configuration/compiler flags used? Many performance critical routines seem to be hand-coded assembly. Are there important routines that the compiler affects? Any other compiler flag suggestions are welcome.

- disabling mmx has a big performance hit as expected.

- Do we have specific encoding timing restraints for videoconferencing applications? - Can anyone suggest suitable inputs that combine both video and audio?

I have not used the gnashdev gcc4.3 build (http://wiki.gnashdev.org/wiki/index.php/Building_OLPC_Tools), but my own build. Let me know if something seems to be missing from the configuration

configured with: /home/vliaskov/compilers/gcc-geode/gcc/configure --prefix=/opt/gcc4-3-gode --enable-shared --enable-threads-posix --with-systen-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-languages=c,c++ --disable-dssi --with-cpu=geode Thread model: posix gcc version 4.3.0 20080116 (experimental) (GCC)

[Vasilis Liaskovitis]

See also

External Links

  • [VLC], the free media player software can also encode Theora files.
  • Colingo's wiki contains an entry on how to encode your video in Theora and in Theora/Speex. Translation and walkthrough for this space to come.
  • [[1]] Manual page for ffmpeg2theora.