Version 4 (modified by SJ_UnderWater, 7 years ago) (diff)

remaining sources

Compiling on Mac OS X is as easy as any other *nix machine, there are just a few caveats. For all of the packages described here, the general procedure is "./configure --help;./configure <flags>; make && sudo make install", but some use a different configuration scheme, or none at all.

Some of the following dependencies can also be installed with homebrew or macports.

Attention Lion 10.7 Users: Due to defects in the llvm-gcc compiler, static macros defined in FFmpeg will fail to be recognized, resulting in a fatal error. Use cc/clang instead of gcc when compiling on Lion.



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


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` before ./configure when configuring packages that require freetype like gd and png

Pkg-config & GLibC

Pkg-config is necessary for detecting some of the libraries you can compile into FFmpeg, and it requires GLibC which is not included in Mac OS X (but almost every other *nix distribution). You must download the large tarball from and compile it. Pkg-config is available from After installing pkg-config, you might need to modify your ~/.profile to reflect all pkgconfig locations in your PKG_CONFIG_PATH environment variable - f.ex:

export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig:/usr/lib/pkgconfig


Yasm is available from and is necessary for compiling C code that contains machine-independent Assembler code. To compile, run ./configure --enable-python;make && sudo make install

Additional libraries


CDIO is available from

Faac & Faad

Both Faac and Faad are available from links at


GD is currently hosted at, which requires you to choose a "tag", then "get source". PNG is currently at, and TIFF is hosted by

Lame (MP3)

Lame is available from, and adds MP3 abilities to FFmpeg. Compilation is as easy as ./configure;make && sudo make install, but you can also add --enable-mp3x, and --enable-mp3rtp.


In order to compile with --enable-libass you need Freetype installed.

Opencore-amrnb / Opencore-amrwb


OpenJPEG is available at


Schroedinger, which adds Dirac codec support, is available from To compile schroedinger, you need ORC, available from 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 compiled.


Speex is available at

Theora, Ogg, Vorbis, & SDL

All of these libraries are available at


VPX is available at, make sure you compile with --enable-vp8.


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.


XVid is available from, under Developer Downloads


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:

./configure --enable-nonfree --enable-libcdio --enable-libschroedinger --enable-libfaac --enable-libfreetype --enable-libmp3lame --enable-libopenjpeg --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-openssl --enable-zlib --enable-gpl

make install

Install qt-faststart (optional)

This is a useful tool if you're showing your H.264 MP4 videos on the web. It relocates some data in the video to allow playback to begin before the file is completely downloaded. Usage: qt-faststart input.mp4 output.mp4. Code:

make tools/qt-faststart