Internet Archive News

updates about

improved theora/ogg video derivatives!

We’ve made our ogg video derivatives slightly better via:

  • minor bump up to “thusnelda” release
  • “upgrade” from 1-pass video encoding to 2-pass video encoding
  • direct ffmpeg creation of the video (you’ll need to re/compile ffmpeg minimally with “–enable-libtheora –enable-libvorbis” configure flags)

ffmpeg -y -i 'camels.avi' -q:vscale 3 -b:v 512k -vcodec libtheora -pix_fmt yuv420p -vf yadif,scale=400:300 -r 20 -threads 2 -map_metadata -1,g:0,g -pass 1 -an -f null /dev/null;
ffmpeg -y -i 'camels.avi' -q:vscale 3 -b:v 512k -vcodec libtheora -pix_fmt yuv420p -vf yadif,scale=400:300 -r 20 -threads 2 -map_metadata -1,g:0,g -pass 2 -map 0:0 -map 0:1 -acodec libvorbis -ac 2 -ab 128k -ar 44100 tmp.ogv;
ffmpeg -i tmp.ogv -vn -acodec copy audio.ogg;
ffmpeg -i tmp.ogv -an -vcodec copy video.ogg;
oggz-comment audio.ogg -o audioC.ogg TITLE='Camels at a Zoo' LICENSE='' DATE='2004' ORGANIZATION='Dumb Bunny Productions' LOCATION= ;
oggz*merge video.ogg audioC.ogg -o tmp2.ogv;
mv tmp2.ogv 'camels.ogv';

some notes:

  • You’d want to adjust the “scale=WIDTH:HEIGHT” accordingly, as well as the “-r FRAMES-PER-SECOND” related args, to your source video.
  • It’s *quite* odd, I realize to have ffmpeg transcode both the audio/video together, only to split/demux them back out temporarily.  However, for some videos, the “oggz-comment” step would wipe out the first video keyframe and cause unplayability in chrome (and the expected visual artifacts for things that could play it).   So, we split, comment the audio track, then re-stitch it back together.
  • I made a small patch to allow *both* bitrate target *and* quality level for theora in ffmpeg, after comparing the other popular tool “ffmpeg2theora” code with the libtheoraenc.c inside ffmpeg.  It may not be necessary, but I believe I saw *slightly* better quality coming out of theora/thusnelda ogg video.  For what it’s worth, my minor patch is here:
  • The way we compile ffmpeg (ubuntu/linux) is here.  (Alt MacOS version here (would require some minor mods to enable theora))
Originally posted on The Internet Archive Blog by traceypooh.

Written by internetarchive

May 1, 2012 at 9:02 pm

%d bloggers like this: