Video Encoding: Handbrake

HandBrake Logo After ripping the DVDs I’ll be needing to encode them so I can watch them on my various devices. The premier software in this category is the open source Handbrake. There’s versions for Mac OS X, Linux and Windows. I’ve been using Handbrake 0.9.2 for OS X.

Handbrake can encode directly from DVD if they are unencrypted or encrypted with CSS encryption. But Handbrake isn’t a dedicated ripper and feeding Handbrake unencrypted video is recommended for best results. I took the approach of first ripping the DVDs to disk using either Fairmount or AnyDVD. This resulted in mostly problem free files. I did have to re-encode a few files that worked in VLC but locked up iTunes/AppleTV/Quicktime and I had an occasional odd problem. But the failure rate was less than 1%.

The list of supported sources and outputs is listed on the Handbrake web site as:

Supported sources:

* Any DVD-like source: VIDEO_TS folder, DVD image or real DVD (encrypted or unencrypted, but protection methods other than CSS are not supported and must be handled externally with third-party software), and some .VOB and .TS files
* PAL or NTSC
* AC-3, DTS, LPCM or MPEG audio tracks

Outputs:

* File format: MP4, MKV, AVI or OGM
* Video: MPEG-4 or H.264 (1 or 2 passes or constant quantizer/rate encoding)
* Audio: AAC, MP3, Vorbis or AC-3 pass-through (supports encoding of several audio tracks)

Handbrake Presets

Handbrake provides a multitude of settings for tweaking the video but also comes with numerous presets which are shown to the left. In my case I was looking for quality and didn’t care too much about file size. I also didn’t care about playing the video on my iPod. I wanted to play the video using iTunes, Front Row and Apple TV but I didn’t want to be locked into that software.

I played around with various bit rates and other settings and watched several test encodes on my computers and TV. For awhile I was considering different settings based on how much I valued the video. Older TV shows or movies I didn’t watch very often would have gotten lower bit rates to generate smaller files. I eventually decided that since file size wasn’t too important to me I’d be better of with one standard setting and since quality was my primary concern I might as well pick a “constant quality rate” (CQR) setting.

The CQR setting is a percentage. I’d be using the x264 encoder and according to people who know (in the Handbrake docs and forums) a setting above 80% doesn’t improve the quality while still increasing the file sizes. This is because the DVDs already use compression and 80% is roughly equivalent to the DVD compression. I ended up picking a setting of 64%. I still couldn’t see a difference between this and a lower setting on my computers and TV but I figure this would allow for some upgrades to my video hardware. Some of my test encodes where at 54% and were “good enough” so I haven’t bothered to re-encode them.

I encode the audio at 160kps and encode the videos as an MP4 file but I change the extension to .M4V so that iTunes will recognize chapter stops. (There’s a setting in Handbrake to rename the extension automatically. The files also play fine in VLC although there aren’t any chapter stops. I don’t generally use chapter stops but figure they’re nice to have.

All my settings for video and audio are shown in the screen shots below, click the thumbnails to see them full size. My chapter and advanced settings are still at their defaults. These settings resulted in a file size between 185 and 250MB for 15 minutes with most videos being around 200MB per 15 minutes.

Handbrake Video Settings Handbrake2

I’ve only had a few minor problems with Handbrake. As I mentioned some of my encodes had to be redone. The most common were videos that worked fine with VLC but not in any Apple product. There was less than a handful of problems of any type and they were solved by re-encoding. I didn’t have to re-rip or change any settings so it appears to be just “one of those things”. But it does mean I check all my videos in QuickTime rather than VLC or MediaInfo Mac. There was one DVD that encoded with a 14 hour playtime even though it was only about 2 hours. The solution here was to drop the last chapter, which was only 1 second in actual length.

I’ve also encountered a few Handbrake crashes, usually when using the file open dialog to either select the source files or destination location. This typically happen after many file opens in a session but wasn’t consistent. It was annoying when setting up a night of encodes only to have it crash near the end. So I began to skip changing destination file names and stick with the default, renaming the file when it’s done. Handbrake default to the source directory name when creating the output files so I’ve been making the directories match the file name I want.

HandBrake can create video files greater than 4GB but since 4GB is the maximum size supported by many players I haven’t enabled this feature. This means HandBrake crashes for me when it reaches 4GB. When this happens I set it to encode a file of 4GB and let it figure out the bitrate to achieve that. This has been very rare and only when the source files are approaching 4 hours.

Ripping is CPU intensive and it’s the one thing that affects speed. My iMac rips faster than my mac Mini. While there’s a lot of things that affect performance I estimate roughly 45 minutes of ripping per hour of content on my iMac. This flips on my Mac Mini which takes about one hour to rip 45 minutes of content. I never sit around waiting for a rip to finish, rather they get queued up and run overnight or when I’m otherwise not using the computer. My Mac Mini also serves as a media computer but if I was looking for something to dedicate to ripping I’d look for a cheap windows PC with the fastest CPU I could afford rather than buy a Mac Mini to dedicate to ripping. (Having said that, I haven’t tried the Windows version of Handbrake).

The Bottom Line

The bottom line is Handbrake is the only ripper I looked at and it hasn’t given me a reason to look elsewhere.