H.264 versus WebM

2011-01-12 22:00 h.264 WebM video x264

There’s been a lot of noise recently about Google’s supposedly “free” WebM video format versus the widely-used (but patent encumbered) H.264 video format used by Flash, Apple devices, Blu-Ray players, and just about everything else.
The best H.264 encoders perform better than WebM’s VP8 codec based on the objective SSIM metric, and the consensus is that H.264 video in general looks “better” at the same bitrate than VP8. But how much better, at “web video” resolutions and bitrates?
I took a number of widley-used HD test clips (which are designed to “stress” video codecs) and concatenated them into one test video. I then encoded the result at 640x360 resolution at 500 kbps.
First, the H.264 sample. I used x264 as it seems to be the best H.264 encoder around.

x264 core:110 r1820 fdcf2ae  
  
x264 --preset veryslow --tune film -B 500 --threads 0 --pass 1 -o all\_vids\_360p\_500k\_h264hi31.mp4 all\_vids\_360p.y4m  
x264 --preset veryslow --tune film -B 500 --threads 0 --pass 2 -o all\_vids\_360p\_500k\_h264hi31.mp4 all\_vids\_360p.y4m  
  
pass 1: 62.66 fps, pass 2: 32.48 fps, total encode rate: 21.39 fps, final bitrate: 502.10 kbps  

Next, the WebM sample, encoded with the vpxenc tool provided by the WebM project.

vpxenc WebM Project VP8 Encoder v0.9.5  
  
vpxenc all\_vids\_360p.y4m -o all\_vids\_360p_500k.webm -p 2 -t 8 --best --target-bitrate=500 --end-usage=0 --auto-alt-ref=1 -v --minsection-pct=5 --maxsection-pct=800 --lag-in-frames=16 --kf-min-dist=0 --kf-max-dist=250 --static-thresh=0 --drop-frame=0 --min-q=0 --max-q=60  
  
pass 1: 71.36 fps, pass 2: 8.88 fps, total encode rate: 7.90 fps, final bitrate: 508.298 kbps  

Now, the WebM sample looks pretty good, except for the “tough spots” such as the flames, water, and fade transitions. It also seems “softer” overall than the H.264 video. Clearly, VP8 has improved with the latest 0.9.5 release, but it is still not close to H.264 at “web video” sizes and bitrates.
Of course, if you throw enough bits at the problem, the differences between codecs start to disappear. I was unable to see much of a difference between H.264 and WebM using the same clips at triple the bitrate (1500 kbps). However, such a high bitrate for a low-res 640x360 video would be very uncommon. YouTube, for example, uses ~500 kbps for the 640x360 rendition of a video.

Source of lossless HD test clips used in this video, which were resized to 640x360 before encoding.


Comments:

great article!

[Anonymous]( “noreply@blogger.com”) -

great article!