How to compile ffmpeg/mplayer for MacOSX

This guide shows how to build ffmpeg, libav, mplayer/mencoder and mpv binaries on MacOSX.
See the bottom of this post for a revision history.

What you need before you start:

  • Xcode
  • Some patience
  • Some experience in using a command line interface

Miscellaneous:

  • yasm-1.3.0.tar.gz
  • zlib-1.2.8.tar.gz
  • bzip2-1.0.6.tar.gz
  • git-2.10.0
  • pkg-config-0.29.1.tar.gz
  • cmake-3.6.1.tar.gz
  • libressl-2.4.2.tar.gz

Encoder/decoder media libraries:

  • lame-3.99.5.tar.gz
  • faad2-2.7.tar.bz2
  • faac-1.28.tar.bz2
  • xvidcore-1.3.4.tar.gz
  • last_stable_x264.tar.bz2
  • libogg-1.3.2.tar.gz
  • libvorbis-1.3.5.tar.gz
  • libtheora-1.1.1.tar.bz2
  • gsm-1.0.13.tar.gz
  • amrwb-11.0.0.0.tar.bz2
  • amrnb-11.0.0.0.tar.bz2
  • speex-1.2rc2.tar.gz
  • flac-1.3.0.tar.gz
  • libxavs (via subversion)
  • vo-aacenc-0.1.3.tar.gz
  • vo-amrwbenc-0.1.3.tar.gz
  • libvpx-v1.1.0.tar.bz2
  • opus-1.1.3.tar.gz
  • twolame-0.3.13.tar.gz
  • openal-soft-1.13.tar.bz2
  • soxr-0.1.1-Source.tar.gz
  • fdk-aac-0.1.3.tar.gz
  • libutvideo (via git)
  • wavpack-4.70.0.tar.bz2
  • zeromq-4.1.5.tar.gz
  • georgmartius-vid.stab-release-0.98a-0-g94a4692.tar.gz
  • libilbc (via git)
  • libx265 (via hg)
  • snappy 1.1.3

Encoder/decoder media programs:

  • ffmpeg
  • libav
  • mplayer
  • mpv

Trying to compile versions obtained directly from the repositories may or may not break or require different configure flags. You can always try and using the stable release source code which should not require too many changes to the configure options. This guide was written with MacOSX 10.6.x and Xcode 3.x in mind, for compiling on newer MacOSX/Xcode versions see compilation notes at the bottom of this posting.

Create the Ramdisk

