theora video vs. h264


Some of you may have seen some of this on Slashdot or elsewhere online, but I'll bet that many haven't and I think it's pretty important as we get ready to unleash <video> and our unencumbered audio and video codecs and the Ogg container format onto the Web.

Let me preface the links by noting that yes, there's still a long way to go before we can say that Open Video will succeed, but the pieces are coming together and at least some of the chicken-and-egg problems are starting to be solved.

I've been working with Mozilla's Open Video technologies (including the Ogg container format, Theora video encoding, Vorbis audio, and the HTML 5 <video> and <audio> tags and their respective DOM APIs) for about 10 months and I've watched not only Firefox's implementations improve, but also the tools and the codecs themselves making great progress.

Firefox now has a pretty nice set of audio and video controls that are certainly ready for an initial launch. The DOM APIs, while not complete, are good enough that we built our browser controls using them and people are able to do some pretty cool demos and even final implementations with them. The Xiph QT Component, a tool that brings Ogg/Theora+Vorbis to QuickTime-capable apps has just had another release that brings it up to speed with the Theora 1.0 release and fixes some key bugs. (And another release is expected soon.) Theora 1.1 alpha 2 has made some really big gains for video encoding quality.

And, we're about to ship these capabilities to 300 million Internet users.

So, what about quality. First, it's important to note that when we talk about video on the Web, quality has to be paired with size. So, what kind of quality can you get from Theora in a comparable file size to H.264 -- the latest and greatest of the not-Open video codecs.

In recent days, Greg Maxwell and Maik Merten have both put up some real-world comparisons that go beyond the geeky sort of synthetic and objective benchmarks that made the rounds last month.

Greg's comparison is here and I think it makes a pretty good case that Theora+Vorbis is solidly ahead of YouTube's H.263(Sorensen Spark)+MP3 and quite competitive with YouTube's high quality H.264+AAC at resolutions of 400x226 and 480x270 respectively.

I'm a stickler for audio and video quality and even have some formal background in both and I can certainly see some differences.

I think that Theora+Vorbis absolutely trounces H.263+MP3 and I don't think there's even a question of which kind of artifacts you prefer. Theora+Vorbis is just plain better than the majority of what YouTube and many other Flash video sites have been serving to users for years.

When it comes to the H.264+AAC comparison, I think things are a lot closer and I personally prefer the H.264 video. (I couldn't pick a winner in audio but perhaps if I had a better pair of headphones...) The H.264 video isn't miles ahead though and I'd wager that most people, and this is supported by a few folks I've asked to look at it, either won't see a difference or if they do see a slight difference aren't bothered by it.

Not satisfied with those two rather low resolution video comparisons, Maik just posted a comparison at 1280x720 and the results are also quite positive for Theora+Vorbis.

Watching these two videos it really does seem to me like I'm asked to pick which kind of artifacts are least bad. Both videos have issues that bother me and the Theora version doesn't have quite the color saturation and contrast balance of the H.264 version but they're really not that far apart. Overall, I think I again prefer the H.264 version but only barely and the truth is I pay a lot more attention to the subtle differences than most Web users and even many content producers.

Oh, and one final closing thought. The Theora encoder is getting better every day and by the time we've rolled out Open Video to 300-400 million Web users (say, end of the year-ish when most of the Firefox user base will have completed the upgrade to 3.5) I think we're going to have a Theora encoder that will match H.264 for Web content in the eyes of 99.9% of the Web population.


BIG FAT WARNING: you said that there are differences between Theora and H.264 in "color saturation and contrast balance".

AFAIK this should *not* happen: compression artifacts should only be blockiness and fuzziness. If you see differences in saturation and contrast, it can be caused by a bug somewhere in the encoding or decoding chain of one of the two codecs.

E.g.: a bug that I've seen sometimes in the past is using incorrect YUV RGB conversion routines (there are two different and commonly used YUV spaces, the one used by JPEG images and the one used by everything else), this bug results in symptoms similar to the ones you described.

I recently experimented with putting videos online with HTML5 Video and Firefox without really any prior experience with video for the web. I was really impressed with how well it *just works* and that, to me, is way more important than minor quality differences.

'ffmpeg2theora video.avi' was all I needed to convert the file from my camera. After uploading the file to a server and creating a (very) simple HTML file, Firefox started loading the file very quickly, with a preview, and was able to start playing almost instantly. The built in player controls were great, too.

I also tried H.264 with the Opera beta and Firefox+Flash. The process was not nearly so smooth.

My only concern is that Theora isn't waaaay better than H.264. It's of comparable quality.

So I suppose the next question is... how do we go about persuading webmasters to use Theora over H.264? Bearing in mind, the quality is about the same, and H.264 support exists wherever QT player is installed, and that's a lot of computers and a certain make of phone.

Still, I for one am glad to see Firefox adopt built-in support for an open video technology.

YouTube's high quality H.264+AAC at resolutions of 400x226 and 480x270 respectively.
Yeah right. Youtube's encoder that produces these videos is baseline-profile only and is not good even at that. There's a reason Youtube switched to the x264 encoder for the HD videos. If they used x264 in a high-profile configuration for the HQ videos (or at least main-profile), they'd look tons better.
Theora will never reach even close to the quality of h264/avc because of it's design. Though I will admit it might be in the "good enough" quality for the Youtube crowd. But beyond that, Theora is in no way competitive.

I am all for open* for the Internet and I agree that there are many combinations of video+audio that beat h263+mp3. The problem is that the Ogg stack does not decode natively in Flash! (I know theres an Alchemy project for Ogg audio). Flash has the install base and will continue to be in the leading position for some time (I believe). Get performant decode of Theora/Vorbis in Flash and I will be one of very many happy people! Once we have decode the sky is the limit, using something open like Red5 ;)

