A while back I had the need to hack Compressor’s preset files to output a quality worse than Apple wanted to provide. Today I saw a tweet looking for this sort of info. Given I now knew I wasn’t the only person on the planet seeking this information I figure I’d jot it down here.
First, some background… I do much of the technical configuration for my town’s Public Access cable TV studio. We have a strong open government initiative which includes videotaping, broadcasting, and web-archiving essentially all public government meetings. If you’re curious or bored, you can see the results here. With rare exception, these videos are quite static; talking heads with occasional camera switching. These programs are long, and we intend to archive them forever. As of this writing we have exactly 700 meeting videos in the archive for just over 1032 hours since we began the project four years ago. The average meeting is just shy of 90 minutes; some exceed three hours. We don’t need Hollywood quality, and we want to store as much as possible without encountering a massive storage (or bandwidth) bill.
After much testing I decided on a H.264 video at 200Kbps, with monaural audio at 32Kbps. That’s laughably poor for most uses, but perfect for us. One of the great tools Apple provides with Final Cut Studio is Compressor, a batch video (and audio) converter with network cluster capabilities. Apple includes some useful presets. Included is a preset for iPod/iPhone video at 1500Kbps:
Note the Bit Rate slider; a range from 1000 to 1500Kbps. While you can indeed enter a number to the right of the slider, it only accepts values within the slider’s range. I wanted one-fifth the rate of the lowest (worst) rate Apple thought anyone would ever want. If you’re wondering, 1500K is the maximum video rate usable on the original iPhone. So the upper-end makes a little sense, at least at date of publication. By the way, all this info is current as of Compressor 3.5.2, part of Final Cut Studio as of September 2010.
There are also many other presets, but most have some unique features. I figured this out nearly four years ago so I’ve forgotten why I didn’t use one of the MPEG-4 presets which does allow for a wider range. But there was something about them that didn’t meet our needs that I could only do here. ? I’ll focus on video bitrate from here forward; audio isn’t as critical to file size, and can be handled similarly.
So the goal is obvious; create a version of this preset that does what we want – lousy, blocky, but really low data rate video.
Compressor preset files are XML files located in ~/Library/Application Support/Compressor/. Presets are nicely organized there by settings group, and have filenames corresponding to the setting’s Name field. All handy stuff.
First, duplicate the Apple settings file that most closely matches what you need. Place it into a settings group if you’d like; helps keep them organized. Customize as best you can. Give it a nice name. Now quit compressor. Find your almost-perfect settings file in your text editor of choice, such as TextWrangler. In all its glory is some XML that looks a little like this (I have Soft Wrap Text on):
The file above is the same default settings file I show above (1500K iPod/iPhone). In the above screen capture, I have the <data-rate> item highlighted. This is the second <data-rate> item in the file; the first is within <audio-encode … >; we want the one in <video-encode … >. So a data rate of 187500 means 1500Kbps. Why? I don’t know, but it doesn’t matter. There’s a 12.5:1 ratio of what Compressor wants here to what us mere mortals know as Kbps. I wanted 200K, so I replaced the 187500 with 2500.
Save the preset, then save an extra copy somewhere safe; I’ve seen Compressor “fix” the value on occasion. I zip the file and store the zip in a project folder far outside the hands of Compressor.
Launch Compressor, and use the preset just like any other. Wait a short while, and sure enough, crummy video! Hooray!
I once asked an Apple engineer about this at WWDC. Basically, why don’t they let us more easily get crummy low-bitrate video? He looked at me like I had two heads.
As an aside – for reasons much more related to our internal workflow than Compressor, we ended up using MPEG Streamclip to create most of our QuickTime files. Long story for another day. Files are streamed with Darwin Streaming Server (the open source version of QuickTime Streaming Server). Devices not compatible with QTSS (such as the iPhone) are directly fed the same files over HTTP. I long for the day when I can use QuickTime X’s HTTP Live Streaming; it’s a truly clever mix of QTSS’s random access with HTTP’s standardization. Too few systems in the wild support it thus far.
In case you’re wondering, our online video archive is currently 110GB. Not bad for more than 1000 hours!