VOLNAME=Ramdisk
DISK_ID=$(hdid -nomount ram://26214400)
newfs_hfs -v ${VOLNAME} ${DISK_ID}
diskutil mount ${DISK_ID}

Create some shortcuts

export MES=/Users/snowy/tmptmp/mediaencoding/base/
export TARGET="/Volumes/${VOLNAME}/"
export CMPL="/Volumes/${VOLNAME}/compile"
export PATH=${TARGET}/bin:$PATH
mkdir ${CMPL}

 

Building libressl

cd ${CMPL}
tar xzpf ${MES}/libressl-2.4.2.tar.gz
cd libressl-2.4.2
./configure --prefix=${TARGET} --enable-static --disable-shared
make -j 2 && make install

Building yasm

cd ${CMPL}
tar xzpf ${MES}/yasm-1.3.0.tar.gz
cd yasm-1.3.0
./configure --prefix=${TARGET}
make -j 2 && make install

Building pkg-config

cd ${CMPL}
tar xzpf ${MES}/pkg-config-0.29..1.tar.gz
cd pkg-config-0.29.1
./configure --prefix=${TARGET} --with-pc-path=${TARGET}/lib/pkgconfig --with-internal-glib
make -j 2 && make install

Building git

cd ${CMPL}
curl -O https://www.kernel.org/pub/software/scm/git/git-2.10.4.tar.gz
tar xzpf git-2.10.0.tar.gz
cd git-2.10.0
./configure --prefix=${TARGET}/git
make && make install
PATH=${TARGET}/git/bin:$PATH

Building lame

cd ${CMPL}
tar xzpf ${MES}/lame-3.99.5.tar.gz
cd lame-3.99.5
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building faad

cd ${CMPL}
tar xjpf ${MES}/faad2-2.7.tar.bz2
cd faad2-2.7
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building faac

cd ${CMPL}
tar xjpf ${MES}/faac-1.28.tar.bz2
cd faac-1.28
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building xvidcore (and removing the dynamic library)

cd ${CMPL}
tar xzpf ${MES}/xvidcore-1.3.4.tar.gz
cd xvidcore
cd build/generic
./configure --prefix=${TARGET}
make -j 2 && make install
rm ${TARGET}/lib/libxvidcore.4.dylib

Building x264

cd ${CMPL}
curl -O ftp://ftp.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2
tar xjpf last_stable_x264.tar.bz2
cd x264*stable
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install && make install-lib-static

Building ogg

cd ${CMPL}
tar xzpf ${MES}/libogg-1.3.2.tar.gz
cd libogg-1.3.2
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building vorbis

cd ${CMPL}
tar xzpf ${MES}/libvorbis-1.3.5.tar.gz
cd libvorbis-1.3.5
./configure --prefix=${TARGET} --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=${TARGET}/include/ --enable-static --disable-shared
make -j 2 && make install

Building theora

cd ${CMPL}
tar xjpf ${MES}/libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure --prefix=${TARGET} --disable-asm --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=${TARGET}/include/ --with-vorbis-libraries=${TARGET}/lib --with-vorbis-includes=${TARGET}/include/ --enable-static --disable-shared
make -j 2 && make install

Building libopus

cd ${CMPL}
tar xjpf ${MES}/opus-1.1.3.tar.gz
cd opus-1.1.3
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building gsm

cd ${CMPL}
tar xzpf ${MES}/gsm-1.0.13.tar.gz
cd gsm-1.0-pl13
mkdir -p ${TARGET}/man/man3
mkdir -p ${TARGET}/man/man1
mkdir -p ${TARGET}/include/gsm
perl -p -i -e  "s#^INSTALL_ROOT.*#INSTALL_ROOT = $TARGET#g"  Makefile
perl -p -i -e  "s#_ROOT\)/inc#_ROOT\)/include#g"             Makefile
sed "/GSM_INSTALL_INC/s/include/include\/gsm/g"              Makefile > Makefile.new
mv Makefile.new Makefile
make -j 2 && make install

Building amrwb (downloads additional sources)

cd ${CMPL}
tar xjpf ${MES}/amrwb-11.0.0.0.tar.bz2
cd amrwb-11.0.0.0
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building amrnb (downloads additional sources)

cd ${CMPL}
tar xjpf ${MES}/amrnb-11.0.0.0.tar.bz2
cd amrnb-11.0.0.0
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building speex

cd ${CMPL}
tar xzpf ${MES}/speex-1.2rc2.tar.gz
cd speex-1.2rc2
./configure --prefix=${TARGET} --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=${TARGET}/include/ --enable-static --disable-shared
make -j 2 && make install

Building flac

cd ${CMPL}
tar xzpf ${MES}/flac-1.3.0.tar.gz
cd flac-1.3.0
./configure --prefix=${TARGET} --disable-asm-optimizations --disable-xmms-plugin --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=${TARGET}/include/ --enable-static --disable-shared
make -j 2 && make install

Building xavs

cd ${CMPL}
svn co https://svn.code.sf.net/p/xavs/code/ xavs
./configure --prefix=${TARGET} --disable-asm
make -j 2  && make install

Building libsnappy

cd ${CMPL}
tar xzpf ${MES}/snappy-1.1.3.tar.gz
cd snappy-1.1.3
 ./configure --prefix=${TARGET} --disable-shared --enable-static
make -j2 && make install

Building vo-amrwbenc

cd ${CMPL}
tar xzpf ${MES}/vo-amrwbenc-0.1.3.tar.gz
cd vo-amrwbenc-0.1.3
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2  && make install

Building libvpx

cd ${CMPL}
tar xjpf libvpx-v1.1.0.tar.bz2
cd libvpx-v1.1.0
./configure --prefix=${TARGET} --as=yasm --disable-shared --enable-static --enable-vp8
make -j 2 && make install

Building fdk-aac

cd ${CMPL}
tar xzpf ${MES}/fdk-aac-0.1.4.tar.gz
cd fdk-aac-0.1.4
./configure --prefix=${TARGET} --enable-static --disable-shared
make -j 2 && make install

Building twolame

cd ${CMPL}
tar xzpf ${MES}/twolame-0.3.13.tar.gz
cd twolame-0.3.13
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

Building libutvideo

cd ${CMPL}
git clone https://github.com/qyot27/libutvideo
cd libutvideo
./configure --prefix=${TARGET}
make -j 2 && make install

Building wav pack

cd ${CMPL}
tar xjpf ${MES}/wavpack-4.70.0.tar.bz2
cd wavpack-4.60.1
./configure --prefix=${TARGET} --enable-static --disable-shared
make -j 2 && make install

Building zeromq

cd ${CMPL}
tar xzpf ${MES}/zeromq-4.1.5.tar.gz
cd zeromq-4.1.5
./configure --without-documentation --prefix=${TARGET} --enable-static --disable-shared
make -j 2 && make install

Building cmake

cd ${CMPL}
tar xzpf ${MES}/cmake-3.6.1.tar.gz
cd cmake-3.6.1
# Patch out Java for cmake
rm Modules/FindJava.cmake
sed "s/get_filename_component.JNIPATH/#get_filename_component(JNIPATH/g" Tests/CMakeLists.txt > Tests/CMakeLists.txt.new
mv Tests/CMakeLists.txt.new Tests/CMakeLists.txt
./configure --prefix=${TARGET}
make -j 2 && make install

Building OpenAL

cd ${CMPL}
tar xjpf ${MES}/openal-soft-1.13.tar.bz2
cd openal-soft-1.13
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DLIBTYPE=STATIC .
make -j 2 && make install

Building libsoxr

cd ${CMPL}
tar xzpf ${MES}/soxr-0.1.1-Source.tar.gz
cd soxr-0.1.1-Source
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DBUILD_SHARED_LIBS=OFF .
make -j 2 && make install

Building libvidstab

cd ${CMPL}
tar xzpf ${MES}/georgmartius-vid.stab-release-0.98a-0-g94a4692.tar.gz
cd georgmartius-vid.stab-release*
perl -p -i -e 's/vidstab SHARED/vidstab STATIC/' CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET}  .
make -j 2 && make install

