Installing HandBrake CLI from Source on CentOS 6

Here at Xelacomp, my job requires me to transcode video from time to time. I like using HandBrake due to it's simplicity for Apple devices, and it's open source nature. I've also been testing CentOS 6 in the lab for the past month or so, so I thought I'd show you how to install the HandBrakeCLI binary to your CentOS 6.0 machine, via the command line.

This tutorial includes compiling the application from source, and grabbing all of the needed dependencies. If you plan compiling HandBrakeCLI for a production machine (say, a web server that transcodes video on-the-fly for HTML5, via a PHP script), you'll want to take a slightly different approach. You'll want to remove all of the tools and libraries used to compile for security reasons.

This tutorial probably also works on RedHat 6 and 6.1, as well as Scientific Linux 6 and 6.1, but neither has been tested...so don't quote me on that.

Anyway, here we go...

First things first, we just want the binary, since HandBrakeCLI doesn't really utilize any other processes or libraries while in use, we'll just copy our compiled binary to a place we can execute from any path (ie /usr/local/bin)

Let's grab our dependencies first. Not everything is need here, but it’s a simple task to grab all of the Development Tools and Development Libraries, so here it is.


yum groupinstall 'Development Tools' 'Development Libraries'

Now we need some application (HandBrakeCLI) specific dependencies.


yum install zlib-devel bzip2-devel dbus-glib-devel libgudev1-devel webkitgtk-devel libnotify-devel gstreamer-devel gstreamer-plugins-base-devel

Now we can CD into our local source directory


cd /usr/local/src

We need one more dependency that HandBrake requires, that’s not in the Base repositories, that dependency is YASM. Let’s grab the source, compile, and install.


wget http://www.tortall.net/projects/yasm/releases/yasm-1.1.0.tar.gz

Untar it...


tar xvzf yasm-1*.tar.gz

hop into the YASM directory

cd yasm-1*

Make sure YASM will compile correctly.

./configure

Compile it

make

Install it

make install

Done with YASM, now on to the good stuff, HandBrake.

Head back to our local source directly.

cd /usr/local/src

From here, we can grab the HandBrake trunk via the Subversion repo.

svn checkout svn://svn.handbrake.fr/HandBrake/trunk hb-trunk

Hop into our newly created folder called hb-trunk

cd hb-trunk

Here’s where we can just run configure, with a couple switches. We don’t want the GTK interface, nor do we need it since this is simply a remote CLI HandBrake machine. With this command, handbrake will actually build a working CLI binary for us in the hb-trunk build directory. Just run:

./configure --launch --disable-gtk

This may take a few minutes, just let it run.

Now we’ve got a binary that works, just copy it into one of your executable binary paths, preferably /usr/local/src, so you know that YOU compiled it, and that it’s not apart of something installed by a package manager.


cd build


cp HandBrakeCLI /usr/local/bin

BAM! You're done. Now, from any path in your system, you should be able to access the HandBrakeCLI binary by just typing HandBrakeCLI along with your input, output, and switches. Have fun HandBraking!