Theora Soccer Video Comparison

This page shows a bunch of Theora samples of a soccer video to compare how well it performs. The page also makes heavy use of the <video> tag, just in time for the upcoming Firefox 3.5 release. Theora is a free and non patent encumbered video codec which works naturally with the new HTML 5 <video> tag, as supported by Firefox 3.5, Safari 4, and the upcoming Google Chrome 3. I don't have any particular knowledge about video codecs, but I'm a big fan of free and open standards on the internet, so Theora seems important and worth checking out now and again for later revisions.
Update 6-23-2009 got a suggestion that the default for ffmpeg/Mpeg-4 allows a more lax use of key frames and buffer size. I've tried changing the ffmpeg options to try to tighten in up to be more like Theora, but it didn't make much difference that I could see. See the How Made section for details. See also our slashdot thread.

Theora is developed by the Xiph foundation which promotes open media formats. No fee or permission is required to encode, decode, or distribute Theora content, making it an important part of keeping the web open. In keeping with their support for a free and open internet, Mozilla supports Theora as does Wikimedia.

The 1.0 of Theora came out pretty recently (Nov 2008) leaving lots of unfinished performance work, which is being worked on currently as the "thusnelda" project -- thusnelda 5-2009 status.

This page contains lots of embedded video clips using thew new HTML <video> tag, so you need to use a very new browser to see the clips inline, and I've included direct links to the videos the old-fashioned way. Browsers that support the <video> tag:

Firefox 3.5 (beta) -- This seems to work the best overall, although for Mpeg-4 you may need to use the direct link.

Google Chrome Works well, but you need to use the Windows dev-preview version. The Mac and Linux versions might work but are in a more primitive state.

Internet Explorer -- No. Microsoft has not announced support for the <video> tag in IE that I can find, but it would be great if they did. Microsoft is heavily promoting Silverlight, which is their proprietary video system. Likewise, Adobe naturally prefers that everyone use their proprietary Flash video system.

Mpeg-4 Background

Mpeg-4 AVC/H.264 -- I'll just refer to it as "Mpeg-4" -- is a high quality video codec in wide use on the internet and on Blu-ray disks, so Mpeg-4 is the natural one to compare to Theora. A lot of effort has gone into optimizing Mpeg-4 to give good quality with minimal bandwidth, and it is heavily patented and fees must be paid to use both encoders and decoders (in jurisdictions with software patents). After 2010, Mpeg-4 fees are increasing to include "internet broadcast fees" which apply when distributing Mpeg-4 content on the internet. This means that if I host my own Mpeg-4 clip on my own site, I owe an additional fee depending on how many times the clip is downloaded (for clips over 12 minutes) -- see mpeg licensing press release. Mpeg-4 has good performance but bad licensing if you think anyone should be allowed to publish or view video on the internet. Hence all the interest in Theora!

Mpeg-4 Soccer Clip

Xiph.org hosts a nice collection of uncompressed test media files, so I experimented with a few of those, and below are results with clip titled "soccer" which is a rather large and is fun to watch. It has a significant amount of motion in it, so I expect it is demanding on the video codec. I also made a page analyzing the "tennis" clip which is smaller and has less going on.

Mpeg-4 Version, 1000kbps

As a baseline, here is the soccer clip encoded as Mpeg-4 at 1000kbps. At this rate, my subjective sense is that the video is pretty clean and without major artifacts. To see this, obviously your browser needs support for Mpeg-4, either built in or as a plugin, such as Quicktime. (Update: see How Made section for updates to the encoding flags.)
If you can see this, your browser does not support the <video> tag
1000kbps (direct link) (adjusted VBV version)

If the video above is not working, or if the video stutters, the direct link may work better. It may play more smoothly a second time, if the browser is smart enough to cache the 1.3 megabyte clip. If you can't get the soccer clip to play well, try the tennis clip, since it's much smaller.

Heh -- my fiddling around, trying to distribute video using this page happened to demonstrate the strength of open standards. The Theora version worked on every browser I tried. Since the licensing is trivial, it's technologically more straightforward for a browser to include Theora support (well, if the browser vendor wants it to work, cf. Internet Explorer). In contrast, Mpeg-4 support seems fragile, depending on the combination of computer, browser and plugin configuration. There were some Mpeg-4 computer/browser combinations I never could get to work.

Note that the "1000kbps" here means 1000 kbits per second, which seems to be the unit most video tools use to measure bandwidth. The actual size of the clips also varies by about 5%, since I directed the encoder to aim for 1000kbps, but it naturally misses by a little.

Theora Version, 1600kbps

Here is the same soccer clip encoded with Theora with the bandwidth set high enough to achieve roughly the same subjective quality as the Mpeg-4 version above. This is not a precise way to compare codecs, but gives a good +/-20% measure of how the codecs stack up.
If you can see this, your browser does not support the <video> tag
1600kbps (direct link)