Building libilbc

cd ${CMPL}
git clone https://github.com/dekkers/libilbc.git
cd libilbc
sed '/TARGETS/s/ ilbc / /' CMakeLists.txt >CMakeLists.txt.new
mv CMakeLists.txt.new CMakeLists.txt
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} .
make -j 2 && make install

Building libx265

cd ${CMPL}
hg clone https://bitbucket.org/multicoreware/x265
cd x265
cd source
cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DENABLE_SHARED=NO .
make -j 2 && make install

Building zlib

cd ${CMPL}
tar xzpf ${MES}/zlib-1.2.8.tar.gz
cd zlib-1.2.8
./configure --prefix=${TARGET} --static
make -j 2 && make install

Building bzip2

cd ${CMPL}
tar xzpf ${MES}/bzip2-1.0.6.tar.gz
cd bzip2-1.0.6
make
make install PREFIX=${TARGET}

Up to here, the compilation path for ffmpeg, libav and mplayer are the same.
Now you can build either ffmpeg, libav or mplayer.
Building ffmpeg

cd ${CMPL}
curl -O http://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjpf ffmpeg-snapshot.tar.bz2
cd ffmpeg 

./configure --prefix=${TARGET} --as=yasm --extra-version=snowy --disable-shared --enable-static --extra-cflags="-I${TARGET}/include" --extra-ldflags="-L${TARGET}/lib ---disable-ffplay --disable-ffserver --enable-gpl --enable-pthreads --enable-postproc --enable-gray --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-nonfree --enable-version3 --enable-libsnappy --enable-libvo-amrwbenc --enable-libvpx --enable-libgsm --enable-libopus --enable-libtwolame --enable-openal --enable-libsoxr  --enable-libfdk-aac --enable-libwavpack --enable-libutvideo --enable-libzmq --enable-libvidstab --enable-libilbc --enable-libx265
make -j 2 && make install

Building libav

cd ${CMPL}
git clone git://git.libav.org/libav.git
cd libav

