Our World. Our Minutae.

Friday, October 27, 2006

Handbrake: MPEG4 or H.264?

Handbrake, one of the great Mac apps of all time - clean, clutter-free and delivers exactly what it says it will do - it allows you to backup your personal DVD collection or any files from your DVD camcorder that you wish to convert to MPEG-4 or H.264 MPEG-4 - both formats then allow you to drag (or import) into iMovie, Final Cut Express (FCE) or Final Cut Pro (FCP). Another reason to convert and play back your movies as a QT file, you have much better audio & video controls in QT Pro than you do with Apple's DVD player - you can easily adjust contrast, color, brightness and pitch control (though Apple's DVD player does offer much better playback reverse & fast forward).

Handbrake offers many choices but I did not test a wide range of options, I just wanted to test out whether MPEG-4 or MPEG-4 H.264 was the better choice. Since I have Quicktime Pro, my guess is you will need that or FCE/FCP to have the H.264 option (which will automtically appear in the pop up menu in Handbrake if you do).


The bottom line is that you should ALWAYS turn on DE-INTERLACE and ALWAYS choose 2-PASS ENCODING for optimal quality (the file size with one pass is maybe 8% smaller but the quality difference is noticeable so there's no real advantage).

Based on my small tests and my final criteria based on my eyeballing it, MPEG-4 H.264 is about 5-10% better quality - it does encode way slower on all Macs (this was not tested on an Intel Mac). H.264 encoding takes about 75-100% more time when all else is equal so the trade off is your call. There's really nothing wrong with the "regular" flavor of MPEG-4 files - they are fine but to me, they just seem a tad soft. H.264 files are just a tad sharper but it's not exactly like SD compared to HD, it's just slightly better. The file sizes are very close - less than 1% difference so that shouldn't affect your choice.

What also interesting is with QT Pro, you also get AV settings (brightness, contrast, color & tint) to adjust your video quality and with H.264 files, I was able to achieve both a better and "warmer" looking picture by bumping up brightness, contrast level color settings slightly ... that I could not get plain old MPEG-4 to match. Admittedly, the settings in QT Pro are pretty sparse, it's a sliding bar with no numeric value but still interesting.

I also tried adjusting the average bit rate of plain MPEG-4 to an average bit rate of 2,000 - still not as good as H.264 at 1,200 (all other settings unchanged).

So, basically I recommend settings at: H.264, 2-pass, de-interlace and at least an average bit rate at 1,200.

If you more details, keep reading:

My tests are based on the recent film, NATIONAL TREASURE. I selected section 10 as it features a wide range of settings and shots - from exteriors to interiors and tight close up shots of text.

My two main settings were:

H.264, 2-pass, de-interlace and  average bit rate at 1,200.
MPEG-4, 2-pass, de-interlace and  average bit rate at 1,200.

I will just refer to H264 and MPEG4 from here on out to save a little time.

Photos are posted on FLIKR (linked) if you wish to examine them in greater detail at larger sizes. I used GRAB to grab the screenshots from the Handbrake files and I used SNAP PRO X to grab the DVD screenshots.

Front View of the Ben Franklin Museum ...
H264 is just a tad better - column on far right seems to more accurately capture shades of shadows ...

Front View of the Ben Franklin Museum ...
H264 is just a tad better - hard to tell from small view but chiseled words just seem to have a touch more depth in H264.

Front View of the Ben Franklin Museum ...
DVD Screenshot grab for comparison sake - though of course, you could rightfully argue that it's a compressed JPEG so it's not 100% accurate but you can get an idea that the MPEG-4's are not too far from the "base" DVD.

Silence Dogood Signature ...
As a medium shot, it's pretty hard to tell the difference.

Noddles ...
They add a "glow" efffect to the N in Noodles ... if you look at the larger version, the H.264 letters are just a squosh thinner while the MPEG-4 are a little wider and softer ...

You can also compare to the screenshot of the DVD.

Noddles Option A ...
I thought perhaps if I increased the bit rate to 2,000 as I've heard some people use this setting. It does create a much larger file (about 150 MB versus the @94 MB of the other two files and it took about as long as H.264 to convert - result, not much improvement if any at all and it still does not compare to the H.264 version). (the middle version is the MPEG-4, 2-pass, de-interlaced, 2,000 average bit rate).

Noddles Option B ...
I thought perhaps if I manually adjusted the playback quality using QT Pro's rudimentary settings - while it's hard to tell with fake parchment (presumably), you might be able to gleam the picture quality is just a tad warmer with H.264. With MPEG-4, there was no combination of color & contrast & brightness that seemed as warm as H.264 before getting over-saturated and "shadowy," (aka: dark).

Newspaper ...
If you look closely at the classified text ads to the way right, H.264 is just a tad darker and sharper.

$100 ...
H.264 is at the bottom - again, the text is just a tad sharper, the "cloud" effect seems to show off a slightly greater range of shadows and seems less flat. On the larger photo, you can also see the cuticles are just sharper in H.264.

Diane Kruger Adjusted
This is an adjusted playback - again, with H.264, the adjustments just seem a little warmer and "better," while an attempt to match the skin tone produced a darker version in MPEG-4 ... but ultimately, you could argue day and night - as you can see,  the difference is amybe 5-10% depending on the shot ...

Clothing Store
Again, hard to really say ...

So, if you choose MPEG-4 with 1,200 average bit rate, 2-pass encoding and de-interlace, it's a pretty nice picture - a a tad/skosh softer than the DVD but still pretty nice. A typical movie is around 950 MB so you can pack plenty onto any HDD nowadays.

If you want a few ticks sharper and you don't mind the much longer encode times (the file is less than 1% smaller in size) and you have the H.264 encoder, you get a miniscually better picture and your QT Pro playback options seem to offer a warmer range of adjustments. The only choice is a time commitment factor - ultimately, your encode time depends on how much RAM you have and what else you have running so your mileage will vary.

What's not mentioned is that Handbrake will convert PAL to a (NTSC) MP4 file so if you have discs you bought overseas and don't want to fiddle with the idiotic regional playback restrictions, convert them to QT files - with most films less than 1 GB, you can fit 4 on a DVD-R or you can just leave them on a HDD ... Once iTV is released, we can have our own international TV jukebox ... Enjoy!