This is a very subjective matching, trying to weigh how the codecs deal with different parts of the scene (no need to flame me about it -- you can try it yourself below). In this case, Theora uses 1600kbps, or about 60% more bandwidth than Mpeg-4 to reach about the same quality. The Mpeg-4 compression produced a slightly darker image, but I tried to ignore that and just focus on the compression artifacts.

Looking at a few different clips, Theora seems to do a good job with the active/moving parts of the scene without using too much bandwidth, but had a tougher time with the flat, boring area in the background. I had to keep bumping up the bandwidth until the background area wasn't distracting.

I tried a few different clips, but with similar results. Take a look at the tennis page for a second example. I must say, I was hoping that Theora would perform a little better, but it has decent performance and is improving. The uncompressed clip is 349 megabytes, while the 1600kbps Theora clip is 2 megabytes -- Theora may lag Mpeg-4 at this time, but it still yields great compression.

I want Theora to succeed, and as part of that we have to look at its current performance objectively. With this 1.1alpha version, Theora requires somewhere around 60% more bandwidth than Mpeg-4, but Theora is being actively improved, so we'll see. The Mpeg-4 we have today is the result of years of tuning on the encoders.

Aside: Mpeg-2 (a predecessor to Mpeg-4) is used in DVDs and digital cable systems, so it is probably currently the most widely used video codec on earth. Anyway, Theora is significantly better than Mpeg-2. Mpeg-2 required about 2400 kbps to hit the subjective quality level above, 50% higher than Theora's bandwidth. Like Mpeg-4, Mpeg-2 is heavily patented.

Try It Yourself!

Comparing different versions is highly subjective, so here's the good part -- below are 7 Theora versions encoded with increasing bandwidth from 1000kbps to 2400kbps, so you can try your own comparisons. Similarly, the tennis page shows a range of Theora versions for that clip.

Select Theora Video Bandwidth:

**Video Goes Here**

The Theora clips are under a javascript control -- otherwise some browsers tried to pre-load all the clips as soon as you hit the page, causing everything to get real slow (probably not making the Stanford servers too happy either!). Once the <video> tag is more mature, I expect browsers will become smarter about that case ... much as has happened for the <img> tag. The tennis page does not have the intervening javascript if you want to see how that works. It's also nice to look at the 2400kbps version, and appreciate for a moment that it's a free and open video codec that it looks quite good today.

Other Issues

Other issues which complicate my measurements here:

The soccer clip is pretty active. I tried a few other clips, but didn't find that much difference, but no doubt choosing different clips will hit different strengths and weaknesses. In particular Greg Maxwell did a comparison like this one, but found Theora to perform better than I did. However, he included audio and used a computer generated animation (Big Buck Bunny). It may be that Theora does especially well on animations. He also used Youtube to do the Mpeg-4 encoding, so perhaps Youtube does not do as good a job as ffmpeg (the ffmpeg command I used is shown below).

I did not include any audio. My understanding is that the free/open Vorbis audio codec is quite competitive with the patented alternatives, so including an audio track would make the Theora percentage disadvantage smaller. However, to keep things simple and focus on video codec performance, I think it's best to omit the audio.

I use the word "Theora" to refer to the clips encoded with Theora, although that's not quite technically accurate, since it's an Ogg container holding some Theora content. I think the word "Ogg" sounds horrible to a normal person, and I wish I could go back in time and have them choose a more user-friendly name for what has turned out to be an important, user-facing bit of technology. What is it with nerds choosing product names loaded with ironic allusion, but which don't actually work well as names? I suspect that if Theora-in-ogg-with-vorbis becomes important and widespread on the internet, it will be called just "Theora" or perhaps "ogv" (the file extension), much as "mp3" is now a word recognized by normal people.

Disclaimers!

I work part-time at Google, but I haven't talked to any Google video people about codecs and I certainly am not speaking for Google. This is just something I did on my own time -- like most engineers, my instinct is that free and open standards are the right way forward for the internet, so I was curious about Theora.

Dirac

I should also mention the Dirac Video Codec which, like Theora, aims to provide a free, open, and non-patented video codec. Dirac has the potential to provide better compression than Theora, but Dirac is very young, so it remains to be seen how that works out.

For the soccer clip, had the encoders to resample it to 30 fps, as otherwise my player software was having problems with it, messing up the subjective comparisons. Otherwise, I left the size, fps, etc. all unchanged.

Command used: ffmpeg -i $file -f mp4 -vcodec libx264 -an -vpre hq -b $kbps"k" $file-$kbps".mp4" (originally also had the -bt $kbps"k" but that was extraneous and made very little difference)

Update 6-23-2009 Got a suggestion to make the comparison more fair by enabling VBV for Mpeg-4 and setting a more narrow buffer constraint to make its encoding constraints more similar to Theora's. From what I can tell, the right flags for that are with the -maxrate and -bufsize, giving buffer space for 2 seconds (see ffmpeg/x264 option mapping page). Mpeg-4 encoded this way is included above, but it didn't make much difference that I could see. Perhaps I don't have the flags really level between the two yet. The more interesting question to me is: what are the flags for ffmpeg2theora for it to have the best quality/bandwidth for a file-on-webserver case..