./configure --prefix=${TARGET} --as=yasm --extra-version=snowy --disable-shared --enable-static --extra-cflags="-I${TARGET}/include" --extra-ldflags="-L${TARGET}/lib --enable-gpl --enable-pthreads --enable-gray --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libxavs --enable-nonfree --enable-version3 --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvpx  --enable-libgsm --enable-libwavpack
make -j 2 && make install

Building mplayer/mencoder

If you do not want mplayer/mencoder to make use of X11, simply rename /usr/X11/include prior to configure/make (and do not forget to revert the change after the build was successful). If Xcode 4.x is installed, mplayer/mencoder will not link successfully and thus the gcc-4.2/g++-4.2 from Xcode 3.x has to be used to compile and link mplayer/mencoder.

if [ -e /Developer-old ]
then
  export   CC=/Developer-old/usr/bin/gcc-4.2
  export CXX=/Developer-old/usr/bin/g++-4.2
fi
 

And the actual mplayer/mencoder compilation step

cd ${CMPL}
svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
cd mplayer
./configure --prefix=${TARGET} --extra-cflags="-I${TARGET}/include/" --extra-ldflags="-L${TARGET}/lib"
make -j 2 && make install

After a successful run, you should be able to just grab the ffmpeg or
mplayer/mencoder binaries from ${TARGET}/bin and use them :)
If you really need ffplay, simply compile libSDL somewhere in the workflow (preferably after yasm has been built and before bzip2) and remove –disable-ffplay / –disable-avplay from the configure options.

BUT: The resulting ffmpeg/avconv binaries will have a lot more depencies to system libraries, considering that mplayer can also play media files without a GUI and there is also VLC available I personally do not see much point in building ffplay, but in any case, this is how you would do it.

cd ${CMPL}
tar xzpf ${MES}/SDL-1.2.15.tar.gz
cd SDL-1.2.15
./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
make -j 2 && make install

If ffmpeg/libav fails to build resulting in the following error:

libswscale/x86/yuv2rgb_mmx.c: In function 'ff_yuv2rgb_init_mmx':
libswscale/x86/yuv2rgb_mmx.c:77: error: 'yuv420_rgb24_MMX2' undeclared (first use in this function)
libswscale/x86/yuv2rgb_mmx.c:77: error: (Each undeclared identifier is reported only once
libswscale/x86/yuv2rgb_mmx.c:77: error: for each function it appears in.)
libswscale/x86/yuv2rgb_mmx.c:78: error: 'yuv420_bgr24_MMX2' undeclared (first use in this function)

Execute the following lines to fix a spelling(?) mistake(?) in the source code prior to running configure and make:

perl -p -i -e  "s/24_MMX2/24_MMX/g"                     libswscale/x86/yuv2rgb_mmx.c
perl -p -i -e  "s/HAVE_MMX2/HAVE_MMX/g"                 libswscale/x86/yuv2rgb_mmx.c
perl -p -i -e  "s/AV_CPU_FLAG_MMX2/AV_CPU_FLAG_MMX/g"   libswscale/x86/yuv2rgb_mmx.c

Compilation notes for compiling on MacOSX 10.7.x using Xcode 4.2.x
ffmpeg/libav:

  • Compiler
    Set export CC=clang as the very first step so everything is being compiled by clang
  • Ramdisk
    Use ram://2097152 unless you want to create a really, really big RamDisk
  • zlib library
    Remove the lib/libz.so* files which are being created for some unknown reason..

mplayer/mencoder:

  • Compiler
    Set export CC=clang and CXX=clang++ as the very first step so everything is being compiled by clang

Compilation notes for compiling on MacOSX 10.7.x using Xcode 4.3.x

  • Compiler
    If “upgrading” from Xcode 4.2.1 to Xcode 4.3 things will break. Especially if /Developer was moved to trash as Xcode 4.3 suggests you should do.
    Prior to upgrading to XCode 4.3 uninstall XCode 4.2.1 using ‘sudo /Developer/Library/uninstall-devtools –mode=all’.
    After this has succeeded, install Xcode 4.3 from the App Store and then download the command line tools from within XCode (Prefernces->Downloads->Command Line Tools)

