Wednesday 29 July 2009

EyeTV Export with HandBrake script

EyeTV by Elgato is an excellent piece of software that turns a Mac into a Personal Video Recorder. You can record programs using a tuner and play them back at any time. We have an iMac stuck to the wall in our living room that acts as our TV and media player. Even the babysitter can use the PVR interface and we get to use full apps like iPhoto and Spotify on our TV.

EyeTV records video using the format that it’s sent over the air. This is currently MPEG-2 for Freeview programs, which is decent quality but reasonably large files. I’d like to be able to archive my recordings using a better encoding such as H.264. However, EyeTV’s (and Apple’s) built-in options for exporting video are pretty poor. They generally take a long time to create poor quality video at an unimpressive compression ratio.

HandBrake is an open-source video transcoder. It can transcode between many video formats and has built-in presets for compressing different kinds of video. It’s great at taking EyeTV recordings and transcoding them into space-efficient, high quality H.264 MKV or MP4 files.

Fitting the two together is a bit of a pain. EyeTV has Applescript support but HandBrake doesn’t. Instead HandBrake has a command-line version that is available for separate download (see the downloads for Command Line Interface).

I wanted to be able to choose a suitable HandBrake export preset (some of my recordings are cartoons, some are movies) and a destination folder and export several recordings at once. Since transcoding video is a CPU hog, I also wanted to use the HandBrake encoding queue, but this isn’t available in the command-line version.

Various people have written scripts to take EyeTV recordings and encode them using HandBrake, but they weren’t quite what I wanted. Most of them were intended to import the results into iTunes so that files are available to AppleTV. I did’t need this — I just want smaller files. And none of them had an encoding queue — they all ran in the foreground.

So I wrestled with Applescript (it felt like banging my head against a brick wall several times), honed my shell script skills and built the EyeTV Export with HandBrake script. The script can be added to the EyeTV scripts menu, so that you can select multiple recordings in EyeTV and export them directly. The script will prompt you for a HandBrake encoding preset and an output directory and will pass of the encodes to a background shell script that runs one encode at a time. If you have Growl (also highly recommended), the script will announce completed encoding processes in a friendly manner (otherwise it will pop up a dialog).

I hope you find it useful. Please add comments below!


  1. Download the script (or get the source from GitHub)
  2. Put it in /Library/Application Support/EyeTV/Scripts and restart EyeTV (see EyeTV Applescript instructions for details)
  3. Download the HandBrake Command Line Interface (HandBrakeCLI) and move it somewhere appropriate. I use /usr/local/bin/, but the script will ask you to find it if it’s not there
  4. Select one or more recordings and choose “Export with HandBrake” from the Scripts menu (just between Window and Help)