The encoding/decoding media libraries are built as static libraries so that ffmpeg/mplayer do not have unneceesary runtime dependencies.
What you need before you start:
- some patience
- MacOSX
- Xcode
- yasm-1.1.0.tar.gz
- lame-398-2.tar.gz
- faad2-2.7.tar.bz2
- faac-1.28.tar.bz2
- xvidcore-1.2.1.tar.gz
- x264-snapshot-20090312-2245.tar.bz2
- libogg-1.1.3.tar.gz
- libvorbis-1.2.0.tar.gz
- libtheora-1.0.tar.bz2
- gsm-1.0.12.tar.gz
- Media encoder/decoder
- ffmpeg-0.5.tar.bz2
- mplayer-export-snapshot.tar.bz2
To begin with, create a 512MB Ramdisk
$ DISK_ID=$(hdid -nomount ram://26214400)
$ newfs_hfs -v Ramdisk ${DISK_ID}
$ diskutil mount ${DISK_ID}
Set up some shortcuts (MES is where all the archives are stored)
$ MES=/Users/snowy/tmptmp/mediaencoding/
$ TARGET="/Volumes/Ramdisk/sw"
$ CMPL="/Volumes/Ramdisk/compile"
Setup target directories
$ mkdir ${TARGET}
$ mkdir ${CMPL}
Add the target bin/ directory to the $PATH
$ export PATH=${TARGET}/bin:$PATH
Build yasm
$ cd ${CMPL} || exit 1
$ tar xzpf ${MES}/yasm-1.1.0.tar.gz
$ cd yasm-1.1.0
$ ./configure --prefix=${TARGET} && make -j 4 && make install
Build OpenCoreamr
$ cd ${CMPL}
$ tar xjpf ${MES}/opencore-amr-0.1.2.tar.gz
$ cd opencore-amr-0.1.2
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build ORC
$ cd ${CMPL}
$ tar xjpf ${MES}/orc-0.4.11.tar
$ cd orc-0.4.11
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build schroederinger
$ cd ${CMPL}
$ tar xjpf ${MES}/schroedinger-1.0.10.tar.gz
$ cd schroedinger-1.0.10
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build libvpx
$ cd ${CMPL}
$ tar xjpf ${MES}/libvpx-v0.9.5.tar.bz2
$ cd libvpx-v0.9.5
$ ./configure --prefix=${TARGET} --disable-shared && make -j 4 && make install
Build lame
$ cd ${CMPL}
$ tar xzpf ${MES}/lame-3.98.4.tar.gz
$ cd lame-3.98.4
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build FAAD
$ cd ${CMPL}
$ tar xjpf ${MES}/faad2-2.7.tar.bz2
$ cd faad2-2.7
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build FAAC
$ cd ${CMPL}
$ tar xjpf ${MES}/faac-1.28.tar.bz2
$ cd faac-1.28
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build xvidcore and remove the dynamic library
$ cd ${CMPL}
$ tar xzpf ${MES}/xvidcore-1.2.1.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
Build x264
$ cd ${CMPL}
$ tar xjpf ${MES}/x264-snapshot-20101231-2245.tar.bz2
$ cd x264-snapshot-20101231-2245
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build ogg
$ cd ${CMPL}
$ tar xzpf ${MES}/libogg-1.2.2.tar.gz
$ cd libogg-1.2.2
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build vorbis - OK
$ cd ${CMPL}
$ tar xzpf ${MES}/libvorbis-1.3.2.tar.gz
$ cd libvorbis-1.3.2
$ ./configure --prefix=${TARGET} --with-ogg-libraries=${TARGET}/lib --with-ogg-includes=/Volumes/Ramdisk/sw/include/ --enable-static --disable-shared && make -j 4 && make install
Build Theora
$ cd ${CMPL}
$ tar xjpf ${MES}/libtheora-1.1.1.tar.bz2
$ cd libtheora-1.1.1
$ ./configure --prefix=${TARGET} --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 4 && make install
Build Speex
$ cd ${CMPL}
$ tar xjpf ${MES}/speex-1.2rc1.tar.gz
$ cd speex-1.2rc1
$ ./configure --prefix=${TARGET} --disable-shared --enable-static && make -j 4 && make install
Build GSM (Notice: I cheat by using fixed strings in the sed commands and the sed used is gnu sed 4.1.5)
$ 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
$ sed "s/^INSTALL_ROOT.*$/INSTALL_ROOT=\/Volumes\/Ramdis\/sw\//g" -i Makefile
$ sed "s/_ROOT)\/inc/_ROOT)\/include/g" -i Makefile
$ make -j 4
$ make install
Up to here, the compilation path for ffmpeg and mplayer is the same. Either comile ffmpeg or mplayer after the above steps.
Compiling ffmpeg
$ cd ${CMPL}
$ tar xjpf ${MES}/ffmpeg.tar.bz2
$ cd ffmpeg
$ export LDFLAGS="-L${TARGET}/lib"
$ export CFLAGS="-I${TARGET}/include"
$./configure --prefix=${TARGET} --enable-gpl --enable-pthreads --enable-version3 --enable-libspeex --enable-libvpx --disable-decoder=libvpx --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-avfilter --enable-libopencore_amrwb --enable-libopencore_amrnb --enable-filters --arch=x86 --enable-runtime-cpudetect && make -j 4 && make install
A working ffmpeg binary is available in the BIN folder.