Compiling ffmpeg

From CollectiveAccess Documentation
Jump to: navigation, search

[Valid for v1.3]

CollectiveAccess uses ffmpeg to process and convert most audio and video formats. If you want to handle audio and video you need to have a working ffmpeg installation. Unfortunately, the ffmpeg packages available in various Linux distributions are usually horribly out of date and just about useless. In almost every case, if you want a working ffmpeg install you will need to build it from source. (Of course, if you're on a shared host like Dreamhost, ffmpeg may already be installed).

ffmpeg follows a mostly typical build process:

  1. Get the source code. The ffmpeg project rarely does formal releases. It is best to get the latest code via Git - it's up to date and just about always works great. Run this command to download the source: git clone git:// ffmpeg; if you don't have access to a Git client, you can still use the old Subversion (SVN) repository, but the code is increasingly out-of-date as updates are no longer committed to SVN. The SVN command is svn checkout svn:// ffmpeg [Definitely use git if at all possible]
  2. Run ./configure with some options.
  3. Run make and make install.

The key detail are the ./configure options. Without the right options (and supporting libraries), you'll build an ffmpeg that cannot handle formats you almost certainly need, including MP3 audio, video with AAC audio (which many QuickTime/MPEG-4 tools now produce) and h.264 encoded video.

Supporting libraries you'll need

Before building ffmpeg, it is best to obtain, compile and install the following libraries:

  1. libfaac
  2. libfaad
  3. libx264 (This page has useful information on how to build ffmpeg with libx264)
  4. liblame (Be sure to get the latest 3.98 version [3.98.4 as of August 2011]; some earlier versions of 3.98 had compatibility issues with ffmpeg)

Configure options

When you run ./configure on ffmpeg your options should include:

--enable-libfaac --enable-libfaad --enable-libx264 --enable-libmp3lame --enable-pthreads (allows for multithreaded operation which can speed h264 encoding)

You will also probably need to include these licensing options:

--enable-gpl --enable-nonfree (libfaac and libfaad have non-free licenses)

Putting it altogether (and assuming you're running configure from within your ffmpeg source directory:

 ./configure --enable-libfaac --enable-libfaad  --enable-libx264 --enable-libmp3lame --enable-pthreads --enable-gpl  --enable-nonfree

Ffmpeg on Windows

If you're running CA on Windows, odds are you don't want to be building software from source. Fortunately, there are prebuilt binaries for ffmpeg available that track current development pretty closely. You can download these binaries from Once you have the ffmpeg.exe file in place, change your external_applications.conf file to point to ffmpeg. The path should include the drive letter, if applicable, as well as the .exe extension (eg. C:/ffmpeg_directory/ffmpeg.exe). Note that you can and should use forward slashes ("/") rather than backslashes ("/") when writing Windows paths in a CA configuration file.

The Configuration Check status for the Video media plugin should now read 'available' (you can get to this screen by selecting "System Configuration" from the "Manage" menu and then clicking on "Configuration Check" in the side-navigation).

But then there's another problem. The available ffmpeg binaries don't support h.264 video, but the default CA media processing configuration targets h.264 for transcoding of video. The result is that if you upload a video using the binary ffmpeg and the standard configuration on Windows you'll get a "can't create MPEG-4" error. There are two solutions:

  1. Build ffmpeg yourself with h.264 support. This can be a project in and of itself.
  2. Remove the h.264 targets from media_processing.conf and replace them with FLV (Flash Video) targets that are supported by the ffmpeg Windows binaries.

If you choose option 1, good luck. If you choose option 2, you can use this File:Media processing.conf in place of the standard one on your system.



Personal tools