After Youtube and Vimeo presented their test pages in HTML5, a wave of conversations started again about what is better: H.264 or Ogg Theora.
I, of course, for the free web. But the conclusions that Theora is superior to H.264 in quality, made by many people from the results of two dubious comparisons (
once and
twice ) are very hasty.

In the first comparison, neither a test video, nor any codec settings are presented. In the second, it says that for the H.264 codec, a deliberately settling preset was taken from Youtube, and the Theors settings are silent.
')
So I decided to check myself what is Ogg Theora and what this codec is capable of.
Format comparison
The first thing I noticed is
the Ogg Theora feature list . For comparison, the
list of H.264 featuresWhat confused:
- The minimum block size is 8x8 (in H.264 the minimum is 4x4, which allows for better preservation of small parts)
- Lack of arithmetic coding (which allows you to earn 15 percent for free)
- Half-pixel motion compensation accuracy (quarter-pixel in H.264)
- No b-frames
It if only to compare the description of opportunities of different formats
It is worth noting that the feature list H.264 is much longer. So it seemed to me surprising that the less advanced codec obviously wins the comparison.
Codec Versions
Theorists' binaries are not presented on the site, but I did not manage to compile from the source = (I found the ffmpeg2theora
builds .
Theor 's version 1.1.0 (libtheora 1.1 20090822 (Thusnelda)), although
xiph.org contains version 1.1.1. But for the latest version only minor fixes are declared, so I think that's okay. So, meet in the blue corner of the ring
ffmpeg2theora 0.25 .
For comparison, I decided to take the
x264 codec . Quite an advanced member of the H.264-codec family with a lot of settings and good community support. With open source, besides. According to the results of the
last comparison from MSU Videogroup, he took second place, just a little behind the leader. So, in the red corner of the ring
x264 r1400 .
For decoding, I used the plugin for AviSynth
FFmpegSource2 version 2.12.
Comparison method
For comparison, I took four video sequences with a resolution of 640 pixels wide. Coded in two passes (so much easier to get into size) with a bitrate of 500 kbps. Theory settings were set for maximum quality and the most flexible rate control. For x264, I took two presets: the first one - similar to Theory's capabilities (half-pixel shifts, no b-frames, 8x8 block size, etc.), the second one is the usual x264 preset with all included features. Quality was measured with
PSNR and
SSIM metrics using
MSU Video Quality Measurement Tool .
I did not evaluate the coding time, since it is a big problem to even out the results by time. And most likely x264 would get a noticeable speed advantage due to assembly optimizations, since this is a more mature project.
Presets
Theora:--soft-target --two-pass --optimize --speedlevel 0 --keyint 250
x264 analogue:--bframes 0 --no-cabac --partitions i8x8,p8x8 --me umh --no-mbtree --no-psy --no-fast-pskip --no-dct-decimate --subme 1
x264 normal:--bframes 4 --b-pyramid normal --partitions all --me umh --no-psy --trellis 2 --no-fast-pskip --no-dct-decimate --subme 10 --b-adapt 2 --direct auto
() , . , x264 ref=3.
- Battle
, - , , . . - Football
. use-case, . - Shuttle start
, . . - Toys and calendar
.
PSNR SSIM. , SSIM . , , SSIM . PSNR .


, Theora x264. x264 . .
.
Battle
PSNR , . , , x264 — .
.




, x264




Football
- . x264 .




Shuttle start
. x264 - .




Toys and calendar
. x264 , . . x264 , .




, , , . 5% , .

. , . . , .
- , - , . , x264 , Theora. Theora , x264 — , x264 normal. SSIM. SSIM x264 , , .
:

2-4 .
x264
x264 . Ogg Theora. , , .
x264:
- b-
- --tune ssim --tune psnr, , ( Theora PSNR)
- ,
- ,
x264
x264 analogue . , , :
H.264 — , Ogg Theora, /. , .
, . .
(25 )
(365 ) — , lossless- huffyuv.