This is tested on Mac OS 10.6.7 (a Mac Book Pro and a Mac Mini)
Get essential build environment
Install Xcode 3 - you don't need to spend $5 on Xcode 4
xcode_3.2.6_and_ios_sdk_4.3.dmg
Install
MacPorts
MacPorts-1.9.2-10.6-SnowLeopard.dmg
Behind a firewall
If you cannot rsync, for instance if you're in a corporation where its hard to get through firewalls, then edit /opt/local/etc/macports/sources.conf replacing the default entry at the end of the file
sudo vim /opt/local/etc/macports/sources.conf
[...]
#rsync://rsync.macports.org/release/ports/ [default]
http://www.macports.org/files/ports.tar.gz [default]
Then, If your corporation has an HTTP proxy server, you might need to set the http_proxy environment variable before 'port' or 'curl' commands, like this:
sudo http_proxy=http://www-cache.reith.bbc.co.uk:80 \
/opt/local/bin/port -d sync
or
http_proxy=http://www-cache.reith.bbc.co.uk:80 curl -O http://someFile
Sync the
MacPorts sources, as I have done in this example:
sudo /opt/local/bin/port -d sync
Get tools to build the source
sudo /opt/local/bin/port install \
yasm git-core exi2html
Behind a socks proxy server?
To access source files for building parts of FFmpeg, git might need access through a SOCKS proxy:
sudo /opt/local/bin/port install tsocks
copy the sample tsocks.conf
sudo cp -a /opt/local/etc/tsocks.conf.sample /opt/local/etc/tsocks.conf
and edit /opt/local/etc/tsocks.conf. For example, in a corporation you might need to add something like:
local = 132.0.0.0/255.0.0.0
to the local block near the top and change server and server_port to
server = 132.185.136.18
server_port = 1085
tordns_enable = false
Then, when you have to do a 'git clone' or a 'git pull' do this instead:
tsocks git clone git://
OR
tsocks git pull --rebase
Get pre-built libraries
sudo /opt/local/bin/port install \
dirac faac jpeg libdc1394 libsdl libtheor libvorbis speex-devel \
openjpeg schroedinger Xvid
Build other libraries
Decide and create the place where you are going to do all your building, and set an environment variable so that it is easy to script the install:
export PREFIX=/usr/local
sudo mkdir $PREFIX/src
sudo chgrp staff $PREFIX/src
sudo chmod g+w $PREFIX/src
libxavs
cd $PREFIX/src
svn co https://xavs.svn.sourceforge.net/svnroot/xavs/trunk xavs
cd xavs
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure --prefix=$PREFIX
PATH=$PATH:/opt/local/bin/ make
sudo make install
lame-398-4
cd $PREFIX/src
Download the file from
http://sourceforge.net/projects/lame/files/lame/3.98.4/lame-3.98.4.tar.gz
curl -v -L -o lame-3.98.4.tar.gz "http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz?r=http%3A%2F%2Fmdsh.com%2Fwiki%2Fjsp%2FWiki%3FOSX%3AbuildFFmpeg&ts=1309343584&use_mirror=kent"
Then build:
tar -zxf lame-3.98.4.tar.gz
cd lame-3.98.4/
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure
PATH=$PATH:/opt/local/bin/ make
sudo make install
libgsm
cd $PREFIX/src
curl -O http://libgsm.sourcearchive.com/downloads/1.0.13-3/libgsm_1.0.13.orig.tar.gz
tar -zxf libgsm_1.0.13.orig.tar.gz
cd gsm-1.0-pl13/
Edit Makefile to set 'INSTALL_ROOT' to $PREFIX.
vim Makefile
[...]
INSTALL_ROOT = $PREFIX
make the library
PATH=$PATH:/opt/local/bin/ make
Then, install like this...
libtool -dynamic -v -o lib/libgsm.1.0.13.dylib -install_name $PREFIX/lib/libgsm.1.0.13.dylib -compatibility_version 1.0.13 -current_version 1.0.13 -lc lib/libgsm.a
chmod 644 lib/libgsm.a
chmod 644 lib/libgsm.1.0.13.dylib
sudo /usr/bin/install -c lib/libgsm.a $PREFIX/lib/libgsm.a
sudo /usr/bin/install -c lib/libgsm.1.0.13.dylib $PREFIX/lib/libgsm.1.0.13.dylib
sudo /usr/bin/install -d $PREFIX/include/gsm
sudo /usr/bin/install -c inc/gsm.h $PREFIX/include/gsm/gsm.h
libx264
cd $PREFIX/src
PATH=$PATH:/opt/local/bin/ \
git clone git://git.videolan.org/x264.git
cd x264
OR
cd x264
PATH=$PATH:/opt/local/bin/ \
git pull --rebase
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure \
--prefix=$PREFIX \
--enable-shared
PATH=$PATH:/opt/local/bin/ \
make
sudo make install
libvpx
cd $PREFIX/src
PATH=$PATH:/opt/local/bin/ \
git clone git://review.webmproject.org/libvpx.git
cd libvpx
OR
cd libvpx
PATH=$PATH:/opt/local/bin/ \
git pull --rebase
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure \
--prefix=$PREFIX
PATH=$PATH:/opt/local/bin/ verbose=yes \
make
sudo make install
FFmpeg
cd $PREFIX/src
PATH=$PATH:/opt/local/bin/ \
git clone git://git.videolan.org/ffmpeg.git
cd ffmpeg
OR
cd ffmpeg
PATH=$PATH:/opt/local/bin/ \
git pull --rebase
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure \
--extra-cflags="-I$PREFIX/include -I/opt/local/include" \
--extra-libs="-L$PREFIX/lib -L/opt/local/lib -mmacosx-version-min=10.5" \
--prefix=$PREFIX \
--enable-ffplay \
--enable-ffprobe \
--enable-ffserver \
--enable-shared \
--disable-indev=jack \
--enable-gpl \
--enable-nonfree \
--enable-pthreads \
--enable-libdc1394 \
--enable-libdirac \
--enable-libfaac \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libschroedinger \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxavs \
--enable-libxvid
PATH=$PATH:/opt/local/bin/ \
make
sudo make install
FFmbc
Fairly similar to FFmpeg:
cd $PREFIX/src
curl -O http://ffmbc.googlecode.com/files/FFmbc-0.6-rc7.tar.gz
tar -zxf FFmbc-0.6-rc7.tar.gz
cd FFmbc-0.6-rc7
PKG_CONFIG_PATH=/opt/local/lib/pkgconfig/ \
PATH=$PATH:/opt/local/bin/ \
./configure \
--extra-cflags="-I$PREFIX/include -I/opt/local/include" \
--extra-libs="-L$PREFIX/lib -L/opt/local/lib -mmacosx-version-min=10.5" \
--prefix=$PREFIX \
--enable-ffplay \
--enable-ffprobe \
--enable-ffserver \
--enable-shared \
--disable-indev=jack \
--enable-gpl \
--enable-nonfree \
--enable-pthreads \
--enable-libdirac \
--enable-libfaac \
--enable-libgsm \
--enable-libmp3lame \
--enable-libopenjpeg \
--enable-libschroedinger \
--enable-libspeex \
--enable-libtheora \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libxavs \
--enable-libxvid
PATH=$PATH:/opt/local/bin/ \
make
sudo make install
It appears that --enable-libdc1394 does not work with FFmbc0.6rc6.
OSX:buildFFmpeg is mentioned on: OSX