Fast and reliable way to encode Theora Ogg videos using ffmpeg, libtheora, and liboggz

archive.org has started to make theora derivatives for movie files, where we create an Ogg Theora video format output for each movie file. after trying a bunch of tools over a good corpus of wide-ranging videos, i found a neat way to make the Archive derivatives.

18 Responses to Fast and reliable way to encode Theora Ogg videos using ffmpeg, libtheora, and liboggz

you should not use the ffmpeg vorbis encoder, it is really bad quality,
please use libvorbis. you can do this by changing your line to:
ffmpeg -y -i CapeCodMarsh.avi -vn -acodec libvorbis -ac 2 -ab 128k -ar 44100 audio.ogg

This doesn’t work for me, it just throws an empty tmp.ogv .. it seems that the pipes aren’t working because if I ffmpeg -an -deinterlace -s 400×300 -r 20.00 -i CapeCodMarsh.avi -vcodec rawvideo -pix_fmt yuv420p -f rawvideo OUTPUT .. it works and gives a huge file. but I don’t have the space to do each one separately. that’s on ubuntu hardy. any ideas on how to make the pipes work?

Please don’t use the Vorbis encoder included in FFMPEG. It produces very low quality, even at high bitrates.

It is hard for me to express in words how much worse the ffmpeg Vorbis streams sound. So, I’ve put up some 11 second examples: With my test file when you ask ffmpeg for 128kbit/sec you get this 64kbit/sec result. At a comparable output bitrate Xiph.Org libVorbis gives this result and even at 45kbit/sec libVorbis simply sounds much better. … and Xiph.Org libVorbis isn’t even currently the best encoder available for these bitrates.

After listening I’m sure you can see that this is not just a nit-picking difference. The ffmpeg output simply sounds *bad*. It’s not not something which should be associated with the Vorbis name, and it’s not the quality that the public already expects from Vorbis. (if you have trouble playing the FFmpeg produced Ogg— this may be because the file is also not spec compliant, though it played on everything I had available to me)

I’m unsure why ffmpeg is not shipping one of the liberally (BSD) licensed encoders. The Xiph.Org reference encoder in libvorbis would be an acceptable and obvious choice. (Although AoTuV would likely be a better choice, the difference is small compared to the output of the FFMPEG encoder). I don’t think most people in the Vorbis world were even aware of the FFMPEG encoder until it was noticed how poor the archive.org files sounded, as most people producing Theora files are using ffmpeg2theora which makes use of libVorbis to encode Vorbis audio.

The above processing changes could be probably be amended to have the ffmpeg audio step output PCM, and pipe that into oggenc. Alternatively it may be possible to get ffmpeg to use libvorbis, as ffmpeg2theora does.

Hum, that is something to think about. I thought ffmpeg was good. I just finished posting a blog about it. I never new that the ffmpeg theora/vorbis output.file was less quality than the ffmpeg2theora. I am going to check that out. What I have noticed is that ffmpeg2theora takes a long time, I mean really long time to do the same job that ffmpeg does.

yes, ffmpeg on newer ubuntu linux distros, can be setup to use libvorbis. so we are doing that now. we weren’t using “-acodec vorbis” previously just to showcase poor quality audio, but simply because in our 18-month old OS, that alternative simply wasn’t there.