Compilation notes for compiling on MacOSX 10.8.x using Xcode 4.4.x

  • libvpx
    Sometimes compiling 1.0.0 worked, sometimes not. You can build libvpx from git when compiling on Mountain Lion with XCode 4.4:

    export CFLAGS=-I/usr/include
    export LDFLAGS=-L/usr/lib
    cd ${CMPL}
    git clone http://git.chromium.org/webm/libvpx.git
    cd libvpx
    ./configure --prefix=${TARGET} --as=yasm --disable-shared --enable-static --enable-vp8
    make -j 2 && make install
    unset CFLAGS
    unset LDFLAGS
    

Compilation notes for compiling on MacOSX 10.8.x using Xcode 5.0

  • ffmpeg
    When building ffmpeg and linking against libutvideo, ffmpeg will state it can not find utvideo This is due to the fact it uses -std=c99 as a g++ command line argument. The dirty fix for this is to modify the configure script (gnu sed!) and set the compilers accordingly prior to running the configure script:

    export CXX=/usr/bin/clang++
    export CC=/usr/bin/clang
    sed "s/_ldflags='-std=c99'/_ldflags='-std=c++11'/g" -i configure
    sed "s/-std=c99$/-std-c++11/g"                      -i configure
    

Compilation notes for compiling on MacOSX 10.9.x using Xcode 5.0.1

  • flac-1.3.0
    Will refuse to compile, see https://trac.macports.org/ticket/40709 for further details. The fix described does not help.
  • cmake-2.8.12
    This is to stop cmake looking for java using the following crude patch prior to executing ./configure (using gnu sed):

    rm Modules/FindJava.cmake
    sed "s/get_filename_component.JNIPATH/#get_filename_component(JNIPATH/g" -i Tests/CMakeLists.txt
    
  • SDL-1.2.15
    When building ffplay, SDL is required but that fails to build. Hence a very crude patch to get it to build (using gnu sed):

    sed "/CGDirectPaletteRef palette;/d" -i ./src/video/quartz/SDL_QuartzVideo.h
    

    Source: http://hg.libsdl.org/SDL/rev/e9466ead70e5
    Also, –disable-x11-video is needed for the configure line because Mavericks is missing an X11 include.

  • libvpx (from git)
    Add –disable-unit-tests to the configure line when the build fails due to third party sources included.
  • mplayer
    An include directive needs to be wadded to libvo/vo_corevideo.m (gnu sed) prior to running configure:

    sed "27i#include <OpenGL/gl.h>" -i libvo/vo_corevideo.m
    

    Source http://trac.macports.org/ticket/40914

Compilation notes for compiling on MacOSX 10.9.x using Xcode 5.1

  • The clang 5.1 compiler does not support -falign-loops=16 and -fforce-addr anymore (hard error)
  • Prior to running configure for x264, libtheora and xavs, the configure script needs to be modified
    perl -p -i -e "s/-falign-loops=16//g" configure
    perl -p -i -e "s/-fforce-addr//g"     configure
    
  • Linking to libx265 can fail (ffmpeg is unable to find libx265)
    Add -lstdc++ to $CFLAGS

Compilation notes concerning mpv

  • mpv can be built but requires ffmpeg (libraries) to be present so in order to build mpv, everything up to and including ffmpeg must be compiled.
  • The man pages for mpv will only be created when docutils is provided.
    cd ${CMPL}
    export PYTHONPATH="${TARGET}/lib/python2.7/site-packages/"
    curl -L -O -s  http://iweb.dl.sourceforge.net/project/docutils/docutils/0.11/docutils-0.11.tar.gz
    tar xzpf docutils*
    cd docutils*
    python setup.py install --prefix="${TARGET}"
    
  • Last but not least, the mpv compilation step, without libass. Recently, the build system for mpv was changed to ‘waf’
    cd ${CMPL}
    curl -L -O -s https://github.com/mpv-player/mpv/archive/master.zip
    unzip -q master.zip
    cd mpv-master
    ./bootstrap.py
    export PKG_CONFIG=pkg-config
    ./waf configure  --prefix=${TARGET} --disable-libass-osd --disable-libass
    ./waf build
    ./waf install
    

