Friday, January 02, 2009

Converting videos using Handbrake for OSX

I'd like to share my experience with using Handbrake to convert videos for IPod, PSP and mobile phone use. Background: This Christmas break is, I believe, one of the longest ones ever. Preparing for it, I decided I wanted to convert the ripped DVD movies on my drive to a format that can be played on an IPod nano, a Nokia 5800 and a PSP. Coupled with the fact that I was playing around with osx86, I found Handbrake. Handbrake is an open-source multi-platform, multi-threaded, DVD to MPEG4 converter. Checking out the available binaries, I found that it was available for my 10.5.5 hackintosh. I downloaded the GUI DMG package file for Intel, installation was simple and easy. I then proceeded to convert a 40 minute episode of House MD Season 2, the process went smoothly and it took about 6 minutes. When I tried playing it using MPlayer for OSX, the audio was flaky and skips. I also tried VLC, it exhibited the same behavior, skipping and unacceptable. I hit google and the forums for Handbrake and indeed, version 0.9.3 had problems with converting certain source streams with certain characteristics. Without goind into the details, the solution was to build my own binaries of Handbrake since according to the developers, the fix was already committed to the SVN repository. Building Handbrake required that I install Xcode and since I don't think the osx86 installer i used had xcode, I registered with apple dev net and downloaded it. I then read up on how to build Handbrake which simply involves doing an SVN checkout of the source and running a make. In an ideal world, this was all that was needed but alas, the compilation keeps failing. Copying the obscure error and using google, I found a post stating that I needed to install yasm. Xcode does not have yasm so I went in search of it and to get it, I needed to install MacPorts. After installing MacPorts, I used it to install yasm and tried to build Handbrake again which finally got me a working binary. I tried using it on the same video source as before and it was able to produce an MP4 file with usable audio i.e. no more skips. For those not up to the adventure of building handbrake, you can download a copy of my binary here. The only guarantee I can make about this binary is that it worked for me. If the binary works for you, please comment and if it doesn't please do too.

1 comment:

  1. None of your actions work in this binary. It won't even let me add anything to the queue, much less start to encode anything. Back to the drawing board, dude.