Where is the H264 advantage?

General questions or discussion about HandBrake, Video and/or audio transcoding, trends etc.
Post Reply
dlflannery
Posts: 41
Joined: Sun Jan 27, 2008 2:43 am

Where is the H264 advantage?

Post by dlflannery »

My general impression is that I get almost no reward (reduced file size or improved quality for same file size) when I use X264 encoding vs. ffmpeg-mpeg4. But it takes 8 to 10 times as long. I would like to get on the H264 bandwagon but I don't see how to benefit from it.

My video sources are SD mpeg2's with bitrates ranging from 2.7 to 5.7 Mbps. I view mp4's with VLC player and QuickTime player (latest releases). I encode to 640 wide formats with 1:1 PAR and bitrates of 900 kbps.

Here are command line examples for the two types of encoding:

For X264:
-i %mpgName% -o %mp4Name% -e x264 -b 900 -a 1 -E faac -B 160 -R Auto -6 dpl2 -f mp4 -P8:1:1 -m -2 -T -w 640 -l 360 --crop 60:60:0:0 -x ref=3:mixed-refs:bframes=3:weightb:direct=auto:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip=1:psy-rd=1,1

For ffmpeg:
-i %mpgName% -o %mp4Name% -e ffmpeg -E faac -r 29.97 -w 640 -l 360 --crop 60:60:0:0 -b 900 -B 128 -R 48 -v

The x264 case is the QuickTime preset modified by reducing the bitrate from 1800 to 900 and adding croppping and a -P option to force 1:1 PAR.

These produce about the same file size (not surprising) but the x264 version takes 10 times as long to encode. I am hard pressed to identify any significant superiority of the x264 output.

Why do I encode for QuickTime? I "hint" the mp4's and use Darwin Streaming Server to on-demand serve them to other computers on my home network. I tried VLC for the on-demand serving but never could make it work, and the VLC playback of files served by DSS was noticeably inferior to using QuickTime Player. My judgements of playback quality are based on direct (not streaming, not hinted) playback using both VLC and Quick Time players.

What am I doing wrong or missing here? Do you have to have HD videos for x264 to offer any significant quality/size advantage? Should I be able to get comparable quality from my x264 encodes at some smaller bitrate such as 600 kbps?
realityking
Veteran User
Posts: 680
Joined: Tue Apr 24, 2007 12:36 pm

Re: Where is the H264 advantage?

Post by realityking »

If ffmpeg encoding is already transparent to the source for a given bitrate H.264 can't have an advantgae. However you should be able to lower the bitrate and get the same quality.
dlflannery
Posts: 41
Joined: Sun Jan 27, 2008 2:43 am

Re: Where is the H264 advantage?

Post by dlflannery »

realityking wrote:If ffmpeg encoding is already transparent to the source for a given bitrate H.264 can't have an advantgae. However you should be able to lower the bitrate and get the same quality.
Good call! I repeated the same encodings at 600 kbps. The x264 had comparable quality to the ffmpeg at 900 kbps, while the ffmpeg at 600 kbps was noticeably inferior - not acceptable. Due to header overhead the file size was not 2/3 but more like 70%. I guess I have to decide whether a 30% savings in file size is worth ten times as much encoding time. On my pc the ffmpeg encodes at 90+ fps while the x264 (averaged over 2 passes) is around 8 fps.
jbrjake
Veteran User
Posts: 4805
Joined: Wed Dec 13, 2006 1:38 am

Re: Where is the H264 advantage?

Post by jbrjake »

...but it's not x264 that's so slow, it's the particular set of options *you* chose to tell x264 to use.

And really, full strength psy-trellis at 900kb/s? What are you thinking?
dlflannery
Posts: 41
Joined: Sun Jan 27, 2008 2:43 am

Re: Where is the H264 advantage?

Post by dlflannery »

OK..... So I tried a modified version of the "Normal" preset at 650 kpbs:

-i %mpgName% -o %mp4Name% -e x264 -r 29.97 -b 650 -a 1 -E faac -B 160 -R Auto -6 dpl2 -f mp4 -P8:1:1 -m -2 -T -w 640 -l 288 --crop 96:96:0:0 -x ref=2:bframes=2:me=umh

This encoded at an average fps (over two passes) about 1/6 'th the ffmpeg encode at 900 kbps. The quality seemed very slightly superior to the ffmpeg encode and the file size was 80%.

The "advantage" of H264 is better at least. Still - 6X encoding time for a 20% file size reduction - not impressive. I guess I should try either lower H264 bit rates or higher ffmpeg bit rates for a completely fair comparison (because the h264 quality was slightly better in this comparison).

The source mpeg2 in this case was 352x480, letterboxed at about 2.2:1 aspect (hence the cropping), and a bitrate of 2.7 Mbps. That's why I'm using such low bit rates in the encodings.
Post Reply