FFmpeg/Installation
If FFmpeg is not shipped, we may have to build it from source. The FFmpeg wiki has a really good compilation guide[1] and it's a good advice to follow it, since there are quite a few dependencies to build first. Here's the short version for some distributions.
Note: we will install each dependency in its own directory!
Linux
yum install autoconf automake gcc gcc-c++ git libtool make nasm pkgconfig zlib-devel # Fedora apt-get install autoconf automake gcc g++ git libtool make nasm pkg-config zlib1g-dev # Debian, Ubuntu
Instead of running "make install" as root every time, we temporarily allow ourselves to write to our installation directory:
sudo setfacl -m u:$USER:rwx /opt
yasm
git clone git://github.com/yasm/yasm.git yasm-git cd yasm-git ./configure --prefix=/opt/x264 --enable-static && make && make install sudo ln -s /opt/yasm/bin/yasm /usr/local/bin/yasm
x264
git clone --depth 1 git://git.videolan.org/x264 x264-git cd x264-git ./configure --prefix=/opt/x264 --enable-static && make && make install
libfdk_aac
git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac fdk-aac-git cd fdk-aac-git autoreconf -fiv && ./configure --prefix=/opt/libfdk-aac --disable-shared && make && make install
libmp3lame
cvs -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame login cvs -z3 -d:pserver:anonymous@lame.cvs.sourceforge.net:/cvsroot/lame co -P lame mv lame lame-cvs && cd lame-cvs ./configure --prefix=/opt/lame --disable-shared --enable-nasm && make && make install
libopus
git clone git://git.xiph.org/opus.git opus-git cd opus-git ./autogen.sh && ./configure --prefix=/opt/libopus --disable-shared && make && make install
libogg
git clone git://git.xiph.org/mirrors/ogg.git libogg-git cd libogg-git ./autogen.sh && ./configure --prefix=/opt/libogg --disable-shared && make && make install
libvorbis
git clone git://git.xiph.org/mirrors/vorbis.git vorbis-git cd vorbis-git PKG_CONFIG_PATH=/opt/libogg/lib/pkgconfig ./autogen.sh --prefix=/opt/libvorbis --with-ogg=/opt/libogg --disable-shared && make && make install
libtheora
git clone git://git.xiph.org/mirrors/theora.git theora-git cd theora-git PKG_CONFIG_PATH=/opt/libogg/lib/pkgconfig ./autogen.sh --prefix=/opt/libtheora --with-ogg=/opt/libogg --disable-examples --disable-shared --disable-sdltest --disable-vorbistest && make && make install
libvpx
git clone --depth 1 http://git.chromium.org/webm/libvpx.git libvpx-git cd libvpx-git ./configure --prefix=/opt/libvpx --disable-examples && make && make install
xvidcore
Xvid does indeed provide access to their SVN server[2]:
svn co --username anonymous --password "" http://svn.xvid.org/trunk/xvidcore xvidcore-svn cd xvidcore-svn/build/generic
If this is not working, get their latest snapshot:
wget http://downloads.xvid.org/downloads/xvid_latest.tar.gz tar -xjf xvid_latest.tar.gz cd xvid_*/trunk/xvidcore/build/generic ./configure --prefix=/opt/xvidcore && make && make install
ffmpeg
Now we can build FFmpeg:
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg-git cd ffmpeg-git
Since we installed every dependecy in its own directory we have to create our build flags first:
export INCDIR="-I`echo /opt/{x264,lame,libfdk-aac,libfdk-aac,libopus,libogg,libvorbis,libvpx,libtheora,xvidcore}/include | sed 's/ / -I/g'`" export LIBDIR="-L`echo /opt/{x264,lame,libfdk-aac,libfdk-aac,libopus,libogg,libvorbis,libvpx,libtheora,xvidcore}/lib | sed 's/ / -L/g'`"
Of course, it would be easier to just install the distributions packages:
sudo apt-get install yasm libfdk-aac-dev libmp3lame-dev libopus-dev libtheora-dev libvorbis-dev libvpx-dev libx264-dev libxvidcore-de sudo yum install yasm libtheora-devel libvpx-devel opus-devel
As our TMPDIR was mounted noexec, we have to use another directory:
mkdir tmp TMPDIR=$PWD/tmp ./configure --prefix=/opt/ffmpeg --extra-cflags="$INCDIR" --extra-ldflags="$LIBDIR" --extra-libs="-ldl" --enable-gpl --enable-nonfree --enable-libvpx --enable-libx264 --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libtheora --enable-libxvid make && make install
Correct the permissions again:
sudo setfacl -x u:$USER /opt sudo chown -R root:root /opt/{yasm,x264,libfdk-aac,lame,libopus,libogg,libvorbis,libvpx,libtheora,ffmpeg}
MacOS
With macports:
port install yasm port install x264 +asm configure.compiler=llvm-gcc-4.2 port install ffmpeg