Contents

Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats. The general procedure is ./configure <flags>; make && sudo make install, but some use a different configuration scheme, or none at all. You can also install the latest stable version of ffmpeg without the need to compile it yourself, which saves you a bit of time. Just follow this guide.

ffmpeg through Homebrew

​Homebrew is a command-line package manager, which is quite similar to apt-get on popular Linux distributions. In order to use it, you need to install brew first:

Follow the on-screen instructions. This will take a few minutes while it's installing the necessary developer tools for OS X. Then, run:

brew install ffmpeg

to get the latest stable version with minimal configuration options. These versions are packaged as Homebrew formulas and will take care of all the dependencies and the installation itself. You can run brew info ffmpeg to see additional configuration options, e.g. in order to enable libfdk_aac or libvpx, which is highly recommended. If you want all the extras there are, run:

If you don't know how to configure and compile a binary, you will find using Homebrew quite easy. To later upgrade your ffmpeg version, simply run:

brew update && brew upgrade ffmpeg

If instead you want to manually compile the latest Git version of FFmpeg, just continue with this guide.

Compiling FFmpeg yourself

Xcode

Starting with Lion 10.7, Xcode is available for free from the Mac App Store and is required to compile anything on your Mac. Make sure you install the Command Line Tools from Preferences > Downloads > Components. Older versions are still available with an AppleID and free Developer account at ​developer.apple.com.

Homebrew

To get ffmpeg for OS X, you first have to install ​Homebrew. If you don't want to use Homebrew, see the section below.

Mac OS X Lion comes with Freetype already installed (older versions may need 'X11' selected during installation), but in an atypical location: /usr/X11. Running freetype-config in Terminal can give the locations of the individual folders, like headers, and libraries, so be prepared to add lines like CFLAGS=`freetype-config --cflags` LDFLAGS=`freetype-config --libs` PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig before ./configure or add them to your $HOME/.profile file.

Manual install of the dependencies without Homebrew

Pkg-config & GLib

Pkg-config is necessary for detecting some of the libraries you can compile into FFmpeg, and it requires GLib which is not included in Mac OS X (but almost every other *nix distribution). You may either download pkg-config 0.23, or download the large tarball from ​Gnome.org and compile it. Pkg-config is available from ​Freedesktop.org.

To compile GLib, you must also download gettext from ​GNU.org and edit the file stpncpy.c to add "#undef stpncpy" just before "#ifndef weak_alias". Lion has its own (incompatible) version of the stpncpy function, which overlaps in gettext. Compile gettext as usual. Compile GLib with LIBFFI_CFLAGS=-I/usr/include/ffi LIBFFI_LIBS=-lffi ./configure;make && sudo make install

Schroedinger, which adds Dirac codec support, is available from ​diracvideo.org. To compile schroedinger, you need ORC, available from ​entropywave.com. Compile orc with the standard procedure, making sure you delete the "testsuite" folder, which won't compile. When compiling schroedinger, make sure pkg-config and yasm are already installed.

x264 is available at ​http://www.videolan.org/developers/x264.html. FFmpeg depends on x264 when compiled with --enable-libx264 and x264 depends on FFmpeg when compiled with --enable-lavf-input. The best way to handle it is to install x264 first without --enable-lavf-input, then compile FFmpeg with --enable-libx264 and finally compile x264 again with --enable-lavf-input.

Compiling

Once you have compiled all of the codecs/libraries you want, you can now download the FFmpeg source either with Git or the from release tarball links on the website. Study the output of ./configure --help and make sure you've enabled all the features you want, remembering that --enable-nonfree and --enable-gpl will be necessary for some of the dependencies above. A sample command is: