Endikos

Archive for June, 2009

Cyphon: Purpose-Driven Video Transcoding

Monday, June 22nd, 2009

In my last article on video transcoding I made mention of a little utility I’d assembled called “Cyphon”.  After I discovered the awesomeness of Handbrake’s command line interface, I decided I wanted to build something that would allow all the video guys at my employer to encode videos for various target platforms simply.   Leave the gazillion-encode-variables-degree-in-transcoding-required stuff to me.  Not everyone should have to worry about that.  Of course Handbrake does an excellent job at taking most of that away anyway, but I still found myself tweaking options to get the best output I could.  I also wanted to encode something Windows users could watch with a default install of windows.  This meant I’d also have to bring in either ffmpeg or mencoder, and mencoder seemed to do the best job at encoding WMV files.

So now to wrap everything into something all my video guys can use, including myself.  I have several options, and they boil down to variations on two major themes:  1) Build some sort of intranet web service where the end user uploads something and gets transcoded video to download a short while later; 2) Build a distributable application that each person can use natively.

For various reasons, I chose to build a little distributable application.  Now while I am a programmer, I’m not really a systems programmer.  I prefer web development and scripting languages, although I do know Java and enough C to build working apps if I have to.  And as lovely as Cocoa and Objective C are, I haven’t learned them (yet – I’m in the process of learning them). Fortunately, I dont necessarily need to know Cocoa or Objective C to write a simple and effective app for OSX (Sorry Windows and Linux Guys, all the video folks here run Macs ;-).  Enter the dynamic duo of Platypus and CocoaDialog.

Platypus lets me  use ruby to write the logic of my app, and CocoaDialog lets me present windows with user-selectable options or notifications to the user.  So now I can knit together a ruby script, handbrake, and mencoder together using platypus and cocoadialog to make video transcoding an effortless task for my video guys.  Platypus even lets me make the icon droppable, so I could make my script do video transcoding in batches or one-at-a-time.

My employer has been kind enough to let me release Cyphon to the world licensed under the GPL, v2.  I’m releasing the bundled app as well as all the original source files I used, including the platypus profile, so you can see what options I used, and how I stiched everything together (the Platypus profile wont work for you right out of the box, as it will have my home directory’s path hardcoded, you’ll need to tweak that to reflect your source paths before it will work). If you just want to make tweaks to the running app, right-click or alt-click the app, choose “Show Package Contents”, go to Contents, then Resources, and look at the “script” file.  You’re probably most interested in “@@encoding_options” beginning at line 22.  There are a few of things you’ll want to keep in mind: 1) I know this will work on OSX 1.5 on an Intel platform, other platforms are questionable.  2)  If you throw a source video at it that doesnt have an audio track, it will barf.   This will be a future fix.  3)  It’s made to be able to accept quicktime MOV files.  I don’t know if anything else will work, because I havent tested it.  4) Keep in mind we have a very specific set of needs, and it meets those needs well. It may not meet your needs without significant work ;-)

All that said, here are the downloads you’ve been itching for:

  1. Cyphon v1.4 for OSX 10.5, Intel Platforms
  2. Sources for Cyphon 1.4