I’ve spent hours today on this.

Firstly, building libhandbrake from source on OS X. Here’s the steps that finally worked:

# get the source
git clone git@github.com:HandBrake/HandBrake.git
cd HomeBrew

# install some dependencies with Homebrew. There may be others, but these are the ones I didn't already have
brew install libtool cmake automake yasm

# configure, without xcode and using libtool installed above (renamed to glibtool to avoid a clash)
./configure --disable-xcode --libtool=/usr/local/bin/glibtool

cd build

# run make. This will fail...

# edit contrib/fontconfig/fontconfig-2.8.0/install-sh, which tries to install itself, and add `exit;` somewhere near the top to prevent it from running
vi contrib/fontconfig/fontconfig-2.8.0/install-sh

# make again, which will hopefully succeed!

Then, linking it and all its dependencies from my Qt project.:

# from the root of my Qt project, bring in the libs
mkdir external
cp -R ../HandBrake/build/{libhb,contrib} external/

Then add the following to your .pro file:

macx {
    # Add libhandbrake
    LIBS += -L$$PWD/external/libhb/ -lhandbrake
    PRE_TARGETDEPS += $$PWD/external/libhb/libhandbrake.a

        $$PWD/external/libhb \
        $$PWD/external/libhb \

    # Add everything from ./external/contrib/lib/
    LIBS += -L$$PWD/external/contrib/lib/
    SHARED_LIB_FILES = $$files($$PWD/external/contrib/lib/*.a)
        BASENAME = $$basename(FILE)
        FILENAME = $$replace(BASENAME,lib,)
        LIBS += -l$$replace(FILENAME,\.a,)

    # Add OSX frameworks and libraries
    LIBS += \
        -framework CoreAudio \
        -framework AudioUnit \
        -framework AudioToolbox \
        -framework IOKit \
        -framework CoreFoundation \
        -liconv \
        -lbz2 \

A lot of trial and error went in to populating the list of system frameworks and libraries it depends on…

If all goes well, you should now be able to use libhandbrake from your project:

#import "hb.h"

void hb_error_handler( const char *errmsg )
    qCritical("HB ERROR : %s", errmsg);

int main(int argc, char *argv[])

Phew! Now I’m hoping I can use libhandbrake to make it easier to import my DVDs into iTunes, so I can view them on my iPad and Apple TV. But its pushing midnight, so thats for another day…