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.2.0.tar.gz
  • zlib-1.2.7.tar.gz
  • bzip2-1.0.6.tar.gz
  • git-1.8.5
  • pkg-config-0.28.tar.gz
  • cmake-2.8.12.1.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.2.tar.gz
  • last_stable_x264.tar.bz2
  • libogg-1.3.1.tar.gz
  • libvorbis-1.3.4.tar.gz
  • libtheora-1.1.1.tar.bz2
  • gsm-1.0.13.tar.gz
  • amrwb-7.0.0.3.tar.bz2
  • amrnb-7.0.0.2.tar.bz2
  • speex-1.2rc1.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.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-3.2.3.tar.gz
  • georgmartius-vid.stab-release-0.98a-0-g94a4692.tar.gz
  • libilbc (via git)
  • libx265 (via hg)

 
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 yasm

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

 
Building pkg-config

cd ${CMPL} 
tar xzpf ${MES}/pkg-config-0.28.tar.gz
cd pkg-config-0.28
./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-1.8.5.tar.gz 
tar xzpf git-1.8.5.tar.gz
cd git-1.8.5
./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.2.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.1.tar.gz
cd libogg-1.3.1
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

 
Building vorbis

cd ${CMPL}
tar xzpf ${MES}/libvorbis-1.3.4.tar.gz
cd libvorbis-1.3.4
./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.tar.gz
cd opus-1.1
./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-7.0.0.3.tar.bz2
cd amrwb-7.0.0.3
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2 && make install

 
Building amrnb (downloads additional sources)

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

 
Building speex

cd ${CMPL}
tar xzpf ${MES}/speex-1.2rc1.tar.gz
cd speex-1.2rc1
./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 vo-aaenc

cd ${CMPL} 
tar xzpf ${MES}/vo-aacenc-0.1.3.tar.gz
cd vo-aacenc-0.1.3
./configure --prefix=${TARGET} --disable-shared --enable-static
make -j 2  && 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.3.tar.gz
cd fdk-aac-0.1.3
./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-3.2.3.tar.gz
cd zeromq-3.2.3
./configure --without-documentation --prefix=${TARGET} --enable-static --disable-shared 
make -j 2 && make install

 
Building cmake

cd ${CMPL}
tar xzpf ${MES}/cmake-2.8.12.1.tar.gz
cd cmake-2.8.12.1
./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.7.tar.gz
cd zlib-1.2.7
./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 

export LDFLAGS="-L${TARGET}/lib $CFLAGS"
export  CFLAGS="-I${TARGET}/include $LDFLAGS"

./configure --prefix=${TARGET} --as=yasm --extra-version=snowy --disable-shared --enable-static --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-libvo-aacenc --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

export LDFLAGS="-L${TARGET}/lib $CFLAGS"
export  CFLAGS="-I${TARGET}/include $LDFLAGS"

./configure --prefix=${TARGET} --as=yasm --extra-version=snowy --disable-shared --enable-static --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
    

 
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

  • 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.10.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=playground
    export TARGET="/tmp/${VOLNAME}/"
    export CMPL="/tmp/${VOLNAME}/compile"
    export MES="$HOME/Downloads/src"
    export PATH=${TARGET}/bin:$PATH
    
    # set up the compilation directory
     mkdir -p ${CMPL} || exit 1 
    
    # first, build pkg-config which references
    cd ${CMPL}  
    tar xzpf ${MES}/pkg-config*
    cd pkg-config*
    ./configure --prefix=${TARGET} --with-pc-path=${TARGET}/lib/pkgconfig --with-internal-glib && $MKMU && make install
    
    # next, yasm
    cd ${CMPL} 
    tar xzpf ${MES}/yasm-1.2.0.tar.gz
    cd yasm-1.2.0
    ./configure --prefix=${TARGET} && $MKMU && make install
    
    # libexpat
    cd ${CMPL} 
    tar xzpf ${MES}/expat-2.1.0.tar.gz
    cd expat-2.1.0 
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # next, freetype
    cd ${CMPL} 
    tar xzpf ${MES}/freetype-2.4.11.tar.gz
    cd freetype-2.4.11
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # next fribidi
    cd ${CMPL} 
    tar xzpf ${MES}/fribidi-0.19.2.tar.gz
    cd fribidi-0.19.2 
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    
    # fontconfig
    cd ${CMPL}
    tar xzpf ${MES}/fontconfig-2.10.95.tar.gz
    cd fontconfig*
    # patch source
    # patch -p1  < ${MES}/fontconfig.patch 
    # --with-expat=
    ./configure --prefix=${TARGET} --with-exppat=${TARGET} --with-add-fonts=/Library/Fonts,~/Library/Fonts --disable-shared --enable-static && $MKMU && make install
    
    # libass 
    cd ${CMPL}
    tar xzpf ${MES}/libass-0.10.1.tar.gz
    cd libass-0.10.1 
    ./configure --prefix=${TARGET} --disable-shared --enable-static && $MKMU && make install
    
    # 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
    

    When linking libass to ffmpeg, everything blows up like this:

    Undefined symbols for architecture x86_64:
      "_XML_ErrorString", referenced from:
          _FcConfigParseAndLoad in libfontconfig.a(fcxml.o)
      "_XML_GetBuffer", referenced from:
          _FcConfigParseAndLoad in libfontconfig.a(fcxml.o)
      "Undefined_XML_GetCurrentLineNumber",  referenced fromsymbols: 
    for   architecture   x86_64 : 
    _FcConfigMessage   in" _XML_ErrorStringlibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_GetErrorCode " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_GetBufferlibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_ParseBuffer " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_GetCurrentLineNumberlibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_ParserCreate " ,   referenced   from_FcConfigMessage: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_GetErrorCodelibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_ParserFree " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_ParseBufferlibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_SetCharacterDataHandler " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_ParserCreatelibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_SetDoctypeDeclHandler " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_ParserFreelibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_SetElementHandler " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_SetCharacterDataHandlerlibfontconfig.a"(,fcxml.o )referenced
      from :"
    _XML_SetUserData " ,   referenced   from_FcConfigParseAndLoad: 
    in   libfontconfig.a ( fcxml.o ) 
    _FcConfigParseAndLoad   in" _XML_SetDoctypeDeclHandlerlibfontconfig.a"(,fcxml.o )referenced
     ldfrom:: 
    symbol ( s )   not  _FcConfigParseAndLoadfound  infor  libfontconfig.aarchitecture( fcxml.ox86_64)
    
      "_XML_SetElementHandler", referenced from:
          _FcConfigParseAndLoad in libfontconfig.a(fcxml.o)
      "_XML_SetUserData", referenced from:
          _FcConfigParseAndLoad in libfontconfig.a(collect2: fcxml.o)
    ld: symbol(s) not found for ld returned 1 exit statusarchitecture 
    x86_64
    collect2: ld returned 1 exit status
    make: *** [ffmpeg_g] Error 1
    make: *** Waiting for unfinished jobs....
    make: *** [ffprobe_g] Error 1
    
  • 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 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

About these ads