Compilation notes concerning “missing” libraries

  • libbluray
    Requires libxml2 and freetype2 to compile, but blows up when linking to ffmpeg. I do not have a strong motive to investigate/fix this since I do not need libbluray…
  • game-music-emu-0.6.0
    Needs a patch in gme/CMakeLists.txt create a static library but somehow not all symbols (for 64bit) end up in that static library…
  • libass-0.12.1
    After being unable to find a set of working dependencies for libass (versions of the libraries libass requires) I investigated in how HomeBrew does this. Building expat, freetype, fribidi and fontconfig worked like a charm, even libass actually does compile. This was the test build setup:

    #!/bin/bash
    
    # run make with 4 threads
    export MKMU="make -j 4"
    
    export VOLNAME=Ramdisk
    export TARGET="/Volumes/${VOLNAME}/"
    export CMPL="/Volumes/${VOLNAME}/compile"
    export MES="/Volumes/${VOLNAME}/src"
    export PATH=${TARGET}/bin:$PATH
    
    # first, build pkg-config which references
    cd ${CMPL}  || exit 1
    tar xzpf ${MES}/pkg-config*
    cd pkg-config*
    ./configure --prefix=${TARGET} --with-pc-path=${TARGET}/lib/pkgconfig --with-internal-glib && $MKMU && make install
    
    # next, yam
    cd ${CMPL}
    tar xzpf ${MES}/yasm-1.2.0.tar.gz
    cd yasm-1.2.0
    ./configure --prefix=${TARGET} && $MKMU && make install
    
    # next, libexpat
    cd ${CMPL}
    tar xzpf ${MES}/expat-2.1.0.tar.gz
    cd expat-2.1.0
    ./configure --prefix=${TARGET} --disable-debug --disable-shared --enable-static && $MKMU && make install
    
    # next, libpng
    cd ${CMPL}
    tar xzpf ${MES}/libpng-1.6.16.tar.gz
    cd libpng-1.6.16
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # next, freetype
    cd ${CMPL}
    tar xzpf ${MES}/freetype-2.5.5.tar.gz
    cd freetype-2.5.5
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # next fribidi
    cd ${CMPL}
    tar xjpf ${MES}/fribidi-0.19.6.tar.bz2
    cd fribidi-0.19.6
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # fontconfig
    cd ${CMPL}
    tar xzpf ${MES}/fontconfig-2.11.92.tar.gz
    cd fontconfig-2.11.92
    ./configure --prefix=${TARGET} --with-add-fonts=/Library/Fonts,~/Library/Fonts --disable-shared --enable-static && $MKMU && make install
    
    # libass
    cd ${CMPL}
    tar xzpf ${MES}/libass-0.12.1.tar.gz
    cd libass-0.12.1
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # lua
    cd ${CMPL}
    tar xzpf ${MES}/lua-5.2.3.tar.gz
    cd lua-5.2.3
    make macosx install INSTALL_TOP=${TARGET}
    
    # create a lua.pc so mpv can find it
    cat >${TARGET}/lib/pkgconfig/lua.pc <<EOF
    prefix=/Volumes/Ramdisk
    exec_prefix=\${prefix}
    libdir=\${prefix}/lib/
    includedir=\${prefix}/include
    Name: lua
    Description: lua
    Requires:
    Version: 5.2.3
    Libs: -L\${libdir} -llua
    Cflags: -I\${includedir}
    EOF
    
    # fix fontconfig, using gnu sed
    sed "/^Libs: / s/-lfontconfig/-lfontconfig -lpng -lexpat -L\/Volumes\/Ramdisk\/lib -lfreetype/g" -i /Volumes/Ramdisk/lib/pkgconfig/fontconfig.pc
    
    # ffmpeg
    # set compiler flags
    export LDFLAGS="-L${TARGET}/lib $CFLAGS"
    export  CFLAGS="-I${TARGET}/include $LDFLAGS"
    cd ${CMPL}
    curl -O http://www.ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
    tar xjpf ffmpeg-snapshot.tar.bz2
    cd ffmpeg
    ./configure  --prefix=${TARGET} --disable-fontconfig --enable-libass --enable-static --disable-shared && $MKMU && make install
    
    # extend the python modules path
    export PYTHONPATH="${TARGET}/lib/python2.7/site-packages/"
    
    # build docutils so mpv can build its man pages
    cd ${CMPL}
    lftpget http://iweb.dl.sourceforge.net/project/docutils/docutils/0.12/docutils-0.12.tar.gz
    tar xzpf docutils*
    cd docutils*
    python setup.py install --prefix="${TARGET}"
    
    # this is needed for waf or it will not find an executable compiler
    export CC=clang
    
    # and build mpv
    cd ${CMPL}
    curl -L -O -s https://github.com/mpv-player/mpv/archive/master.zip
    unzip -q master.zip
    cd mpv-master
    
    ./bootstrap.py
    export PKG_CONFIG=pkg-config
    ./waf configure  --prefix=${TARGET}
    ./waf build
    ./waf install
    

    ffmpeg and mpv should be found in /Volumes/Ramdisk/bin and should support libass.
    When /Volumes/Ramdisk goes away, fontconfig will not be able to find its configuration file and cache anymore. So before you unmount /Volumes/Ramdisk, do the following:

    export FONTCONFIG_FILE=$HOME/.myfontconfig-fonts.conf
    cp /Volumes/Ramdisk/etc/fonts/fonts.conf $FONTCONFIG_FILE
    cp -R /Volumes/Ramdisk/var/cache/fontconfig $HOME/.fontconfig
    cd $HOME
    # copy mpv and/or ffmpeg to a different location
    umount /Volumes/Ramdisk
    

    The fontconfig library used by mpv should now be able to find the font configuration file and the cache. You may want to add the FONTCONFIG_FILE environment variable to your shell environment to make this a permanent solution.

  • frei0r-plugins-1.4
    Requires autoheader from the GNU Autoconf package and somehow resists installing frei0r.h to the correct location when using ‘make install’. Actually, it does not install the header at all. Which is kind of sad because ffmpeg would really really like to find that header file.
  • libcaca-0.99.beta18
    The configure runs fine but when compiling it blows up with

    ...
    dither.c:XXX: warning: alias definitions not supported; ignored'
    ...
    

    It does not blow up when using the gcc-4.2 from XCode 3 but things go awfully wrong when trying to link libcaca to ffmpeg, although the demo from libcaca work…

  • schroedinger-1.0.11
    Requires ‘orc’ and compilation still breaks with

    Undefined symbols for architecture x86_64:
      "__schro_decode_prediction_only", referenced from:
          _schro_init in libschroedinger-1.0.a(libschroedinger_1.0_la-schro.o)
      "__schro_telemetry", referenced from:
          _schro_init in libschroedinger-1.0.a(libschroedinger_1.0_la-schro.o)
    ld: symbol(s) not found for architecture x86_64
    

 

