Installing FFmpeg with H264 support on Mac OS X (Mountain Lion)

If you are installing Adobe CQ5, you’ll love the fact that FFmpeg integration is supported out of the box. The bad news is that due to licensing restrictions Adobe does not bundle FFmpeg with the standard CQ installation. Another issue is that the “standard” FFmpeg build does not include support for H264 which is useful for video playback on iOS devices etc.

Given that I had to repeat the installation process recently after reinstalling my MacBook AIR with Mountain Lion, I took some notes compiled from a few different sites into one quick cheat sheet. Note that this will take at least an hour to complete due to the need to download and compile a bunch of stuff.

Hear is the quick summary of what needs to be done;

  1. Install XCode
  2. Install Command Line tools for Xcode
  3. Install MacPorts
  4. Install FFmpeg

Now here is the longer explanation;

First install XCode

Xcode is required to be installed as its needed in step 4 to actually download and compile FFMPEG. I’ve tested with XCode 4.3 on Lion, and XCode 4.4 on Mountain Lion without issues.

Install Command Line tools for XCode

The Command Line Tools make the XCode “stuff” available to MacPorts, which we will install in the next step. You can download Command Line tools for XCode for free, you just need an Apple ID.

Install MacPorts

You can grab the latest from MacPorts.org. I’m using the Mountain Lion version

MacPorts is actually pretty useful and gives you access to a whole bunch of open source software. It’s worth while typing the following command to keep MacPorts up to date;

sudo port -v selfupdate

If you are curious and want to explore more about MacPorts and arent that comfortable in a terminal window, I recommend installing Pallet, but its optional and not required for FFmpeg

sudo port install Pallet

Install FFmpeg

Finally we actually get to install FFmpeg! Open up a Terminal window and type the following (all on one line)

sudo port install ffmpeg +gpl +postproc +lame +theora +libogg +vorbis
 +xvid +x264 +a52 +faac +faad +dts +nonfree

This will take some time, as your Mac will chug away downloading the various packages, compiling them and installing them. On my Mac & Connection it took about 45 minutes to complete the above command. You will notice the various options, including +264 etc which include the various options needed. I’d recommend the above configuration for use with CQ5.

 

Thats it.. congratulations, you should now have FFmpeg installed!