200 thoughts on “How to compile ffmpeg/mplayer for MacOSX

  1. Everything great except the sed trick on libgsm which did not work for me. I had to manually edit Makefile

    I was even able to compile SVN version removing –disable-vhook and –enable-swscale

    THANKS!!!

    • Good point. I have used gnu sed 4.1.5 instead of the /usr/bin/sed supplied by Apple. I will add a note to the compilation process.

      • Hexeract I’ve got an issue as well with GSM following your instructions. I receive:

        perl -p -i -e “s#_ROOT)/inc#_ROOT)/include#g” Makefile
        Unmatched ) in regex; marked by <– HERE in m/_ROOT) <– HERE /inc/ at -e line 1.

        Thanks

  2. This is fantastic! I too had an issue with GSM but I didn’t need it anyway. This exactly what I needed to figure out how to compile a Mac binary. Thanks for the tutorial. I have spent hours digging to find the info you have provided in a simple format.

  3. I was trying to do the same but get some errors, then I found this article and works great (I have some troubles with lame lib, so not included)

    I only have one issue, X264 has some preset files that need to be placed somewhere, but I don’t know where with your method, the common place is “/usr/share/ffmpeg/”

    I was trying with the latest builds before but I get this error:
    dyld: Library not loaded: /usr/local/lib/libfaac.0.dylib

    with your guide I get this error:
    dyld: Library not loaded: /usr/local/lib/libmp3lame.0.dylib

    that’s why I dissable libmp3lame and get it to work well, but without pressets.

    I have all the files I use here:

    http://www.rodrigopolo.com/ffmpeg/osxcompile/

    Can you update your guide to work with the latests code, libmp3lame and x264 presets. thanks for the great job, help and for sharing!!!

    • The preset files simply go to $HOME/.ffmpeg/

      The guide, when followed exactly step by step, should result in static builds of ffmpeg or mplayer/encoder.

      You can, however, update the libraries you unpack and compile.
      I recompiled using xvidcore-1.2.2.tar.gz and x264-snapshot-20090528-2245.tar.bz2 without any troubles.

      Reading your file config_and_errors.txt the error is quite obvious:
      You are not using a sandbox to install to and use to link against.

      From what I suspect, both on MacOSX and Ubuntu, you simply did not use the –prefix=
      option of ./configure and hence everything was installed into /usr/local.

      For some odd reason you also built the shared libraries which, when you finally
      compiled ffmpeg, it happily linked against in /usr/local/include and /usr/local/lib.
      The resulting binary, when transferred to another box, will fail as shown.

      Setting up $TARGET and using it as an option for –prefix in the ./configure run
      is a very vital technique for this guide (and the success).

      Checking your ffmpeg binary shows:

      $ otool -L ffmpeg
      ffmpeg:
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
      /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.4)
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
      /usr/local/lib/libfaac.0.dylib (compatibility version 1.0.0, current version 1.0.0)
      /usr/local/lib/libfaad.2.dylib (compatibility version 3.0.0, current version 3.0.0)
      /usr/local/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0)
      /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

      The resulting ffmpeg binary, if you followed the guide step by step, looks like this:

      $ otool -L ffmpeg
      ffmpeg:
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
      /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.4)
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.4)
      /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

      Does this information help you?

      If all fails, I can provide you with a working ffmpeg (and mplayer/mencoder).
      And the Ramdisk volume after a successful run.

      • Thanks a lot, I finllay did it, I’m making the compilation on Mac OS X on a MacBook Pro, I post my issues compiling on the FFmpeg user list and they give me this wonderfull link:

        http://www.tkn.tu-berlin.de/research/evalvid/

        Check it out, it hast all what FFmpeg can have!!! I will make a “FFmpeg H.264 AAC Injected FLV” guide to use a plug-in for wordpress I’m making, so I will post it here so you can check it out.

  4. Thanks for the great guide. Everything worked fine except the mplayer/mencoder build. Grabbing teh latest snapshot and using your config – it appears they made some changes and this is no longer recognized:

    –with-extraincdir=${TARGET}/include/ –with-extralibdir=${TARGET}/lib

    instead I was able to use:

    –extra-libs=${TARGET}/lib

    but there seems to be no equivalent for the –extra-inc.

    Attempting to compile yields:

    In file included from liba52/imdct.c:725:
    liba52/imdct_3dnow.h: In function ‘fft_asmb_3dnow’:
    liba52/imdct_3dnow.h:257: error: can’t find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
    make: *** [liba52/imdct.o] Error 1

    oh well.. great job detailing rest of process.

    • Try the following when compiling from the subversion trunk:

      $ cd /Volumes/Ramdisk/compile/
      $ svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
      $ cd mplayer
      $ ./configure –prefix=/Volumes/Ramdisk/sw –extra-cflags=”-I/Volumes/Ramdisk/sw/include” –extra-ldflags=”-L/Volumes/Ramdisk/sw/lib/”

      MPlayer SVN-r29404-4.0.1
      MEncoder SVN-r29404-4.0.1

      • Thanks for the reply – unfortunately still failed. It looks like its tryingto find something to do with a52 – could it be that a52 libs need to be compiled first? I’m gonna try that – I’ll let you know…

        — cut —
        cc -Wundef -Wdisabled-optimization -Wno-pointer-sign -Wdeclaration-after-statement -std=gnu99 -I/Volumes/Ramdisk/sw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -Ilibdvdread4 -mdynamic-no-pic -falign-loops=16 -shared-libgcc -I. -I/Volumes/Ramdisk/sw/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include -c -o libass/ass.o libass/ass.c
        In file included from liba52/imdct.c:725:
        liba52/imdct_3dnow.h: In function ‘fft_asmb_3dnow’:
        liba52/imdct_3dnow.h:257: error: can’t find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
        make: *** [liba52/imdct.o] Error 1
        make: *** Waiting for unfinished jobs….

        • When researching your problem, I have read that using –disable-vdpau will avoid the error but the main problem may be with the gnu compiler version used.

          MPlayer really likes to choose its own compiler flags, I would not add any compiler specific options to the –extra-cflags, it will most likely break the compilation.

          Can you provide the shell script you used to compile and where it breaks?
          I just tried to reproduce your compilation error but could not do so.

          The only changes to the above guide are the usage of:

          – yasm-0.8.0.tar.gz
          – x264-snapshot-20090528-2245.tar.bz2
          – xvidcore-1.2.2.tar.gz

          But that should not have any effect on the compilation of a52…

          • Yes the research I read also indicated the vdpau and the compiler could be the problem. I disabled vdpau first but that had no effect, it was only after add the “-O3 -fomit-frame-pointer” was I able to complete the mplayer compilation. I am aslo using a bit newer components than in your guide:

            -yasm-0.8.0.tar.gz
            -x264-snapshot-20090625-2245.tar.bz2
            -xvidcore-1.2.1.tar.gz

            I tried xvidcore-1.2.2 but there were some errors in its compilation so I dropped back to the one listed in your guide and it worked fine.

            BTW – your guide and use of the ram disk and sandbox has revolutionized the way I compile now. I am just a tinkerer, but I have always wanted to build stuff in a “sandbox” type layout I just never knew how. Your guide worked so well, I actually used it on my Ubuntu box and build a fresh static copy of ffmpeg for it using your technique. Thank you VERY MUCH for this detailed guide – it has been a real eyeopener!

          • Thank you very much, I am glad the guide was helpful!

            xvidcore-1.2.2 should compile fine, as I used that when I tried to build mplayer from the SVN repository.

            This is the compiler I used: gcc version 4.0.1 (Apple Inc. build 5490)

            Using gcc 4.2 (gcc version 4.2.1 (Apple Inc. build 5566)) works too, but produces slightly larger binaries…

          • Hey you might be onto something there – just checked and I have gcc version 4.0.1 (Apple Inc. build 5465). I was unaware of a gcc update – I assumed those would be pulled in with the standard SystemUpdate utility – but apparently not – logging in now to ADC to see if I can find an update.

  5. If you get errors encoding with mp3 and lame like this:

    [libmp3lame @ 0x103a600]lame: output buffer too small (buffer index: 9405, free bytes: 387)
    Audio encoding failed

    Downgrade to the lame-3.98 (instead of lame-3.98.2) source code and recompile ffmpeg.

    Note the errors are erroneous, as the output does indeed include properly encoded audio – it just issues those warnings.

    • Weird, when I (re)compiled everything on Snow Leopard it failed at libtheora (which needed a –disable-asm configure flag)
      I used the gcc 4.2.1 shipping with Snow Leopard’s XCode 3.2

  6. There is an error in the “libvorbis” part…

    The option:
    –with-ogg-includes=/Volumes/Ramdisk/sw/include/

    Should be:
    –with-ogg-includes=${TARGET}/include/

    I got a great OS X Compilation ( http://rod.gs/Ml ) But now I’m trying to build one on Ubuntu, if I enable libvorbis I have all kind of issues, without it it works perfect, I’m very tired trying to do this, I’m willing to pay some one who want to build a static version like this but with ubuntu 9.04 (x32 and x64)

    • You are right, I have corrected this in the blog enttry.
      Thank you for pointing this out to me!

      For Ubuntu, you do not need to create a RamDisk, you can simply replace /Volumes/Ramdisk with a directory of your choice.

      I will update the posting to reflect my currently
      used setup on how to build ffmpeg/mplayer.

  7. I only got as far as the xvidcore which craps out with this error:

    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [libxvidcore.4.dylib] Error 1

    I’m just using whatever the current version of XCode is for Snow Leopard. All I really want is a mencoder and a mplayer binary. Can someone smarter than me hook me up?

    • If you have followed the guide, you should have deleted the libxvidcore.4.dylib after compiling and installing xvidcore.
      This will force the ffmpeg/mplayer/mencoder binary to be linked against the static version of xvidcore.

      Do no hesitate to contact me if you need further assistance.


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

        • Checking your xvidcore output log, I can only guess it may have to do with the fact you have an i7
          and neither yasm nor gcc 4.2.1 can produce good/proper assembly code.

          In that case, try to just use make without the “-j 4″ option.
          If that does not help, try adding the “–disable-assembly” switch and see if that resolves the issue.

          • Uggg,
            This did not work on my i7 either. I tried the above suggestions.

            You might want to put a note at the top that this won’t work yet for i7′s. I spent a couple hours trying this out of desperation.

            I have been using mplayer to make videos of computer simulations for work and I just got this new machine and now I can’t run my code.
            If anyone has any suggestions on how to run mencoder on an i7 please let me know. Thank You!

          • Have you tried compiling mplayer using the guide on your new machine? What went wrong and where?

            If that does not help, try adding –enable-runtime-cpudetection option to the ./configure command line.

  8. x264 compile fails
    i get:
    Unknown option –enable-static, ignored
    Unknown option –disable-shared, ignored
    No working C compiler found.

    using snow leopard with gcc 4.2.1

    all other components compile fine

    • Use 2 dashes/hyphens:

      –enable-static –disable-shared

      It is also very important you change your directory to xvidcore/build/generic where the configure script resides.
      The c compiler gcc resides in /usr/bin/ so that should not really be a problem…

      • Hey very cool, and super helpful…

        Though, the x264 doesn’t worth w/ double dashes.

        $ ./configure –prefix=${TARGET} –disable-shared –enable-static

        Unknown option –disable-shared, ignored
        Unknown option –enable-static, ignored

        • I have just checked and you are right.
          The configure in recent daily tarballs does not have the –enable-static or –disable-shared option anymore, default is to build a static version.

          An update entry has been made to the posting, thank you for pointing this out to me.

  9. Pingback: Man Vs Mkv: The Story So Far « Baud Attitude
  10. Thank you. Great work. I needed a static build of ffmpeg with libmp3lame statical linked in ffmpeg on linux. I picked the the parts I needed and it worked out for me. This is the best page on the subject online!!! I did a lot of research before.

    • Thank you very much!

      You can even build ffmpg from the subversion repository using yasm 1.0, lame 3.98.3 and updated xiph (vorbis/ogg) libraries,
      if you are really into “bleeding edge” software versions :)

  11. I want to thank you so much for this! I was pulling my hair out for hours trying to get a static build of FFmpeg and your guide was the only one that worked.

    Also, great tip on using a ramdrive for the compilation. Really sped things up!

    One thing I had to change though. I got an error about amrwb not being found even though I compiled it. It turns out they only support the opencore-amr project now and I got an error that that module was missing. I removed the amrwb and amrnb builds and compiled the latest git source of the opencore-amr project and it worked fine.

    Other than that it was all smooth sailing :)

    • I am glad the guide was helpful.
      When I recompile ffmpeg myself I sometimes have to tweak the ./configure line but mostly I just drop an option or check if an option has been renamed.

  12. Hello,

    Excellent guide you have I’ve been using it for some time. Got a question though maybe you can help…I have a .flv video that will not properly convert using a recent mencoder build I did according to your guide. However a mencoder build from last year that I did not compile myself converts the video perfectly and I can’t figure out why. I’m thinking it’s the way it was built but I don’t know how to find the differences? Anyways I can post more details here if you wish or if you would like to send me an email I could chat with you there. Thanks again for the great guide!

    rc

    • It is very difficult to say what may have gone wrong withouth either knowing the source video or the encoding options used.
      I doubt it is a problem the way it is built but it depends audio/video encoding options used (and thus on the libraries).
      Other than that you might want to check the projects homepage for each codec for newer versions and try a recompile with more recent libraries.

      As I am not really a video encoding expert I can not really help you with any “magic” audio/video encoding hints.
      Better to ask on the mplayer mailing list MEncoder-users as described on the mplayer homepage.

  13. Hey thanks for the reply! Yes I know you would need more info and actually I did post on the forums but they couldn’t tell me too. It might have just been some random bad video. Actually the issue was with the built-in demuxer (lavf) and seemed the problem it was reading the original video at close to 60fps when it was really close to 30fps. This seemed to throw off the whole encoding (at least that’s my guess) and I couldn’t figure out why an old mencoder build read it correctly and my newer one didn’t. Anyways I appreciate the reply and I’ll keep checking. Thanks again!

    rc

  14. Hello again,

    I have another question that I’m thinking you might know the answer. Using your guide I have encountered the following error on a different Mac:

    Dyld Error Message:
    Library not loaded: /usr/X11/lib/libfreetype.6.dylib
    Reason: image not found

    I know this is a static build that should just work and the only thing I have added in addition to the guide here when building mencoder is –disable-x11 to avoid these kind of x11 issues but still I’m encountering this one. Would you have any idea why? Thanks again for the help and the great guide!

    rc

    • Only ffmpeg is really a static build, the mencoder/mplayer is as static as it can be but still
      requires some dynamic libraries.

      As mencoder/mplayer does a lot of autodetecting you might simply make the X11 includes “invisible” by renaming /usr/X11/include to /usr/X11/include.1 (and do not forget to change the directory name back after a successful build.

      This should stop mencoder/mplayer to find any libraries related to X11 and thus will be omitted during the compilation.

      You can always check which dynamic libraries a binary by using ‘otool -L’.

      In my quick test build, it looked like this:

      snowy@wintermute(/Volumes/Ramdisk/mplayer) $ otool -L ./mplayer
      ./mplayer:
      /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
      /usr/lib/libncurses.5.4.dylib (compatibility version 5.4.0, current version 5.4.0)
      /System/Library/Frameworks/QuickTime.framework/Versions/A/QuickTime (compatibility version 1.0.0, current version 1756.0.0)
      /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
      /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
      /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.1)
      /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
      /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.6.3)
      /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/OpenAL.framework/Versions/A/OpenAL (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/CoreAudio.framework/Versions/A/CoreAudio (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
      /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.42.0)
      /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.35.0)
      /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
      /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.42.0)
      /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.6.2)

      • Great that’s a good trick! So the output using otool means those files must reside on your system for the mencoder build to work correct? Thanks very much for the quick reply I think this issue is solved…

        rc

        • Checking a binary with ‘otool -L’ will show you if there is a missing reference and if not, show all dynamically linked libraries for a binary.

  15. Pingback: Quora
    • You could either make use of a media server such as Nullriver MediaLink or the Playstation Media Server that do transcoding on the fly.

      Another approach would be to to break up the MKV container using mkvtoolnix and repackaging that into a media container that the Playstation 3 can handle using ffmpeg or mencoder, depending on what video and audio format you have in the mkv file.
      Once you have a little script this should be the fastest and easiest way :)

      Using Handbrake may be the easiest but not the fastest (due to the re-encoding).

  16. hi again,

    just curious using your guide is there a way to build a universal build of ffmpeg for mac or must i build on the different architectures and then lipo them together? it’s hard to find universal ready-made builds on the internet. thanks!

    rc

    • There is no guide on how to build an universal binary since I have not written one :)
      I would also try the approach of compiling ffmpeg/mplayer on different architectures and then using lipo to “glue” them together.
      As some libraries want to make use of yasm you would need to check if you can disable assembler optimisations.

      You could also try to compile for both architectures on one machine using the following compiler flags (ppc example on an intel box):

      export CC=/usr/bin/gcc-4.0
      export CFLAGS=”-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -mmacosx-version-min=10.4″
      export LDFLAGS=”-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -mmacosx-version-min=10.4″

      My best advice would be to first try and compile mplayer and ffmpeg as ppc binary and if that works, you can try each library if that will compile as ppc binary.

        • i followed your guide intel first for ffmpeg as always the best :-) just a few comments using otool -L it shows me this:

          /usr/lib/libSystem.B.dylib

          only one and i suppose that’s fine? other binaries i find often show 3 or 4 when using otool -L. and i noticed if you double-click the finished binary under configuration where all the libraries are this one is not included:

          libavcore

          that is often included in other binaries again not quite sure what that means? but the building was just fine although i did have to follow the post from #12 about using opencore-amr project. i’ll let you know how i make out with the universal one thanks!

          • It should be fine although you have to check the output of ffmpeg -formats
            to see if a codec you want/need is missing.

            My build looks the same:

            snowy@wintermute(~) $ otool -L /Users/snowy/.bin/ffmpeg
            /Users/snowy/bin/ffmpeg:
            /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

  17. Hello,
    bare with me this is my first big compiling project.
    can’t get pass xvidcore, I’m getting (last 3 lines):

    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [libxvidcore.4.dylib] Error 1

    I also tried $ make && make install same result.

    • I can only guess what may have gone wrong.

    • What version of Xcode are you using?
    • What was the complete configure command line?
    • Is the error from trying to compile xvidcore?
    •  

      Example compilation of xvidcore:

       

      snowy@wintermute(/Volumes/Ramdisk) $ tar xzpf xvidcore-1.3.1.tar.gz
      snowy@wintermute(/Volumes/Ramdisk) $ cd xvidcore
      snowy@wintermute(/Volumes/Ramdisk/xvidcore) $ cd build/generic
      snowy@wintermute(/Volumes/Ramdisk/xvidcore/build/generic) $ ./configure –prefix=/Volumes/Ramdisk
      [...some configure output...]
      snowy@wintermute(/Volumes/Ramdisk/xvidcore/build/generic) $ make
      [..some make outout...]
      /usr/bin/ranlib: file: libxvidcore.a(timer.o) has no symbols
      ranlib: file: libxvidcore.a(timer.o) has no symbols
      L: libxvidcore.4.dylib

      —————————————————————
      Xvid has been successfully built.

      * Binaries are currently located in the ‘=build’ directory
      * To install them on your system, you can run ‘# make install’
      as root.
      —————————————————————

      snowy@wintermute(/Volumes/Ramdisk/xvidcore/build/generic) $ make install
      D: /Volumes/Ramdisk/lib
      I: /Volumes/Ramdisk/lib/libxvidcore.4.dylib
      I: /Volumes/Ramdisk/lib/libxvidcore.a
      D: /Volumes/Ramdisk/include
      I: /Volumes/Ramdisk/include/xvid.h

       
      Then you can delete libxvidcore.4.dylib and make ffmpeg link against the static version of xvidcore (libxvidcore.a)

      • i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5664)
        on OSX 10.6.7

        using :
        $ tar xzpf xvidcore-1.3.1.tar.gz
        $ cd xvidcore
        $ cd build/generic
        $ ./configure –prefix=/Volumes/Ramdisk

        I get (last 5 lines):
        A: plugins/x86_asm/plugin_ssim-a.asm
        L: libxvidcore.a
        ar: libxvidcore.a is a fat file (use libtool(1) or lipo(1) and ar(1) on it)
        ar: libxvidcore.a: Inappropriate file type or format
        make: *** [=build/libxvidcore.a] Error 1

        I have to use

        • What version of Xcode ist installed?
          Are you trying to compile an universal binary?

          Please execute the following in a new shell:

          $ unset CFLAGS
          $ unset CXXFLAGS
          $ unset LDFLAGS
          $ unset CC
          $ tar xzpf xvidcore-1.3.1.tar.gz
          $ cd xvidcore
          $ cd build/generic
          $ ./configure
          $ make

           

          Does that work?

          • Not working, getting (last 3 lines):

            ranlib: archive member: libxvidcore.a(plugin_ssim-a.o) cputype (7) does not match previous archive members cputype (16777223) (all members must match)

            ranlib: for architecture: x86_64 file: libxvidcore.a(timer.o) has no symbols

            make: *** [libxvidcore.a] Error 1

            I’m using xcode 3.2.6 and gcc 4.2.1 on Snow 10.6.7

  18. Can you try manually setting CFLAGS prior to running configure?

    $ expot CFLAGS=”-m64″
    $ export CPPFLAGS=$CFLAGS

    $ tar xzpf xvidcore-1.3.1.tar.gz
    $ cd xvidcore
    $ cd build/generic
    $ ./configure –prefix=/Volumes/Ramdisk

    If that fails, in a new shell at a new location:

    $ expot CFLAGS=”-m32″
    $ export CPPFLAGS=$CFLAGS

    $ tar xzpf xvidcore-1.3.1.tar.gz
    $ cd xvidcore
    $ cd build/generic
    $ ./configure –prefix=/Volumes/Ramdisk

    If both fail, retry both steps by adding –disable-assembly to the configure command line.

    Does that help?

  19. Forgive me for being an ignoramus. I tried to install git. I only changed the version to a newer one (1.7.4.4) and had to use a .tar.gz as the .tar.bz2 one downloaded into Terminal and froze it. So anyway, it was going well until I got an error. I would appreciate any advice as to what to do next.

    (The /sw directory was created by fink, which is how I installed all the dependent files. But it only can get a pretty old version of ffmpeg)

    . . . . CC xdiff/xpatience.o
    AR xdiff/lib.a
    LINK git-daemon
    ld: warning: in /sw/lib/libiconv.dylib, file was built for i386 which is not the architecture being linked (x86_64)
    Undefined symbols:
    "_libiconv_open", referenced from:
    _reencode_string in libgit.a(utf8.o)
    "_libiconv", referenced from:
    _reencode_string in libgit.a(utf8.o)
    "_libiconv_close", referenced from:
    _reencode_string in libgit.a(utf8.o)
    _reencode_string in libgit.a(utf8.o)
    ld: symbol(s) not found
    collect2: ld returned 1 exit status
    make: *** [git-daemon] Error 1
    Jims-MacBook-Pro:git-1.7.4.4 jim$

    • You are trying to link libiconv 32bit to a 64bit binary which will not work.
      There are two possible solutions:

      – Build a x86_64 libiconv to link against
      – Build a 32bit git binary by setting CFLAGS to -arch i386

    • Thank you for the information! Maybe I should put up a link list of where to get all the supporting libraries.

  20. hi again,

    have you ever tried to build libfreetype? So in the ffmpeg part i passed –enable-libfreetype and i added the following build instructions prior to building ffmpeg:

    $ cd ${CMPL}
    $ tar xjpf ${MES}/freetype-2.4.5.tar.bz
    $ cd freetype-2.4.5
    $ ./configure –prefix=${TARGET} –disable-shared –enable-static
    $ make -j 4 && make install

    the freetype seems to build fine but i always get freetype2 not found when ffmpeg starts to build and it quits. any idea why?

    rc

    • The ./configure script executes a subroutine called check_pkg_config to detect libfreetype2 which looks like this:

      check_pkg_config(){
          log check_pkg_config "$@"
          pkg="$1"
          headers="$2"
          funcs="$3"
          shift 3
          $pkg_config --exists $pkg 2>/dev/null || return
          pkg_cflags=$($pkg_config --cflags $pkg)
          pkg_libs=$($pkg_config --libs $pkg)
          check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
              set_safe ${pkg}_cflags $pkg_cflags   &&
              set_safe ${pkg}_libs   $pkg_libs
      }
      

      As you can see, the subroutine completely disregards any CFLAGS or LDFLAGS
      you may have set and soley relies on the existence of a program/script named ‘pkg-config’
      which it queries for as seen on the last line of config.log:

      check_pkg_config freetype2 ft2build.h freetype/freetype.h FT_Init_FreeType

      Futher information concerning pkg-config can be found here:
      http://people.freedesktop.org/~dbn/pkg-config-guide.html

      Anyway, for libfreetype2 to be found, a simple shell script emulation of pkg-config will do:

      #!/bin/bash
      
      case $1 in
          --exists)
              exit 0
          ;;
          --cflags)
              /Volumes/Ramdisk/bin/freetype-config --cflags
          ;;
          --libs)
              /Volumes/Ramdisk/bin/freetype-config --libs
          ;;
      esac
      
      exit 0
      

      Put that into ${TARGET}/bin prior to compiling ffmpeg and it should find freetype2 and successfully compile (and do not forget to modify the /Volumes/Ramdisk path inside the script accordingly).

      • Well I couldn’t get it to work maybe I’m doing something wrong. Here is a little bit of the output below when it quits in case it helps. So basically I did everything like the first time but now I made a file pkg-config.sh and placed it in ${TARGET}/bin before ffmpeg started to build. It’s a copy of what you posted only I changed the path to match my ${TARGET}. Did I do it wrong?

        rmdir /Volumes/Ramdisk/sw/include/freetype2/freetype/internal
        rmdir: /Volumes/Ramdisk/sw/include/freetype2/freetype/internal: No such file or directory
        make: [install] Error 1 (ignored)
        /usr/bin/install -c -m 644 ./builds/unix/ft2unix.h \
        /Volumes/Ramdisk/sw/include/ft2build.h
        /usr/bin/install -c -m 644 ./builds/unix/ftconfig.h \
        /Volumes/Ramdisk/sw/include/freetype2/freetype/config/ftconfig.h
        /usr/bin/install -c -m 644 /Volumes/Ramdisk/compile/freetype-2.4.5/objs/ftmodule.h \
        /Volumes/Ramdisk/sw/include/freetype2/freetype/config/ftmodule.h
        /usr/bin/install -c -m 755 ./builds/unix/freetype-config \
        /Volumes/Ramdisk/sw/bin/freetype-config
        /usr/bin/install -c -m 644 ./builds/unix/freetype2.m4 \
        /Volumes/Ramdisk/sw/share/aclocal/freetype2.m4
        /usr/bin/install -c -m 644 ./builds/unix/freetype2.pc \
        /Volumes/Ramdisk/sw/lib/pkgconfig/freetype2.pc
        ERROR: freetype2 not found

        If you think configure made a mistake, make sure you are using the latest
        version from Git. If the latest version fails, report the problem to the
        ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
        Include the log file “config.log” produced by configure as this will help
        solving the problem.
        logout

        [Process completed]

        • The script must be called ‘pkg-config’ not ‘pkg-config.sh’.
          Also, make it executable by ‘chmod 755 pkg-config’

          • Hi hexeract,

            I met troubles when compiling ffmpeg.
            When I add the –enable-libopencv flag, configure give the error message: opencv not found.
            I installed opencv, and have tried opencv-2.0, opencv-2.1, opencv-2.2, opencv-2.3, the result is the same.

            could you give some suggestions?

            Thanks.

          • The problem of ffmpeg not finding opencv has two reasons: It gnores CFLAGS and LDFLAGS concerning the check for opencv and uses pkg-config to obtain opencv specific compiler and linker flags.

             
            Diving deep into the configure script for ffmpeg reveal two shell functions responsible for checking the availablity of opencv.

             
            Within the configure script, it uses require-pkg_config to detect and (if found, set the CFLAGS and LDFLAGS accordingly).

             
            Actual configure line checking for opencv:

             
            require_pkg_config opencv opencv/cxcore.h cvCreateImageHeader
            

             
            require_pkg_config:

            require_pkg_config(){
                pkg="$1"
                check_pkg_config "$@" || die "ERROR: $pkg not found"
                add_cflags    $(get_safe ${pkg}_cflags)
                add_extralibs $(get_safe ${pkg}_libs)
            }
            

             
            check_pkg_config which is called by require_pkg_config

            check_pkg_config(){
                log check_pkg_config "$@"
                pkg="$1"
                headers="$2"
                funcs="$3"
                shift 3
                $pkg_config --exists $pkg 2>/dev/null || return
                pkg_cflags=$($pkg_config --cflags $pkg)
                pkg_libs=$($pkg_config --libs $pkg)
                check_func_headers "$headers" "$funcs" $pkg_cflags $pkg_libs "$@" &&
                    set_safe ${pkg}_cflags $pkg_cflags   &&
                    set_safe ${pkg}_libs   $pkg_libs
            }
            

             
            Be sure to create a 2GB sized Ramdisk :)

             
            The first step is to create a file in ${TARGET}/bin called ‘pkg-config’. Do not forget to change the path if you have named your ramdisk differently.

            #!/bin/bash
            
            case $1 in
                --exists)
                    exit 0
                ;;
                --cflags)
                    echo "-I/Volumes/Ramdisk/include -I/Volumes/Ramdisk/include/opencv"
                ;;
                --libs)
                     echo "-L/Volumes/Ramdisk/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann" 
                ;;
            esac
            

             
            In order to build opencv the ‘cmake’ program is required, so we need to build it.

            cd /Volumes/Ramdisk
            mkdir compile
            cd compile
            curl -O http://www.cmake.org/files/v2.8/cmake-2.8.5.tar.gz
            tar xzpf cmake-2.8.5
            cd cmake-2.8.5
            ./configure --prefix=/Volumes/Ramdisk
            make -j 2
            make install
            

             
            Building opencv

            export PATH=/Volumes/Ramdisk/bin:$PATH
            cd /Volumes/Ramdisk
            cd compile
            curl -O http://switch.dl.sourceforge.net/project/opencvlibrary/opencv-unix/2.3/OpenCV-2.3.0.tar.bz2
            tar xjpf OpenCV-2.3.0.tar.bz2
            cd OpenCV-2.3.0
            mkdir release
            cd release
            cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/Volumes/Ramdisk -D BUILD_SHARED_LIBS=NO .. 
            make -j 2
            make install
            

             
            Building ffmpeg

            cd /Volumes/Ramdisk
            cd compile
            git clone git://git.videolan.org/ffmpeg.git
            cd ffmpeg
            ./configure --prefix=/Volumes/Ramdisk --enable-libopencv --enable-static --disable-shared --disable-yasm
            

             
            Sadly, this will blow up, checking the config.log shows:

            Undefined symbols for architecture i386:
              "std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)", referenced from:
                  cv::OutOfMemoryError(unsigned long)in libopencv_core.a(alloc.o)
                  _cvSetMemoryManager in libopencv_core.a(alloc.o)
                  _cvSetIPLAllocators in libopencv_core.a(array.o)
                  _cvReleaseMat in libopencv_core.a(array.o)
                  _cvInitMatHeader in libopencv_core.a(array.o)
                  _cvCreateMatHeader in libopencv_core.a(array.o)
                  _cvInitMatNDHeader in libopencv_core.a(array.o)
            

             
            When researching the error message it seems that additional linking to libstdc++ is required. A minor change to pkg-config is required to make the configure run of ffmpeg to be successful:

            #!/bin/bash
            
            case $1 in
                --exists)
                    exit 0
                ;;
                --cflags)
                    echo "-I/Volumes/Ramdisk/include -I/Volumes/Ramdisk/include/opencv"
            
                ;;
                --libs)
                     echo "-lstdc++ -L/Volumes/Ramdisk/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann"
                ;;
            esac
            exit 0
            

             
            With this modification, the ffmpeg ./configure run works fine and ffmpeg builds:

            /Volumes/Ramdisk/bin/ffmpeg 
            ffmpeg version N-31743-g324b8ad, Copyright (c) 2000-2011 the FFmpeg developers
              built on Aug  3 2011 19:22:19 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
              configuration: --prefix=/Volumes/Ramdisk --enable-libopencv --enable-static --disable-shared --disable-yasm
              libavutil    51. 11. 1 / 51. 11. 1
              libavcodec   53.  9. 1 / 53.  9. 1
              libavformat  53.  6. 0 / 53.  6. 0
              libavdevice  53.  2. 0 / 53.  2. 0
              libavfilter   2. 27. 5 /  2. 27. 5
              libswscale    2.  0. 0 /  2.  0. 0
            Hyper fast Audio and Video encoder
            usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
            
            Use -h to get full help or, even better, run 'man ffmpeg'
            

             
            I am not sure how to use opencv via ffmpeg but I hope you can retrace my steps successfully to compile ffmpeg linking against opencv.

          • It works. Thank you very much! I have another question. When I use frei0r filter like this
            ffmpeg -i 123.avi -vf “frei0r=distort0r:0.5:0.01″ /Volumes/123.mp4
            ffmpeg gives the following error message
            [frei0r @ 0x16029a0] Could not find module ‘distort0r’
            Error initializing filter ‘frei0r’ with args ‘distort0r:0.5:0.01′
            I have no idea about this, please help me.
            Thanks again.

          • Thank you!
             
            Checking the libavfilter documentation, section 8.12:
            To enable compilation of this filter you need to install the frei0r header and configure FFmpeg with –enable-frei0r.
            I assume you need compile frei0r and then compile ffmpeg accordingly.
             
            If you already have ffmpeg compiled with (a recent version of) frei0r the only advice I can give you is to ask on the ffmpeg user mailing list for assistance.

          • Actually there is also another way to solve the opencv problem as I found out.

            If you already have pkg-config installed locally say under /usr/bin/pkg-config, and opencv is statically compiled successfully then all you need to do is pass to the configure option the following:

            ./configure –extra-cflags=”-I/home/ubuntu/ffmpeg2012/build/include/opencv -I/home/ubuntu/ffmpeg2012/build/include” –extra-libs=”-lstdc++ -L/home/ubuntu/ffmpeg2012/build/lib -lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann” .. other config options

            If you need to find out what to put within the extra-libs and extra cflags for static libs just use pkg-config like so:

            pkg-config –libs –static opencv

          • Concerning opencv, see my comment “2011/08/03 at 14:31″.

            I did not include the compilation steps for opencv in the main article because I do not think that many people require this feature (and also adds quite an overhead to the overall proceess and final result).

  21. Hi Hexeract,

    I have been following your post several weeks and I’ve got to make a Bash Script to automate de process of compiling FFmpeg in Mac OS X 10.6 (Snow Leopard) with the following tools:
    - Git
    - Mercurial
    - Nasm
    - Yasm
    - Lame
    - FAAD2
    - FAAC
    - Libvpx (WebM – VP8)
    - OpenCore-AMR
    - SDL
    - x264
    - FFmpeg

    I am missing (Theora, Vorbis, Xvid…) those will come later.

    I have been doing some research and I am been unable to make a static link. otool -L shows me:
    otool -L /usr/local/bin/ffmpeg
    /usr/local/bin/ffmpeg:
    /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 15.0.0)
    /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 38.0.0)
    /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 152.0.0)
    /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
    /usr/local/lib/libopencore-amrwb.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/lib/libopencore-amrnb.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/lib/libmp3lame.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/local/lib/libfaac.0.dylib (compatibility version 1.0.0, current version 1.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
    /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 227.0.0)
    /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 44.0.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.43.0)
    /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 751.62.0)
    /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1038.36.0)

    Any ideas? I am up to sharing the bash script and credit with you.

    Thanks in advance.

    • For what its worth – I started a bash script in 2009 when this thread first started and I am happy to share it with you in case you can use it. I haven’t run it in a while, but if I remember correctly it worked at the time to automate the process. It is a menu driven script. Obviously the sources may have changed and other intricacies may have changed but maybe it can help you get a start. You can download my bash script here: http://cl.ly/1A3N3d3A1G3d132V1g2h

      • Thank you very much for sharing your script!

        I already have a set of shell scripts to automatically build ffmpeg, ffmpeg-libav and mplayer but they are crude and should never see the light of day :)
        If you are interested please contact me again and I will send them via email to you (or any other interested party).

      • Great! I definitelly will take a look at it. I’ll probably have to make many changes to mine before it sees the light as Hexeract says :P…

        I’ll take some time tonight (8 pm here now) and will get back to you tomorrow with some feedback.

        Many thanks in advance!!!!!

      • Any chance any of the scripts available supports binaries that work all the way back to Tiger as well as PPC? I’d like to build a super-fat ffmpeg binary that works on basically every Mac system still in use. There is a lame binary available online that is built like that, but no ffmpeg binary like that as far as I’ve seen.

        • Basically, the best approach would be to build each architecture seperatly and then “glueing” them together using ‘lipo’.

          To create PPC binaries you need Xcode 3 and the following environment setup:

          export CC=/usr/bin/gcc-4.0
          export CFLAGS=”-isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch ppc -mmacosx-version-min=10.4″
          export LDFLAGS=”-Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -arch ppc -mmacosx-version-min=10.4″

          Trying to use multiple ‘-arch’ arguments will just break compilation for some media libraries.

          I remember I once tried to do that but it was quite a lot of hassle to do it on an Intel machine
          and as I did not need a PPC binary I let it be.

          If you do have a PPC machine it would be interesting to know if my guide helps in compiling a PPC only version (since that would be built by default).

  22. I already have a bash script :)
    Actually, I have 4. One for each program and a script that compiles all the media codec libraries.

    Judging from your ‘otool -L’ output, I suspect quite a few of those come from the SDL you include.
    Why would you want to include SDL on MacOSX?

    Concerning OpenCore AMR:
    I used the following source archive: vo-amrwbenc-0.1.1.tar.gz
    Simply unpacking and compiling it:

    $ tar xzpf vo-amrwbenc-0.1.1.tar.gz
    $ cd vo-amrwbenc-0.1.1
    $ ./configure –prefix=/Volumes/Ramdisk –enable-static –disable-shared

    Provides libraries that can be statically linked to ffmpeg.

    The path shown in the output of ‘otool -L’ is ‘/usr/local/lib’
    I would think you compiled it without –disable-shared and the target was /usr/local/.

    In any case I do not recommend compiling to /usr/local/ but to a ram disk instead.
    It will keep your system clean and you do not need to worry about breaking things.

    This is what my output looks like:

    snowy@wintermute(~) $ ffmpeg -version
    ffmpeg version N-32911-gbf85b90-snowy, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 25 2011 10:28:48 with gcc 4.2.1 (Apple Inc. build 5666) (dot 3)
    configuration: –prefix=/Volumes/ffmpeg-latest/ –as=yasm –extra-version=snowy –disable-shared –enable-static –disable-ffplay –disable-ffserver –enable-gpl –enable-pthreads –enable-gray –enable-postproc –enable-libfaac –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-libvo-aacenc –enable-libvo-amrwbenc –enable-nonfree –enable-version3 –enable-runtime-cpudetect
    libavutil 51. 17. 0 / 51. 17. 0
    libavcodec 53. 17. 0 / 53. 17. 0
    libavformat 53. 13. 0 / 53. 13. 0
    libavdevice 53. 4. 0 / 53. 4. 0
    libavfilter 2. 43. 5 / 2. 43. 5
    libswscale 2. 1. 0 / 2. 1. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    ffmpeg N-32911-gbf85b90-snowy
    libavutil 51. 17. 0 / 51. 17. 0
    libavcodec 53. 17. 0 / 53. 17. 0
    libavformat 53. 13. 0 / 53. 13. 0
    libavdevice 53. 4. 0 / 53. 4. 0
    libavfilter 2. 43. 5 / 2. 43. 5
    libswscale 2. 1. 0 / 2. 1. 0
    libpostproc 51. 2. 0 / 51. 2. 0

    snowy@wintermute(~) $ otool -L .bin/ffmpeg
    .bin/ffmpeg:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.0)

  23. JUST GREAT!!!

    I have been able to make a better binary (more library independent) than mine thanks to your recommendations. Making the Ramdisk just made my day!!!!

    Thank you very much.

    I have a question. Why do you compile section “Building libav’s ffmpeg” after FFmpeg? Aren’t the libs into FFmpeg git repository? If they are needed to be compiled, shouldn’t it be done before building FFmpeg?

    Thanks in advance.

    • I may have been unclear in the guide :( I will fix that.

      I do not build libav’s ffmpeg _after_ ffmpeg. I build either of the three after all “base libraries” have been successfully compiled.
      Most likely building libav’s ffmpeg after ffmpeg will work and will not introduce any unwanted dependencies.

        • You are welcome to publish the blog posting on gist.github.com.
          If you do, please make a reference to the original source.

          Also, I do update the blog posting when a new version of a library is available or configure flags change.

  24. I would like to compile FFmpeg with freetype and libass. Any help for this is welcome !
    TIA

  25. Well, two issues. I cannot get the Freetype to compile correctly (I think). And compiling libass gives this error:

    “checking for FREETYPE… configure: error: in `/Volumes/tempdisk/compile/libass-0.10.0′:
    configure: error: The pkg-config script could not be found or is too old. Make sure it
    is in your PATH or set the PKG_CONFIG environment variable to the full
    path to pkg-config.
    Alternatively, you may set the environment variables FREETYPE_CFLAGS
    and FREETYPE_LIBS to avoid the need to call pkg-config.
    See the pkg-config man page for more details.
    To get pkg-config, see .
    See `config.log’ for more details.”

    It would be great if you figure out how to compile both because with 0.90 it should be (finally) possible to hardcode subtitles.
    I am a bit of a noob with compiling though following your steps I manage to do it every time. As said, I am a bit of a noob to try it with freetype and libass :-) :-)

  26. That is easy to solve. Create a “fake” pkg-config script. Please check the other comments of this posting where I describe on how to build the pkg-config script for freetype2 (once freetype2 was successfully compiled and installed into the Ramdisk).

    libass actually has quite a few dependencies and a bad configure script since it will state it has found other dependencies which clearly are not available:

    – enca
    – fontconfig
    – fribidi

    Once you compile freetype2, enca, fontconfig and fribidi the compilation of libass will fail
    since some types will not match… I am not enough of a programmer to fix this and I have not yet found enough information about how others managed to fix it. I would suspect not using the latest fribidi might help but this assumption is untested…

    • As stated previously, compiling libass itself is not the problem, the dependencies are and I stopped at “fribidi”. If you do manage to take the time and find out which version will actually work with libass, please let me know…

  27. It would be great some-one could manage to compile FFmpeg with LibASS support. Reading above it doesn’t seems to be easy.

    • It must be possible since both Handbrake and VLC have libass support (as far as I know). If only there was access to their build infrastructure/scripts…
      The latter would probably show which versions have to be used and will play nicely together to get a (static) libass library…

      If anyone does have any helpful suggestions/hints, please do not hesitate to make a comment on this blog or contact me.

  28. Pingback: Compiling FFmpeg/MPlayer with single command | Video Gorillas
      • That guide is not really of any help, finding the libraries can be a hassle but is not too difficult.
        Mentioning that freetype is needed is merely a hint, but does not mention of the other dependencies libass actually has…

        The guide provides an overview of what can be included but has no step to step compilation documentation.

    • There must be a working set of versions of freetype, enca, frontconfig and fribidi for libass to compile (since it obviously has been done for VLC and the win32 static ffmpeg binary that is mentioned in the URL you have provided) but it seems everyone is keeping it secret on how to actually build libass. Even the libass author fails to document on how to build libass… go figure..

      Sadly, the site you mention does not provide exact versions for the libass dependencies (and even fails to mention there are any!), so I am back to square one.
      Nevertheless, if I have some spare time at the weekend I will give it another (most likely futile) try.

    • the pkg-config part is easy, I assume you need that for freetype to be found?
      Please search the comments where I have described on how to set up a “dummy” pkg-config.
      If you need a different pkg-config modify accordingly.

      All that pkg-config does is to supply the include path and library path and the configure picks up on the result.

  29. Hi,

    I know this is not exactly ffmpeg, but do you know how to build dvdauthor on Mac? I keep getting an error that I need libpng(-devel) but I haven’t been able to figure it out. Thought it won’t hurt to ask. :-)

    • The program dvdauthor was not written with libpng 1.5.x in mind which has changed some internals thus breaking a source code line in ./src/spuunmux.c. Also, in the same file, the reference for the zlib.h include file is missing. The two perl lines fixes the problems in a very crude fashion.

      On my box MacOSX 10.7.3, latest Xcode and installed command line tools via Xcode, the following script works and results in a dvdauthor binary:

       

      #!/bin/bash
      
      NAME=Ramdisk
      SIZE=2097152
      
      DISK_ID=$(hdid -nomount ram://$SIZE)
      newfs_hfs -v ${NAME} ${DISK_ID}
      diskutil mount ${DISK_ID}
      
      export CC=clang
      
      cd /Volumes/Ramdisk/
      
      BASEDIR=$(pwd)
      
      mkdir $BASEDIR/sw
      
      mkdir $BASEDIR/sources
      cd    $BASEDIR/sources
      
      export LDFLAGS="-L$BASEDIR/sw/lib"
      export  CFLAGS="-I$BASEDIR/sw/include"
      
      curl -O http://zlib.net/zlib-1.2.6.tar.gz
      tar xzpf zlib*
      cd zlib*
      ./configure --prefix=$BASEDIR/sw --static
      make && make install
      
      cd $BASEDIR/sources
      
      curl -O http://dfn.dl.sourceforge.net/project/libpng/libpng15/1.5.10/libpng-1.5.10.tar.gz
      tar xzpf libpng*
      cd libpng*
      ./configure --prefix=$BASEDIR/sw --enable-static --disable-shared
      make && make install
      
      
      cd $BASEDIR/sources
      
      curl -O http://garr.dl.sourceforge.net/project/dvdauthor/dvdauthor/0.7.0/dvdauthor-0.7.0.tar.gz
      tar xzpf dvdauthor*
      cd dvdauthor*
      
      FIXME=./src/spuunmux.c
      
      perl -p -i -e "s;<png.h>;<png.h>\n#include <zlib.h>\n" $FIXME
      perl -p -i -e "s;png_ptr->jmpbuf;png_jmpbuf(png_ptr);" $FIXME
      
      ./configure --prefix=$BASEDIR/sw 
      make && make install
      
      clear
      cd $BASEDIR/sw/bin
      ls -l dvdauthor
      ./dvdauthor -version
      otool -L ./dvdauthor
      

      Hope this helps.

      • As always you’re the best! :-) Thanks for the help. Just curious this is a static build right? I used your script on 10.7.3 (worked perfectly) and with otool -L I got this:

        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
        /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 46.1.0)

        But on an older Mac with Xcode 3 I removed the exportCC=clang line and got this:

        /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
        /usr/lib/libxml2.2.dylib (compatibility version 9.0.0, current version 9.16.0)
        /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
        /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 111.1.7)
        /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 36.0.0)
        /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

        Anything to be concerned about you think? Some older dvdauthor binaries I found on the internet even show different results so I’m not sure? Thanks again!

        • That looks about right. You can never really build a “truly” static binary on MacOSX,
          you will always end up with at least libSystem*dylib…

          What you can do is to avoid too many “outside” dependencies and have the binary just depend on the (minima) set of system libraries provided by the operating system.

          This is my otool -L output:

          ./dvdauthor:
          /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
          /usr/lib/libxml2.2.dylib (compatibility version 10.0.0, current version 10.3.0)
          /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
          /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 46.1.0)

          That binary should be able to run on any other 10.7.x System. If you target an older operating system you will probably have to use the gcc provided by Xcode 3,x and use the following environment variables for CC, CFLAGS and LDFLAGS, which you can place right after setting LDFLAGS and CFLAGS in the script:

          export CC=”/Developer-old/usr/bin/gcc-4.0″
          export CFLAGS=”$CFLAGS -isysroot /Developer-old/SDKs/MacOSX10.4u.sdk -arch i386 -mmacosx-version-min=10.4″
          export LDFLAGS=”$LDFLAGS -Wl,-syslibroot,/Developer-old/SDKs/MacOSX10.4u.sdk -arch i386 -mmacosx-version-min=10.4″

          This will produce the following file:

          otool -L:
          ./dvdauthor:
          /usr/lib/libiconv.2.dylib (compatibility version 5.0.0, current version 5.0.0)
          /usr/lib/libxml2.2.dylib (compatibility version 9.0.0, current version 9.16.0)
          /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.3)
          /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 88.3.11)
          /usr/lib/libicucore.A.dylib (compatibility version 1.0.0, current version 32.0.0)
          /usr/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)

          file /Volumes/Ramdisk/sw/bin/dvdauthor:
          /Volumes/Ramdisk/sw/bin/dvdauthor: Mach-O executable i386

          As I do not have access to a 10.4 machine I can not verify that this binary will actually run.

    • I have not had any spare time to play around with that problem. Also, as I do not need that functionality myself, the priority for this is very low.

      You can try yourself, it is just a matter of trying various combinations of the required dependencies until libass compiles, from there on, compiling ffmpeg should not be a problem..

  30. Hello,

    Thanks for the awesome guide. I’ve followed your guide step-by-step and there are 2 things I wanted to mention:

    1) Although using ‘–disabled-shared –enabled-static’ there are several dylib files in ${TARGET}/lib which have to be deleted before compiling ffmpeg. Otherwise the dynamic libraries are used, even, if you specify ‘–disabled-shared –enabled-static’ for ffmpeg.
    2) otool -L ./ffmpeg
    ./ffmpeg:
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 550.44.0)
    /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.6.3)
    /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.6.2)

    I have no idea where the /System/Library/Frameworks/* are coming from.

    • Can you list the .dylib files in your ${TARGET}/lib?
      This will help me cross-check with my own build environment.

      • Hi,

        Thanks for your quick reply. Here are the .dylib files in my ${TARGET}/lib (I had to install them again, since I had deleted them to compile ffmpeg…):

        libfaac.0.0.0.dylib
        libfaac.0.dylib -> libfaac.0.0.0.dylib
        libfaac.dylib -> libfaac.0.0.0.dylib
        libfaad.2.0.0.dylib
        libfaad.2.dylib -> libfaad.2.0.0.dylib
        libfaad.dylib -> libfaad.2.0.0.dylib
        libmp3lame.0.dylib
        libmp3lame.dylib -> libmp3lame.0.dylib
        libogg.0.dylib
        libogg.dylib -> libogg.0.dylib
        libopencore-amrnb.0.dylib
        libopencore-amrnb.dylib -> libopencore-amrnb.0.dylib
        libopencore-amrwb.0.dylib
        libopencore-amrwb.dylib -> libopencore-amrwb.0.dylib
        liborc-0.4.0.dylib
        liborc-0.4.dylib -> liborc-0.4.0.dylib
        liborc-test-0.4.0.dylib
        liborc-test-0.4.dylib -> liborc-test-0.4.0.dylib

        Btw, do you see the /System/Library/Frameworks/* in your binary? In any case, do you have any idea why they are there?

        • This is my otool output:

          snowy@snowcrash(/Volumes/ffmpeg-latest) $ otool -L bin/ffmpeg
          bin/ffmpeg:
          /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
          /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 635.21.0)
          /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
          /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.7.0)
          /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.7.0)
          snowy@snowcrash(/Volumes/ffmpeg-latest) $

          You can not build a “truly” static binary on OSX, you will always have some libSystem*.dynlib dependency.

          Checking my $TARGET/lib does not show any .dylib files…

          Do you have a script or do you follow each step manually?

          Are you using the versions as shown in the posting?

          • I don’t have a script yet, so I have done everything manually.

            I’ve used a few more recent versions: vo-aacenc-0.1.2.tar.gz, vo-amrwbenc-0.1.2.tar.gz, zlib-1.2.7.tar.gz, libvpx-v1.1.0.tar.bz2.
            I’ve also used 2 additional packages: orc-0.4.16.tar.gz, opencore-amr-0.1.3.tar.gz.

            Oh, and for ffmpeg 0.11 you get an error, when using ‘–enable-libfaad’ with configure.

            It is also interesting that you compile gsm, but do not add it to the options when configuring ffmpeg. I thought you have to add ‘–enable-libgsm’.

          • Thank you very much for your report!
            I have updated the posting to reflect all changes made to the compilation workflow.

            Checking on libgsm, your observation was correct. Indeed I omitted –enable-libgsm
            assuming ffmpeg would find it automatically. Sadly, this was not the case.
            Another fix to the Makefile of gsm-1.0-pl13 will install the gsm.h header file
            into include/gsm/ where ffmpeg searches for it when provided with –enable-libgsm

            Yet I was unable to reproduce the creation of the dynamic libraries.
            What you can do is to delete those libraries after each step since ffmpeg
            will have no other choice but to use the static libraries..

            Checking the configure flags, there is no –enable-libfaad and hence I doubt
            ffmpeg really uses that… Maybe mplayer/mencoder does :)

            If you happen to compile ffmpeg on a regular basis I strongly advise you to
            make (large) shell script to automate the compilation.
            Saves a lot of time and spares you from headaches :)

          • No worries, I’ll write a script soon. :-) I’m just pretty busy with other stuff right now…
            It doesn’t really matter that there are dynamic libs as well, since I could work around it by deleting them. It’s just weird that they are created with ‘–disabled-shared –enable-static’.

          • Basically, what you see in the posting is the main part of the script, I just have some error checking and creating a DMG when everything ran successfully.

            I still do not understand how you get the shared libs when using –disable-shared –enable-static. With my test runs, they never were built when using those options. You can always “clean” out $TARGET/lib after each step, although that not be an elegant way of “avoiding” shared libraries.

          • You are welcome!
            If you need any further help, I would be more than happy to assist.

  31. When compiling with –enable-libass I get this error:

    checking for FREETYPE… yes
    checking for FRIBIDI… yes
    checking for FONTCONFIG… yes
    checking for HARFBUZZ… yes
    checking for ENCA… yes

    In file included from ass_cache.c:27:
    ./ass_utils.h:30:10: fatal error: ‘enca.h’ file not found
    #include
    ^
    In file included from ass_fontconfig.c:32:
    ./ass_utils.h:30:10: fatal error: ‘enca.h’ file not found
    #include
    ^
    In file included from ass_font.c:33:
    ./ass_fontconfig.h:29:10: fatal error: ‘fontconfig/fontconfig.h’ file not found
    #include
    ^
    In file included from ass.c:38:
    ./ass_utils.h:30:10: fatal error: ‘enca.h’ file not found
    #include

    Any thoughts?

    • libass is being unfaithful to you concerning the dependencies that are found.

      You need to compile the required dependencies (enca, fontconfig, fribidi) and make sure that libass, when it compiles) can find the include/library files.

      As stated previously, I have not managed to compile libass and I have not found any good documentation on how other projects who seem to use libass have managed to get a working library.

      • As you can see in my previous mail Enva, Fontconfig, Fribidi and Harfbuzz (also needed).
        Libass finds those libs with no issues – in fact it compiles libass correctly minus the above files. Though other files in the same folder are found and compiled.

        Anyway, if someone can help me out .. let me know

        • Manage to compile Libass but I cannot get it compile into FFmpeg.

          Libraries have been installed in:
          /Volumes/tempdisk/sw/lib

          If you ever happen to want to link against installed libraries
          in a given directory, LIBDIR, you must either use libtool, and
          specify the full pathname of the library, or use the `-LLIBDIR’
          flag during linking and do at least one of the following:
          – add LIBDIR to the `DYLD_LIBRARY_PATH’ environment variable
          during execution

          See any operating system documentation about shared libraries for
          more information, such as the ld(1) and ld.so(8) manual pages.
          ———————————————————————-
          test -z “/Volumes/tempdisk/sw/include/ass” || .././install-sh -c -d “/Volumes/tempdisk/sw/include/ass”
          /usr/bin/install -c -m 644 ass.h ass_types.h ‘/Volumes/tempdisk/sw/include/ass’
          make[2]: Nothing to be done for `install-exec-am’.
          test -z “/Volumes/tempdisk/sw/lib/pkgconfig” || ./install-sh -c -d “/Volumes/tempdisk/sw/lib/pkgconfig”
          /usr/bin/install -c -m 644 libass.pc ‘/Volumes/tempdisk/sw/lib/pkgconfig’

          • From the text you show it is unclear why ffmpeg fails to use libass.
            It only shows a very small bit from the libass make install run.

            Can you provide me with the exact version numbers of the libraries you used to compile libass?
            Preferably with all configure options for each library. This should enable me to retrace your steps.

  32. libass only compiles with 0.9.9 – all newer versions gives a lot of errors.
    Make sure you also compile ENCA, FRIBIDI, FONTCONFIG and FREETYPE (you can use the latest versions for those sources)

    I feel we are getting close. :)

    • libass compiles on both ffmpeg 10, 11 and the git version as I found out today.

      You just need to add the following into the configure command:

      ./configure –extra-libs = ‘-lass -lfontconfig -lexpat -lenca -lm -lfribidi -lfreetype -lz -lbz2 -lxml2′ –extra-ldflags= ‘-lass -lfontconfig -lexpat -lenca -lm -lfribidi -lfreetype -lz -lbz2 -lxml2′ …

      The above works for me on a ubuntu box for a static compile

      • I never doubted that libass will compile with ffmpeg.

        The problem was to figure out which versions of libass, enca, fribidi, freetype and others will work together to produce a static and working libass which can be used to link with ffmpeg….

        • Can you please be a little more specific as to what did not work and what you have tried?

  33. FYI I tried the above instructions but it doesn’t work. To be more exact it works with SL and Lion.
    But with ML it gives too many errors to mention here (almost every source you try to compile gives errors).
    Any update in the tutorial for OSX10.8 ?

    • I recompiled ffmpeg after I have updated to Mountain Lion and the only problem I have encountered was that libvpx did not compile and I had get it from the repository using git.
      Other than that, my compilation whent fine.

      Did you upgrade XCode to 4.4? Did you install the “Command Line Tools”?
      Can you post the complete output of your compilation run?

    • Why should it not build on an i7 with Ivy Bridge?
      I compile on a MacBook Pro with Core i7 and have not had any problems. Can you be more specific about the problems you run into when following the guide?

  34. libvpx could not be compiled. Ogg, Vorbis and Theora also gave a lot of errors.
    I am using a rMBP with Xcode4.4 Maybe it is because of Xcode 4.4 ?

    • Ok, now I got ogg, vorbis and theora compiled without problems.
      I also tried to compile older version of libvpx but to no luck. Anyone got this compiled on ML?

      • What did you do to “fix” the compilation of ogg, vorbis and theora. Compiling the three depends a lot in which sequence you compile each. Order is important.

        Concerning libvpx, try this:

        xport 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 && $MKMU && make install
        unset CFLAGS
        unset LDFLAGS

        instead of using the libvpx-1.0.0.

        This is what it should look like:

        snowy@snowcrash(~/Downloads) $ export CFLAGS=-I/usr/include
        snowy@snowcrash(~/Downloads) $ export LDFLAGS=-L/usr/lib
        snowy@snowcrash(~/Downloads) $ git clone http://git.chromium.org/webm/libvpx.git
        Cloning into ‘libvpx’…
        remote: Counting objects: 21726, done.
        remote: Compressing objects: 100% (5146/5146), done.
        remote: Total 21726 (delta 17164), reused 20829 (delta 16336)
        Receiving objects: 100% (21726/21726), 8.80 MiB | 676 KiB/s, done.
        Resolving deltas: 100% (17164/17164), done.
        snowy@snowcrash(~/Downloads) $ cd libvpx
        snowy@snowcrash(~/Downloads/libvpx) $ export PATH=/Volumes/Ramdisk/bin:$PATH
        snowy@snowcrash(~/Downloads/libvpx) $ type -a yasm
        yasm is /Volumes/Ramdisk/bin/yasm
        snowy@snowcrash(~/Downloads/libvpx) $ ./configure –as=yasm –disable-shared –enable-static –enable-vp8
        Configuring selected codecs
        enabling vp8_encoder
        enabling vp8_decoder
        Configuring for target ‘x86_64-darwin11-gcc’
        enabling x86_64
        enabling runtime_cpu_detect
        enabling mmx
        enabling sse
        enabling sse2
        enabling sse3
        enabling ssse3
        enabling sse4_1
        using yasm
        enabling postproc
        enabling unit_tests
        Creating makefiles for x86_64-darwin11-gcc libs
        Creating makefiles for x86_64-darwin11-gcc examples
        Creating makefiles for x86_64-darwin11-gcc docs
        snowy@snowcrash(~/Downloads/libvpx) $ make -j 8 &>/dev/null && echo “compile worked”
        compile worked
        snowy@snowcrash(~/Downloads/libvpx) $

        (I did omit the make install and unsetting of both CFLAGS and LDFLAGS but I think you get the idea :)

  35. Hoeray, using the latest git it works. Although it still displays a lot of compile errors (warnings) it compiles into FFmpeg very well.
    BTW: you do not need to use –as=yasm and –enable-vp8 – those are the defaults for libvpx

    Question: What does $MKMU do?

    Also, how can I purge the previously compiled bits in the usr/lib ? I mean, ones you compiled libvpx, next time you compile it again it skips 90% if the compiling (because it is already done previously).

    • $MKMU is just a “fancy alias” for make -j 2.

      You are talking about “bits” in /usr/lib. Are you not compiling to a Ramdisk as target?
      The reason the guide creates a Ramdisk is to speed up the compiliation process and to be able to just eject it and thus purge everything without leaving any traces in the system.

      If you have managed to use –prefix=/usr (so you get your libraries in /usr/lib, your includes in /usr/include and your binaries in /usr/bin) this may seem like a good idea at first but you have your system cluttered and purging everything will be a lot of manual work.

      The reasoning behind this does puzzle me since you would have had to build ffmpeg/libav/mplayer to a different directory target as not to risk depedencies between ffmpeg/libav/mplayer. Those will not show up while everything is running on your system but as soon as you moved your ffmpeg/libav/mplayer binary to a “clean” system, it most likely will break.

      You can check the library dependencies for a binary using tool.
      Here is my output for ffmpeg:

      $ otool -L ffmpeg
      ffmpeg:
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.0.0)
      /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
      /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)

      If you do plan to build ffmpeg more than once or twice a year I advise you to set up a bunch of build scripts, one script to build the media libaries and another to build the final product.
      On my machine, it takes about 8 to 10 minutes (Core i7, 2.5GhZ)

      Although one could really speed up the compilation by using gnu parallels and builing the libraries which do not have dependencies on each other (unlike ogg, theora and vorbis) in parallel. But that is a lot of work just to gain a few minutes. Not to speak on how to actually document what is happening without confusing the reader of the guide even more…

      From your remark, I assume you do not want to keep building the media libraries but
      just want to recompile ffmpeg. In that case, just stop when you have created all the libraries and create a DMG from the Ramdisk using the following command:

      hdiutil create -format UDBZ -volname medialibs -srcfolder /Volumes/Ramdisk $HOME/Downloads/medialibs

      In order to compile ffmpeg/libav/mplayer you just mount the DMG (which will not be a Ramdisk anymore!) and just proceeed as described in the guide. Once the product is created you can create a new DMG containing everything or you could even compile ffmpeg to a completely different target location and make a DMG out of that. The choices are endless :)

  36. I do use a ramdisk. But even when I remove the ramdisk and make a new one the libvpx isn’t compiled fully (only about 10 lines are showed – the first time I compiled libvpx it did take a while and got about +100 lines. Strange…

    The ffmpeg binary I compiled has this as dependencies – so it looks good for a static build.
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
    /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.0.0)
    /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
    /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)

    • I did not investigate as to why libvpx 1.0.0 behaves differently with XCode 4.4.
      For me, it always failed when compiled from the script but when manually navigating to the source directory and reissuing the configure && make command it worked..

      It was easier to try if the git version works and just use that.

  37. BTW nice trick with the dmg ! Will use that for sure.

    Another thingy: I did read about other asking this but how can we add libass?

    • By compiling libass? :)

      As stated previously, I do not need libass and I am really not willing to sit down and figure out this complete mess of depenencies libass has and which combination of versions of libass and its dependencies will result in a static libass library…

      If you can provide me with a guide I will try to follow it and if it works include it into the guide.

    • If you do I strongly recommend you write a script and expand it bit by bit as you go along, this will save you a lot of time in the long run since you will do many compilation runs. Also, make heavy use of a Ramdisk so you can restart the compilation run from scratch.

      Check the other comments as to what to watch out for and how you set up pkg-config for specific libraries required by libass.

  38. When following the above instructions and compile FFmpeg on a Mountain Lion Mac, the FFmpeg cannot be used on Lion or SL. How can I compile a FFmpeg on ML and make it also work on previous OS X versions?

    • If you plan to distribute the ffmpeg you build you need to modify the configure flags because the flags used in the posting create a non-distributable version of ffmpeg. The current XCode only provides SDKs for 10.7 and 10.8. This should enable you to build a version for Lion.

       
      To build a version for an older version of the Apple operating system you need to use Xcode 3.x. On my machine it resides in /Developer-old.

       
      I have successfully created a binary with the following changes:

        Set the compiler flags prior building everything

        export CC="/Developer-old/usr/bin/gcc-4.2"
        export CFLAGS="-isysroot /Developer-old/SDKs/MacOSX10.5.sdk        -mmacosx-version-min=10.5"
        export CXXFLAGS=$CFLAGS
        export LDFLAGS="-Wl,-syslibroot,/Developer-old/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5"
        export CCP="/Developer-old/usr/bin/cpp-4.2"
        

       

        Omit the following configure flags from the ffmpeg configure run

      • –enable-gsm
      • –enable-libvpx

       
      This resulted in a working binary for me but I can not test it on a 10.5 machine since I do not have such a machine.
      If you really need libgsm and libvpx you would need to investigate on how to compile those libraries with the above compiler environment variables.
       
      You might even be able to create a binary for 10.4 but what you will NOT be able to do is to create a universal binary.
      For this to work, you would need to build a version on a ppc machine and one on an x86 machine and use ‘lipo’ to glue them together. That is, if both builds actually succeed…

  39. Partially. I can get a binary that works for OSX10.7 an OSX10.8
    That is good enough for me.

  40. A few suggestions/corrections (ML, Xcode 4.4.1):

    - change the tar commands to tar xpf. I believe modern versions automatically detect the compressor in the source file and do the proper procedure, whereas when you explicit tar xzpf with a tar.xz or tar.bz2 files, you get an error.

    - in the gsm procedure:
    perl -p -i -e “s#_ROOT)/inc#_ROOT)/include#g” Makefile
    I found that the proper syntax should be:
    perl -p -i -e “s#_ROOT\)/inc#_ROOT\)/include#g” Makefile
    that is, the “)” must be quoted.

    - in the mplayer compilation procedure:
    ./configure –prefix=${TARGET} –as=yasm –disable-shared –enable-static –enable-vp8
    something between your command and your site environment reformatted “–” to a midsize dash, just like LaTeX does to “–”. The previous command instances are OK though.

    And last but not least, I didn’t manage to compile mplayer:

    libavcodec/x86/mpegaudiodec.c:262:16: error: use of undeclared identifier ‘HAVE_SSE3_EXTERNAL’
    } else if (EXTERNAL_SSE3(mm_flags)) {
    ^
    ./libavutil/x86/cpu.h:37:37: note: expanded from macro ‘EXTERNAL_SSE3′
    #define EXTERNAL_SSE3(flags) CPUEXT(flags, _EXTERNAL, SSE3)
    ^
    ./libavutil/x86/cpu.h:26:6: note: expanded from macro ‘CPUEXT’
    (HAVE_ ## cpuext ## suffix && ((flags) & AV_CPU_FLAG_ ## cpuext))
    ^
    :33:1: note: expanded from macro ‘HAVE_’
    HAVE_SSE3_EXTERNAL
    ^
    1 error generated.
    make[1]: *** [libavcodec/x86/mpegaudiodec.o] Error 1
    make[1]: *** Waiting for unfinished jobs….
    make: *** [ffmpeg/libavcodec/libavcodec.a] Error 2

    Thanks for any help,

    • Thank you very much for your bug reports and feedback!

      1. bsdtar versus gnutar
        You are right. After testing with bsdtar (the tar provided by Apple on MacOSX) and gnutar both showed the behaviour you have described. Nevertheless, older tar version may not work if the correct flag to uncompress is missing. Also, I think it is better to have explicit command line parameters instead of “implicit” ones. Makes debugging a lot easier.

        Just to make sure, I have checked my guide if I was using x or j on the “wrong” archive but I somehow managed not to mix them up :)

      2. perl expression
        You are right! I am using perl on the guide but using gnu sed in my internal build scripts. Should eat my dogfood more often :(
        The guide will be updated

      3. midsize dash
        This will also be fixed in a few moments!
      4. Compiling mplayer fails
        Happens to me too, sometimes. I simply wait a few days and retry, ususally the problem vanishes and the build is successful. This is assuming you are compiling from the svn repository. MPlayer obtains ffmpeg from git and the following posting on the ffmpeg-cvslog suggests that you might have just caught a time window where the git repository of ffmpeg was in an inconsistent state and thus the build failed.
  41. Hi,

    How can we build ffplay? I have followed your instructions and removed the –disable-ffplay but it still doesn’t build. Any ideas? Thanks!

    r

    • In order to buidl ffplay you need to build libSDL.

      Insert this into your build workflow:

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

      And remove the –disable-ffplay from the ffmpeg configure line.

      BUT:
      You will add plenty of library references in the ffmpeg binary when using SDL:

      without SDL:
      /Users/snowy/.bin/ffmpeg:
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.12.0)
      /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
      /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)

      With SDL:
      /Volumes/ffmpeg-latest/bin/ffmpeg:
      /System/Library/Frameworks/OpenGL.framework/Versions/A/OpenGL (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/Cocoa.framework/Versions/A/Cocoa (compatibility version 1.0.0, current version 19.0.0)
      /System/Library/Frameworks/ApplicationServices.framework/Versions/A/ApplicationServices (compatibility version 1.0.0, current version 45.0.0)
      /System/Library/Frameworks/Carbon.framework/Versions/A/Carbon (compatibility version 2.0.0, current version 155.0.0)
      /System/Library/Frameworks/AudioToolbox.framework/Versions/A/AudioToolbox (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/AudioUnit.framework/Versions/A/AudioUnit (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit (compatibility version 1.0.0, current version 275.0.0)
      /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
      /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 744.12.0)
      /System/Library/Frameworks/VideoDecodeAcceleration.framework/Versions/A/VideoDecodeAcceleration (compatibility version 1.0.0, current version 1.0.0)
      /System/Library/Frameworks/QuartzCore.framework/Versions/A/QuartzCore (compatibility version 1.2.0, current version 1.8.0)
      /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
      /System/Library/Frameworks/CoreVideo.framework/Versions/A/CoreVideo (compatibility version 1.2.0, current version 1.8.0)
      /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit (compatibility version 45.0.0, current version 1187.34.0)
      /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 57.0.0)
      /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
      /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation (compatibility version 300.0.0, current version 945.11.0)

      Considering that you get a “no frills” player when compiling mplayer and you can also use VLC I never thought it was really “worth” it to add libSDL to the build instructions just to be able to build ffplay.

      But in any case, that is how you do it :)

  42. Following the above instructions, I have no luck compiling the MPlayer
    Is it even possible to compile mplayer?

    • Yes it is. Can you elaborate as to what goes wrong and where? Do you have a complete output of your compile run?

    • It certainly should be possible to compile mplayer; people do. In fact, the “homebrew” framework on MacOS does the job so cleanly that I lost interest on this thread.

      http://mxcl.github.com/homebrew/

      “brew install mplayer” was all it took me…

      • I am aware that using homebrew will provide a working mplayer binary and it will probably be sufficient for the needs of Luk.
        It would be interesting to know if Luk just wants to be able to play media content (where I would advise using VLC instead) or to decode/encode media content (where I would advise using ffmpeg).

        • The build itself didn’t fail, but the end result, if memory serves, was not having font rendering support (onscreen display wouldn’t work), but I might be wrong. Since in the past I had followed your guide with good results, despite the time it took to properly arrange the environment (I think I also contributed a fix), I decided not to invest the time on debugging the procedure and went instead on experimenting homebrew. Time was right, my macports had gone nuts, by chance I had a window of time in which a fresh installation of macports wouldn’t go past the second package, which led me to try yet again homebrew. The framework itself had a straightforward installation, and since compiling mplayer on macports always led to an unusable build (usually onscreen display woudln’t work, or something else), I decided to give homebrew a try: the mplayer installation completed without a hitch and the binary worked as perfectly as it should.

          I’m just leaving the positive feedback of an alternative here, for those who are not willing to invest that much time on a single package that they consider indispensable on their systems…

          • Your feedback is very much welcome and showing other options of obtaining mplayer/ffmpeg is too!

            I do not have homebrew/macports on my system and thus I can only guess that a broken on-screen-display of mplayer could be the result of mplayer linking to the “wrong” freetype/fontconfig library instead of the one from X11.

            Just curious: What are you using mplayer for?

          • Yes, I suspect font support libs are usually the culprit.

            I use mplayer to watch movies/series when watching on a notebook, for instance, or whenever without an external home theater support (rarely have the time though). But mostly I can quickly check reencodings that I perform with either Handbrake or ffmpeg. No other player is that quick or convenient to respond to short and long fast forward/backward (arrows). This way I fly through a material in a matter of seconds, checking subtitle synchronism and successful video/audio rendering.

  43. HI Guys,

    I would please install libfdk_aac and libfaac using port in my mac, that because ffmpeg was built using it. Someone got it?

    • Try this:

      # next, cmake (so OpenAL can be compiled)
      cd ${CMPL}
      tar xjpf ${MES}/cmake-2.8.11.2.tar.gz
      cd cmake*
      ./configure –prefix=${TARGET}
      make -j 2 && make install

      And then a static build of OpenAL

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

      Both compilation steps should complete successfully. Then simply add the –enable-openal configure flag to ffmpeg.
      Trying to compile ffmpeg with openal-soft-1.14 or newer will fail…

    • What exactly goes wrong when you try to compile it?

      I have downloaded the source http://mediaarea.net/download/binary/mediainfo/0.7.64/MediaInfo_CLI_0.7.64_GNU_FromSource.tar.bz2 and simply executed the ./CLI_Compile.sh script which resulted in a usable binary:

      snowy@snowcrash(~/Downloads/MediaInfo_CLI_GNU_FromSource) $ ls -l MediaInfo/Project/GNU/CLI/mediainfo
      -rwxrwxr-x  1 snowy  snowy  5936276 Jul 30 08:23 MediaInfo/Project/GNU/CLI/mediainfo
      
      snowy@snowcrash(~/Downloads/MediaInfo_CLI_GNU_FromSource) $ otool -L MediaInfo/Project/GNU/CLI/mediainfo 
      MediaInfo/Project/GNU/CLI/mediainfo:
      	/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)
      	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 169.3.0)
      	/usr/lib/libstdc++.6.dylib (compatibility version 7.0.0, current version 56.0.0)
      snowy@snowcrash(~/Downloads/MediaInfo_CLI_GNU_FromSource) $ 
      

      For me to be able to help you better it would be helpful to know the steps you have tried when compiling something and what went wrong at which step.

      Personal curiosity: Is ffprobe not sufficient for your use case? What does mediainfo do better?

      • not sure why i had problems before seems to build fine now and with less dependancies that the one i normally download from their site :-)

        never tried ffprobe i will have to do that thanks for the tip and help!

  44. Hi! I’ve started to build now on Mavericks, but I still have a Mac with Mountain Lion too. I have noticed this when trying to use my build from Mavericks on Mountain Lion:

    dyld: lazy symbol binding failed: Symbol not found: ___sincos_stret
    Referenced from: /Volumes/Mavericks (iMac)/Users/mahalko/z2-myDesktop/ffmpeg
    Expected in: /usr/lib/libSystem.B.dylib

    dyld: Symbol not found: ___sincos_stret
    Referenced from: /Volumes/Mavericks (iMac)/Users/mahalko/z2-myDesktop/ffmpeg
    Expected in: /usr/lib/libSystem.B.dylib

    Trace/BPT trap: 5

    Do you have any idea why is this? I only found these differences:

    (build Mavericks)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1197.1.1)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)

    (old build Lion)
    /usr/lib/libiconv.2.dylib (compatibility version 7.0.0, current version 7.0.0)
    /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 159.1.0)
    /usr/lib/libbz2.1.0.dylib (compatibility version 1.0.0, current version 1.0.5)
    /usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.5)

    If I have to go back and build on older OS I can, but I’d rather do it in Mavericks if possible :-)

    Thanks for the help!

    • It is probably easier to build on the older Mac OS X since you already have (I hope) a build script set up :)
      Either build for each Mac OS X version specifically or build on the oldest Mac OS X version and use the binary on all later versions…

  45. Great guide, and worked first time for me on Lion (but I’m used to building for tux/win). There is one gotcha that caught me out. Its nothing to do with the scripts but is handy to be aware of. Although the builds are ‘static’ they do have some dependencies, and when I tried to run my build on another system it failed because of a missing framework. Tracking back the issue was because I had built on a system running Jack, and the other system wasn’t. Uninstalling Jack on my build system led to a ‘static’ build that was portable to a vanilla machine. One to be aware of….

    • This is correct.

      You can not build a “truly” static binary on MacOSX (see ).
      In addition, you do need to be aware of what stuff you already have on your system which may or may not be found/used by the configure run of ffmpeg.

      The idea of the guide was to be able to get a binary which is only dependent on the system but not any media de-/encoder libraries (which you would always would have to drag along in order for the binary to work in addition to “polluting” your system (unnecessarily)).
      Hence all libaries used are being compiled as static libraries so they are “included” into the binary itself.

    • Did you have any specific problems adding libbluray? I will check nevertheless if I can add libbluray to the build instructions.

      • I looked into the issue, libblurary requires libxml2 and freetype. And with freetype, I run into the same problem as with with libass:

        gcc -L/Volumes/ffmpeg-latest//lib -Wl,-dynamic,-search_paths_first -o /var/folders/fq/1bvdpl7s4k7_xrtdykx_cczw0000gn/T//ffconf.8LWfpCm4 /var/folders/fq/1bvdpl7s4k7_xrtdykx_cczw0000gn/T//ffconf.NIl4a2kL.o -lbluray -lm -lbz2 -lz -pthread
        clang: warning: argument unused during compilation: '-pthread'
        Undefined symbols for architecture x86_64:
          "_FT_Done_Face", referenced from:
              _textst_render_free in libbluray.a(textst_render.o)
          "_FT_Done_FreeType", referenced from:
              _textst_render_free in libbluray.a(textst_render.o)
          "_FT_GlyphSlot_Embolden", referenced from:
              __render_line in libbluray.a(textst_render.o)
          "_FT_GlyphSlot_Oblique", referenced from:
              __render_line in libbluray.a(textst_render.o)
          "_FT_Init_FreeType", referenced from:
              _textst_render_init in libbluray.a(textst_render.o)
          "_FT_Load_Char", referenced from:
              __render_line in libbluray.a(textst_render.o)
          "_FT_New_Face", referenced from:
              _textst_render_add_font in libbluray.a(textst_render.o)
          "_FT_Set_Char_Size", referenced from:
              __render_line in libbluray.a(textst_render.o)
          "_xmlCleanupParser", referenced from:
              _meta_parse in libbluray.a(meta_parse.o)
          "_xmlDocGetRootElement", referenced from:
              _meta_parse in libbluray.a(meta_parse.o)
          "_xmlFree", referenced from:
              __parseManifestNode in libbluray.a(meta_parse.o)
          "_xmlFreeDoc", referenced from:
              _meta_parse in libbluray.a(meta_parse.o)
          "_xmlGetProp", referenced from:
              __parseManifestNode in libbluray.a(meta_parse.o)
          "_xmlNodeGetContent", referenced from:
              __parseManifestNode in libbluray.a(meta_parse.o)
          "_xmlReadMemory", referenced from:
              _meta_parse in libbluray.a(meta_parse.o)
          "_xmlStrEqual", referenced from:
              __parseManifestNode in libbluray.a(meta_parse.o)
        ld: symbol(s) not found for architecture x86_64
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        ERROR: libbluray not found
        

        Resarching the problem it seems others have run into the same error but I could not find a solution…

        • As you can see from the beginning of each line you are missing paths to freetype2 and libxml .. Either export CFLAGS and LDFLAGS env. settings for those 2 or, even better, export full path to pkg-config prior to compiling:

          export PKG_CONFIG=“/exact/path/to/pkgconfig/binary/pkg-config”
          export PKG_CONFIG_PATH=“/path/to/pkgconfig/bindir/bin”
          export PKG_CONFIG_LIBDIR=“/path/to/pkgconfig/libdir/lib/pkgconfig”

          • Something is odd because building libxml2 and freetype work flawlessly and I can even build libbluray without any problems. Just when I execute the configure for ffmpeg everything “blows” up. The CFLAGS and LDFLAGS are set (as shown in the article) so that should not really be an issue and I can verify that I do see libbluray.a in the libs/ directory of where it should be.

            In any case I will try your suggestion and report back later if it was successful (or not :)

          • Ah .. Try with the old bluraylib release, I think 0.2.3 should work just fine .. From 0.3.0 they’ve added subtitle support and thats what makes a trouble to ffmpeg and mplayer .. You dont need sub support in that lib since mplayer will take care of subs anyway .. on Maverics MPlayer wont enable latest libbluray during compilation and if you force enable it it wont compile giving the xml errors at the end..With old bluraylib release everything is fine..

    • I have not yet tried. When libx265 first came out there was no support for it and ffmpeg (as far as I know) built their own h265 en-/decoder.

      • FFmpeg 2.2 has support for this but compiling a static build seems to be problematic. Although it works with Homebrew.

          • Oh. I thought it had both. Then I will definately need to look into this :)

        • When I do run into problems when compiling things for ffmepg, I also tend to look at how howbrew/macports/fink may have solved the problem.

  46. Tried to compile FFmpeg with libx265 (with cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DLIBTYPE=STATIC). But it doesn’t create a static build of x265
    Any guidelines for creating an OSX FFmpeg with libx265?

    • Personally, I do not like cmake much because it is a real hassle to find out how to make it build a static library. I will look into it when I get home.

    • So far, this is how you build libx265 as a static library:


      # next, libx265
      #hg clone https://bitbucket.org/multicoreware/x265
      tar xzpf ${MES}/x265-20140327.tar.gz
      cd x265
      cd source
      cmake -DCMAKE_INSTALL_PREFIX:PATH=${TARGET} -DENABLE_SHARED=NO .
      make

      And should then produce:


      snowy@snowcrash(/Volumes/ffmpeg-latest/compile/x265/source) $ make install
      [ 64%] Built target common
      [ 91%] Built target encoder
      [ 91%] Built target x265-static
      [100%] Built target cli
      Install the project...
      -- Install configuration: "Release"
      -- Installing: /Volumes/ffmpeg-latest/lib/libx265.a
      -- Installing: /Volumes/ffmpeg-latest/include/x265.h
      -- Installing: /Volumes/ffmpeg-latest/include/x265_config.h
      -- Installing: /Volumes/ffmpeg-latest/lib/pkgconfig/x265.pc
      -- Installing: /Volumes/ffmpeg-latest/bin/x265
      snowy@snowcrash(/Volumes/ffmpeg-latest/compile/x265/source) $

      Passing the –enable-libx265 flag to ffmpeg then should result in


      snowy@snowcrash(~) $ .bin/ffmpeg -codecs | grep 265
      ffmpeg version 2.2.git-snowy Copyright (c) 2000-2014 the FFmpeg developers
      built on Mar 27 2014 21:10:58 with Apple LLVM version 5.1 (clang-503.0.38) (based on LLVM 3.4svn)
      configuration: --prefix=/Volumes/ffmpeg-latest/ --as=yasm --extra-version=snowy --disable-shared --enable-static --enable-pthreads --enable-gray --enable-postproc --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-libspeex --enable-bzlib --enable-zlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libxavs --enable-libvpx --enable-libgsm --enable-libopus --enable-libtwolame --enable-openal --enable-libsoxr --enable-libfdk-aac --enable-libwavpack --enable-libutvideo --enable-libvidstab --enable-libzmq --enable-libilbc --enable-libx265 --enable-nonfree --disable-doc --enable-gpl --enable-version3
      libavutil 52. 69.100 / 52. 69.100
      libavcodec 55. 55.100 / 55. 55.100
      libavformat 55. 35.101 / 55. 35.101
      libavdevice 55. 11.100 / 55. 11.100
      libavfilter 4. 3.100 / 4. 3.100
      libswscale 2. 5.102 / 2. 5.102
      libswresample 0. 18.100 / 0. 18.100
      libpostproc 52. 3.100 / 52. 3.100
      DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (encoders: libx265 )
      snowy@snowcrash(~) $

      I hope this helps!

  47. Great! :-) Looking forward to this.

    BTW as far as I know you can only compile libx265 with cmake. But a static is possible because there are windows static binaries available. Not yet for OSX though

  48. I’m trying to build static ffmpeg with x265. But I encounter the error “x265 not found” while configuring ffmpeg.

    The error is occurring at the following command.
    gcc -Wl,-dynamic,-search_paths_first -I/usr/local/include -L/usr/local/lib -o /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.d6F8MxUY /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.s7CTCJEP.o -lm -lx265 -lbz2 -lz -pthread

    and the error message is “Undefined symbols for architecture x86_64:”

    I use cmake-2.8.12.2、ffmpeg-2.2.1、mercurial-2.9.2、pkg-config-0.28、x265 version 0.8、yasm-1.2.0

    How can I solve it?

    P.S.
    I can build shared library x265 and this build ffmpeg fine.

    • There is too little information to make a good guess as to what goes wrong. I suspect pkg-config can not find the x265 library (was it successfully built, does it provide a static library to link against?).

      Have you tried to follow the guide and built a ffmpeg binary from the current HEAD repository using a RamDisk (as to not clutter your system)?

      • Following your guide, using RamDisk, I *think* I could successfully build x265. x265 binary works fine. but I’m not sure that libx265.a is built successfully. Here’s part of ffmpeg’s config.log which related with x265.

        check_pkg_config x265 x265.h x265_encoder_encode
        pkg-config –exists –print-errors x265
        check_func_headers x265.h x265_encoder_encode -I/Volumes/Ramdisk/include -L/Volumes/Ramdisk/lib -lx265
        check_ld cc -I/Volumes/Ramdisk/include -L/Volumes/Ramdisk/lib -lx265
        check_cc -I/Volumes/Ramdisk/include -L/Volumes/Ramdisk/lib
        BEGIN /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.AFKyF5jC.c
        1 #include
        2 long check_x265_encoder_encode(void) { return (long) x265_encoder_encode; }
        3 int main(void) { return 0; }
        END /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.AFKyF5jC.c
        gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -DPIC -I/Volumes/Ramdisk//include -L/Volumes/Ramdisk//lib -std=c99 -mdynamic-no-pic -fomit-frame-pointer -fPIC -pthread -I/Volumes/Ramdisk/include -L/Volumes/Ramdisk/lib -c -o /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.F1zJVrvQ.o /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.AFKyF5jC.c
        gcc -L/Volumes/Ramdisk//lib -Wl,-dynamic,-search_paths_first -I/Volumes/Ramdisk/include -L/Volumes/Ramdisk/lib -o /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.gvAxmmeR /var/folders/qk/x9k9r6f955d75dnv5dd2rgm00000gn/T//ffconf.F1zJVrvQ.o -lx265 -lx264 -lm -lbz2 -lz -pthread
        Undefined symbols for architecture x86_64:
        “std::basic_ios<char, std::char_traits >::widen(char) const”, referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        “std::basic_ostream<char, std::char_traits >::put(char)”, referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        “std::basic_ostream<char, std::char_traits >::flush()”, referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        “std::basic_ostream<char, std::char_traits >::operator<<(int)", referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        "std::ios_base::Init::Init()", referenced from:
        global constructors keyed to ain libx265.a(api.cpp.o)
        global constructors keyed to ain libx265.a(common.cpp.o)
        global constructors keyed to ain libx265.a(TComRom.cpp.o)
        global constructors keyed to ain libx265.a(param.cpp.o)
        global constructors keyed to ain libx265.a(bitcost.cpp.o)
        global constructors keyed to ain libx265.a(encoder.cpp.o)
        global constructors keyed to ain libx265.a(primitives.cpp.o)

        "std::ios_base::Init::~Init()", referenced from:
        global constructors keyed to ain libx265.a(api.cpp.o)
        global constructors keyed to ain libx265.a(common.cpp.o)
        global constructors keyed to ain libx265.a(TComRom.cpp.o)
        global constructors keyed to ain libx265.a(param.cpp.o)
        global constructors keyed to ain libx265.a(bitcost.cpp.o)
        global constructors keyed to ain libx265.a(encoder.cpp.o)
        global constructors keyed to ain libx265.a(primitives.cpp.o)

        "std::basic_ostream<char, std::char_traits >& std::__ostream_insert<char, std::char_traits >(std::basic_ostream<char, std::char_traits >&, char const*, long)”, referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        “std::cerr”, referenced from:
        x265::ScanGenerator::GetNextIndex(unsigned int, unsigned int)in libx265.a(TComRom.cpp.o)
        “std::terminate()”, referenced from:
        x265::BitCost::setQP(unsigned int)in libx265.a(bitcost.cpp.o)
        x265::Encoder::Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::create() in libx265.a(encoder.cpp.o)

        “vtable for __cxxabiv1::__class_type_info”, referenced from:
        typeinfo for x265::TEncCfgin libx265.a(encoder.cpp.o)
        typeinfo for x265_encoderin libx265.a(encoder.cpp.o)
        typeinfo for x265::JobProviderin libx265.a(encoder.cpp.o)
        typeinfo for x265::FrameFilterin libx265.a(encoder.cpp.o)
        typeinfo for x265::TComPicYuvin libx265.a(TComPicYuv.cpp.o)
        typeinfo for x265::ThreadPoolin libx265.a(threadpool.cpp.o)
        typeinfo for x265::FrameFilterin libx265.a(framefilter.cpp.o)

        NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
        “vtable for __cxxabiv1::__si_class_type_info”, referenced from:
        typeinfo for x265::ThreadPoolImplin libx265.a(threadpool.cpp.o)
        typeinfo for x265::PoolThreadin libx265.a(threadpool.cpp.o)
        typeinfo for x265::TComBitCounterin libx265.a(framefilter.cpp.o)
        typeinfo for x265::SEIRecoveryPointin libx265.a(frameencoder.cpp.o)
        typeinfo for x265::SEIGradualDecodingRefreshInfoin libx265.a(frameencoder.cpp.o)
        typeinfo for x265::SEIDisplayOrientationin libx265.a(frameencoder.cpp.o)
        typeinfo for x265::SEIActiveParameterSetsin libx265.a(frameencoder.cpp.o)

        NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
        “vtable for __cxxabiv1::__vmi_class_type_info”, referenced from:
        typeinfo for x265::Encoderin libx265.a(encoder.cpp.o)
        typeinfo for x265::FrameEncoderin libx265.a(frameencoder.cpp.o)
        typeinfo for x265::TEncSbacin libx265.a(TEncSbac.cpp.o)
        typeinfo for x265::MotionEstimatein libx265.a(motion.cpp.o)
        NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
        “operator delete[](void*)”, referenced from:
        x265::BitCost::destroy() in libx265.a(bitcost.cpp.o)
        x265::Encoder::create() in libx265.a(encoder.cpp.o)
        x265::Encoder::destroy() in libx265.a(encoder.cpp.o)
        x265::TComPicSym::destroy() in libx265.a(TComPicSym.cpp.o)
        x265::FrameEncoder::destroy() in libx265.a(frameencoder.cpp.o)
        x265::FrameEncoder::init(x265::Encoder*, int)in libx265.a(frameencoder.cpp.o)
        x265::FrameEncoder::compressFrame() in libx265.a(frameencoder.cpp.o)

        “operator delete(void*)”, referenced from:
        _x265_encoder_open_7 in libx265.a(api.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::create() in libx265.a(encoder.cpp.o)
        x265::Encoder::destroy() in libx265.a(encoder.cpp.o)
        x265::Encoder::encode(bool, x265_picture const*, x265_picture*, x265::NALUnitEBSP**)in libx265.a(encoder.cpp.o)
        x265::FrameEncoder::~FrameEncoder()in libx265.a(encoder.cpp.o)
        non-virtual thunk to x265::FrameEncoder::~FrameEncoder()in libx265.a(encoder.cpp.o)

        “operator new[](unsigned long)”, referenced from:
        x265::BitCost::setQP(unsigned int)in libx265.a(bitcost.cpp.o)
        x265::BitCost::CalculateLogs() in libx265.a(bitcost.cpp.o)
        x265::Encoder::create() in libx265.a(encoder.cpp.o)
        x265::TComPicSym::create(int, int, int, unsigned int, unsigned int, unsigned int)in libx265.a(TComPicSym.cpp.o)
        x265::FrameEncoder::init(x265::Encoder*, int)in libx265.a(frameencoder.cpp.o)
        x265::FrameEncoder::compressFrame() in libx265.a(frameencoder.cpp.o)
        x265::TComLoopFilter::create(unsigned int)in libx265.a(TComLoopFilter.cpp.o)

        “operator new(unsigned long)”, referenced from:
        _x265_encoder_open_7 in libx265.a(api.cpp.o)
        x265::Encoder::create() in libx265.a(encoder.cpp.o)
        x265::Encoder::encode(bool, x265_picture const*, x265_picture*, x265::NALUnitEBSP**)in libx265.a(encoder.cpp.o)
        x265::TComPicSym::create(int, int, int, unsigned int, unsigned int, unsigned int)in libx265.a(TComPicSym.cpp.o)
        x265::TComPicSym::allocSaoParam(x265::TComSampleAdaptiveOffset*) in libx265.a(TComPicSym.cpp.o)
        x265::ThreadPool::allocThreadPool(int) in libx265.a(threadpool.cpp.o)
        x265::FrameEncoder::compressFrame() in libx265.a(frameencoder.cpp.o)

        “___cxa_pure_virtual”, referenced from:
        vtable for x265::Threadin libx265.a(threading.cpp.o)
        vtable for x265::WaveFrontin libx265.a(wavefront.cpp.o)
        “___dynamic_cast”, referenced from:
        x265::JobProvider::flush() in libx265.a(threadpool.cpp.o)
        “___gxx_personality_v0″, referenced from:
        _x265_encoder_open_7 in libx265.a(api.cpp.o)
        Dwarf Exception Unwind Info (__eh_frame) in libx265.a(api.cpp.o)
        Dwarf Exception Unwind Info (__eh_frame) in libx265.a(bitcost.cpp.o)
        x265::Encoder::Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)
        x265::Encoder::~Encoder()in libx265.a(encoder.cpp.o)

        ld: symbol(s) not found for architecture x86_64
        collect2: ld returned 1 exit status
        ERROR: x265 not found

        Also here’s x265.pc

        prefix=/Volumes/Ramdisk
        exec_prefix=${prefix}
        libdir=${exec_prefix}/lib
        includedir=${prefix}/include

        Name: x265
        Description: H.265/HEVC video encoder
        Version: 0.8
        Libs: -L${libdir} -lx265
        Libs.private: -lstdc++ -l/usr/lib/clang/4.2/lib/darwin/libclang_rt.osx.a
        Cflags: -I${includedir}

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s