FFmpeg is collection of libraries and programs to handle multi media data. It is used in programs like VLC, Cindarella, and others. The project is OpenSource and the software is for free. This article describes how to build and install FFmpeg from source code.
1. What is the advantage to install FFmpeg from source?
First, you get the most recent version. Then you have access to formats which are not delivered by the default packages of your Linux distribution for some difficult legal issues. On the other hand this method will deeply change your system.
2. Uninstall packages
First we have to ensure that none of those packages are already installed yet.
Take care: Apt will ask you, if you want to remove the packages, it is possible (probably) that other programs have dependencies and will be also removed. All these programs you should write down for security reasons. In case of loss you could easily get them back again.
sudo apt-get purge ffmpeg x264 libx264-dev libvpx-dev libmp3lame-dev
3. Programs, needed for the Building
sudo apt-get install build-essential git-core checkinstall yasm texi2html libfaac-dev libjack-jackd2-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev libxvidcore-dev zlib1g-dev nasm
4. Compile Tools and Codecs
4.1. x264
git clone git://git.videolan.org/x264.git cd x264 ./configure --enable-shared make sudo checkinstall --pkgname=x264 --pkgversion "2:0.`grep X264_BUILD x264.h -m1 | cut -d' ' -f3`.`git rev-list HEAD | wc -l`+git`git rev-list HEAD -n 1 | head -c 7`" --backup=no --default --deldoc=yes
4.2. Theora
svn checkout http://svn.xiph.org/trunk/theora cd theora ./autogen.sh ./configure make sudo checkinstall --pkgname=theora --pkgversion=`sed -n '/PACKAGE_VERSION/s/^.*"\(.*\)".*$/\1/p' config.h` --default
4.3. Yasm
sudo apt-get build-dep yasm svn co http://www.tortall.net/svn/yasm/trunk/yasm cd yasm ./autogen.sh ./configure make sudo checkinstall --pkgname=yasm --pkgversion="1.0.1~checkinstall" --default
4.4. Lame
wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz tar xzvf lame-3.98.4.tar.gz cd lame-3.98.4 ./configure --enable-nasm --disable-shared make sudo checkinstall --pkgname=lame-ffmpeg --pkgversion="3.98.4" --backup=no --default --deldoc=yes
5. FFmpeg
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg cd ffmpeg ./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-x11grab make sudo checkinstall --pkgname=ffmpeg --pkgversion="5:$(date +%Y%m%d%H%M)-git" --backup=no --deldoc=yes --fstrans=no --default hash x264 ffmpeg ffplay