Revision history:
[Updated 03/09/2016]: Updated git to 2.10,0, libressl to 2.4.2, cmake to 3.6.1, zeromq to 4.1.5, libogg 1.3.2, opus to 1.1.3 and fdk-aac to 0.1.4
[Updated 28/03/2016]: Updated git to 2.7.4, libressl to 2.3.3, mercurial to 3.7.2, opus to 1.1.2, zeromq to 3.2.5, pgk-config to 0.29.1 and cmake to 3.5.1
[Updated 31/01/2016]: Removed vo-aaenc, added snap 1.1.3
[Updated 04/10/2015]: Added libressl 2.3.0
[Updated 03/10/2015]: Updated git to 2.4.5, cmake to 3.3.1, xvidcore to 1.3.4, libvorbis to 1.3.5, speex to 1.2.rc2
[Updated 19/02/2015]: Updated git to 2.3.0, cmake to 3.1.3, notes on compiling mpv with libass
[Updated 13/12/2014]: Updated git to 2.2.0, cmake to 3.0.2
[Updated 02/09/2014]: Updated yasm from 1.2.0 to 1.3.0
[Updated 18/08/2014]: Updated zeromq to 3.2.4, amrnb/wb to 11.0, zlib to 1.2.8 and git to 2.0.0
[Updated 03/06/2014]: Added compilation hints for ffmpeg/mpv concerning libass
[Updated 20/05/2014]: Added compilation hints for Xcode 5.1, libx265 and ffmpeg
[Updated 19/04/2014]: Added git to 1.9.2
[Updated 27/03/2014]: Added libx265
[Updated 15/03/2014]: Added compilation hints for Xcode 5.1
[Updated 02/02/2014]: Added libilbc
[Updated 30/01/2014]: Added vid.stab 0.98a
[Updated 26/01/2014]: Updated vorbis to 1.1.4, fdk-aac to 1.1.3, git to 1.8.5 and cmake to 2.8.12.1
[Updated 22/12/2013]: Updated pkg-config to 0.28, opus to 1.1 and libogg to 1.3.1
[Updated 02/12/2013]: Updated compilation hints for mpv
[Updated 20/11/2013]: Updated vo-aacenc and vo-amrwbenc to 1.0.3, wavpack to 4.70.1
[Updated 25/10/2013]: Added compilation hint for mplayer and Mac OS X 10.9 Mavericks
[Updated 24/10/2013]: Added compilation hints when using Xcode 5.0.1 on MacOSX 10.9 Mavericks
[Updated 20/09/2013]: Added compilation hints for mpv and ffmpeg when using Xcode 5
[Updated 01/09/2013]: Added compile information concerning libcaca, libass and mpv
[Updated 22/08/2013]: Updated xavs source location
[Updated 21/07/2013]: Added libutvideo, zeromq and wavpack
[Updated 19/07/2013]: Added fdk-aac
[Updated 18/07/2013]: Updated opus to 1.0.3, added cmake, openal and libsoxr
[Updated 12/06/2013]: Updated flac to 1.3.0
[Updated 15/05/2013]: Added twolame-0.3.13.tar.gz, remarks about missing libraries
[Updated 10/02/2013]: Provided a compilation note concerning ffplay and SDL-1.2.15.tar.gz
[Updated 09/01/2013]: Updated opus to 1.0.2
[Updated 12/09/2012]: Added pkg-config and libopus
[Updated 10/09/2012]: Fixed the perl expression for gsm
[Updated 28/07/2012]: Added remark on how to compile libvpx from the git repository
[Updated 30/05/2012]: libvpx does not need “special” CFLAGS/LDFLAGS anymore
[Updated 30/05/2012]: Fixed the gsm.h header location, added –enable-libgsm
[Updated 30/05/2012]: Updated zlib to 1.2.6, libvpx to 1.1.0, vo-aacenc/vo-amrwbenc to 0.1.2
[Updated 21/04/2012]: Updated zlib to 1.2.6
[Updated 02/03/2012]: Updated lame to 3.99.5
[Updated 18/02/2012]: Added libvpx compilation hints when using Xcode 4.3
[Updated 10/02/2012]: Updated libvorbis to 1.3.3, using libvpx v1.0.0 instead of git repository
[Updated 29/01/2012]: Updated lame to 3.99.4
[Updated 20/12/2011]: Added libvpx
[Updated 19/12/2011]: Hints about compiling on 10.7.x (Lion)
[Updated 13/12/2011]: Updated yasm to 1.2.0, fixed a spelling mistake
[Updated 23/10/2011]: Updated lame to 3.99
[Updated 25/09/2011]: Updated libogg to 1.3.0
[Updated 16/09/2011]: libav does not support –disable-ffplay and –disable-ffserver anymore
[Updated 06/08/2011]: Added vo-aacenc and vo-amrwbenc
[Updated 28/07/2011]: Added libxavs, cleaned up the article a little
[Updated 23/06/2011]: x264 requires an extra make install command for the library and include files
[Updated 03/06/2011]: Provided compilation workaround for ffmpeg/libav
[Updated 01/06/2011]: Updated Xvid to 1.3.2
[Updated 29/03/2011]: Added libav compilation hint
[Updated 26/03/2011]: Updated Xvid to 1.3.1, new ffmpeg git location, Xcode 4 hint for mplayer
[Updated 24/02/2011]: Updated Xvid to 1.3.0, yasm to 1.1.0
[Updated 12/02/2011]: mplayer wants to download ffmpeg via git
[Updated 23/01/2011]: ffmpeg is now being obtained via git, updated libvorbis and libogg
[Updated 28/11/2010]: Fixed zlib static compilation, added a hint for X11 mencoder/mplayer
[Updated 21/09/2010]: Updated bzip2 version and ffmpeg-svn configure options
[Updated 20/06/2010]: Updated some libaries/components
[Updated 20/02/2010]: Recent tarballs of x264 do not require –enable-static –disable-shared configure options
[Updated 06/09/2009]: Using more recent library versions. Can compile on Snow Leopard

Advertisements