You must have Xcode installed with Unix Tools. Xcode 3 is available for free via Apple Developer Center. However, Xcode 4 is available through the App Store (free for Lion users).
# Create a temporary directory for sources.
SOURCES=$(mktemp -d /tmp/XXXXXXXXXX)
cd $SOURCES
# Unpack files
for file in `ls ${SOURCES}/*.tar.*`; do
tar -xzf $file
rm $file
done
cd faac-*/
CFLAGS="-D__unix__" ./configure && make -j 4 && sudo make install; cd ..
cd lame-*/
./configure && make -j 4 && sudo make install; cd ..
cd libogg-*/
./configure && make -j 4 && sudo make install; cd ..
cd pkg-config-*/
./configure && make -j 4 && sudo make install; cd ..
cd libvorbis-*/
./configure --disable-oggtest --build=x86_64 && make -j 4 && sudo make install; cd ..
cd libtheora-*/
./configure --disable-oggtest --disable-vorbistest --disable-examples --disable-asm
make -j 4 && sudo make install; cd ..
# cd vo-amrwbenc-*/
# ./configure && make -j 4 && sudo make install; cd ..
cd yasm-*/
./configure && make -j 4 && sudo make install; cd ..
cd libvpx-*/
./configure --enable-vp8 --enable-pic && make -j 4 && sudo make install; cd ..
cd x264-*
CFLAGS="-I. -fno-common -read_only_relocs suppress" ./configure --enable-pic --enable-shared && make -j 4 && sudo make install; cd ..
cd xvidcore/build/generic
./configure --disable-assembly && make -j 4 && sudo make install; cd ../../..
# For Lion, we have to change which compiler to use (--cc=clang).
# If you're building on Snow Leopard, you can omit this flag so it defaults to gcc.
cd ffmpeg-*/
CFLAGS="-DHAVE_LRINTF" ./configure --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaac --enable-libxvid --enable-libx264 --enable-libvpx --enable-hardcoded-tables --enable-shared --enable-pthreads --disable-indevs --cc=clang && make -j 4 && sudo make install
# --enable-libvo-amrwbenc
# FFMpeg creates MP4s that have the metadata at the end of the file.
# This tool moves it to the beginning.
cd tools
gcc -D_LARGEFILE_SOURCE qt-faststart.c -o qt-faststart
sudo mv qt-faststart /usr/local/bin