Disclaimer: I am a Red5 committer

unfortunately the theora/vorbis advocates think only in terms of software. h264/aac are the new state-of-the-art de-facto standards on hardware, which should be also considered.

YouTube is a whole different ballgame - I'm not sure what they do to their videos, but they turn most stuff to sludge, even at higher resolution. Even their H.264 ones are nowhere near as good quality as I can get for the same filesize/bitrate. I've tried every format to try and get stuff looking better on YouTube, but it always ends up looking like an early-generation wmv, with everything blurred over.

I've also tried to upload files encoded to the exact format and parameters that YouTube files appear to be (after ripping and analysing a few), hoping that YouTube won't then bother to reencode, but it still does, and the results are horrible, compared to my identically-sized original files.

The problem is most likely that YouTube uses the same parameters for every file. Different files need different keyframe frequencies, and being able to do a two-pass encode can make a huge difference. I wouldn't blame YouTube for doing single pass, given the server load for encoding.

Either way, I cannot see the point of doing a comparison of Theora with something ripped from YouTube. The only fair comparison would be to find some software that would encode to both formats, convert both with the exact same parameters, then compare. And as the Greg guy notes on his site, still frames are no use for a comparison, you need to watch the actual files in video mode.

Reply to favor mpeg:

H264 is still patent encumbered regardless the quality and royalty will apply in 2011. DailyMotion and other chose to not wait for that problem by switching to Theora. Unlike H264, Theora is open to the public and vendor neutral.
Instead of making another MP3 or MPEG-2 like, why not working on open standard?

Since only Mozilla and Opera want open video on the web, unfortunately website authors will be forced to use both H.264 and Theora to reach majority of users.

All you stupid freetard and theora video.. I swear it worse than listening to the Freetard Linux people

I did my own test, I used oggconvert on Ubuntu and Evom on Mac OS X to convert the same piece of footage from my digital camera. They where of equal quality, ie the highest possible, the ogg video was darker than the original and the h.264 video, it was also twice the size of the h.264 video and roughly 3 MB larger than the original. Please if I've used a crap convertor in Linux please tell me and I'll retest. But at the moment I'm confused as to what all you are all getting wound up over, H.264 is clearly technologically superior.

Theora might not be as badly behind in live action footage, but it is solidly tragic when it comes to animation. In my own tests, theora 1.1 alpha2 wasn't competetive with x264 even when using DOUBLE the bitrate, not to speak about when the filesizes were equal...

The main problem with the Thusnelda branch is its incomplete rate control. If your encoder isn't very good at compression, it's obviously a burden that leads to higher filesizes needed. If it however can't efficiently decide what to do with the bits it has to spend, any clever tricks it's using go to waste and the picture quality will suffer. I wouldn't have the balls to ask businesses to swithc to such codec. True, youtube's h.263 is also very bad. But if they are to switch, shouldn't they choose something that isn't alpha and works efficiently and without glitches? Sadly, Theora's new Thusnelda encoder is late to be able to go into the present codec fights.

I viewed Maik's 480x270 clips on a G4 processor with the VLC media player. CPU utilization and picture quality looks the same to me, even when the image is stretched to full screen. Granted there is not much motion and that's where some codecs break down--but I can't see any meaningful difference between these two clips. At this resolution, this type of content and this bitrate, both codecs are equally acceptable. I certainly would not pay a license fee to use H.264 if I only needed to encode and serve this kind of material. Theora really seems to be frightening some people like "Jeff" who expected to get rich with 264.

Typical amateur comparisons. only know about obvious file size, video size and bitrate but know nothing about profiles/encoding options/encoding time.

I am interested in ogg dev. my email:

Will a plugin for firefox be able to play h.264 videos without trouble? As a firefox user and web developer I find it a bit ridiculous you guys don't support both video formats and let the best format win. So you are just making it harder for every website out there. We want one video format so we can move away from buggy flash video playback. I doubt youtube is going to re-encode all of their videos.

Lets think about this another way. Look at all of the wasted energy you guys are creating because of this decision. Think of how much more energy is required for the cpu cycles to convert 100's of millions of videos in addition to 100,000's of more computers to store all of this.

This is just such a stupid idea to come down on the ogg theora side. If you are worried about patents you should really review your logic. It makes no sense from a patent standpoint either.

Monthly Archives