Building FFMpeg 2.5.3 on Debian 7.8 i686

This guide will describe how to build the last FFmpeg 2.5.3 on Debian 7.8 with i686 architecture with custom install prefix both for FFmpeg and external libraries. In order to keep your system clear, FFmpeg will be compiled and installed in /opt/ffmpeg prefix, and will have all dependencies enabled using only libraries from official Debian repository with some needful libraries. Only x264, x265 and libaacplus will be added using the last version of sources from the last tarball release or the last commit in official CVS repositories.

In order to ensure that all copy and/or install commands have writing access to /opt directory, every “make install” command should be launched as root. Another solution is to create the destination directory by hand, change ownership to the building user, launch “make install” and finally re-change ownership to root. But the first is easier.

First of all you will need to install all compiling and repository tools using apt-get. You can copy/paste this command:

After that, you have to install all dependencies from official repository (both libraries and headers). Again, you can copy/paste the command:

Now you have to download official source archive. If you have problems with sources link you can browse the official FFmpeg site at and choose the last archive available. This guide will mostly work with all 2.5.x versions.

Now we need to prepare all external libraries. We start downloading sources using wget, git and mercurial. The first one is a tarball archive, so you have to extract it. The last two command directly create 2 directories with all sources inside.

In order to build x264 and x265 you will need a modern Yasm Modular Assembler. The version shipped with Debian official packages is too old (version 1.1.0), and we need YASM to be at least version 1.2.0. So we need to download and updated version on YASM and compile it.

After that you can build x264 video encoder. Enter in “x264” directory and launch these commands. You have to prepend PATH environment variable in order to override default system path and ensure that configure script will use our fresh YASM installation. I prefer to prepend PATH in each command instead exporting it globally.

Now we have to build x265. Move to the right build folder and launch the configuration script using cmake. After that use the classical “make && make install”.

We continue building the last external library. Unpack libaacplus sources, enter in directory and build it. Have a look to the with-fftw3-prefix parameter. In Debian most of the libraries are installed in a arch-dependent directory, so you have to put the right folder based on your architecture. The most used are i386-linux-gnu and x86_64-linux-gnu. Remember to add the trailing slash at the end of the path.

All external libraries are done. Now, in order to let FFmpeg configure script to find the right external libraries, you need to prepare some environment variables. I prefer to prepare a script which do all the work and contains all configuration flags.

Now we need to launch classical “make && make install”

We are just one step from the end.

FFmpeg need to find all external libraries in order to be launched, and our libraries are installed using a custom prefix, with different directories inside /opt. I suggest to prepare an environment script which sets all variables needed, ready to be launched before calling ffmpeg command. Put it on /opt/ffmpeg/

Now, to launch FFmpeg from shell you can use these commands:

Now enjoy your fresh FFmpeg in your Debian.