User Tools

Site Tools


Building FFmpeg on Linux


This guide aims to provide the details on building the latest version of FFmpeg from source on Linux (as well as some other important dependencies) with the aim to provide the best support for Serviio; it is adapted from this guide and assumes that APT is the package manager of choice. This can likely be adapted to build FFmpeg on Windows using Cygwin or MinGW.


2nd June 2013

*Updated to cover x264 requirements in Serviio 1.3
*Moved libvpx to optional section at the end
*Removed yasm from the initial apt-get install list seeing as its now built from source

26th March 2013

*Update to cover libass and yasm 1.2 for Serviio 1.2

Build Procedure

The below process is written by Serviio users. It will replace all existing libraries and tools with the new ones.

You can also follow a guide supplied by FFmpeg developers themselves, which will instead build ffmpeg in an isolated location. If you do this, you will need to use the ffmpeg.location system property to tell Serviio which ffmpeg binary to use e.g. add


to bin/

Remove Existing Versions of Packages

The first step to ensuring a good install of FFmpeg is to remove any exisiting installations of the libraries and utilities which will be built from source throughout this guide to ensure that there are no conflicts which can lead to problems which are difficult to diagnose:

On some Linux systems (i.e. Ubuntu), removing librtmp0 will cause half the system to uninstall and do irreparable damage. If you get asked to remove ~500MB of software when running the command above, remove librtmp0 from the command above and re-run it.

sudo apt-get remove ffmpeg x264 libx264-dev libvpx-dev librtmp0 librtmp-dev

Install Essential Build Tools and Libraries

There are several tools and libraries required to build the software in this guide. Much of this software should be available in the repositories for your Linux distribution and can be installed this way:

sudo apt-get update
sudo apt-get install build-essential checkinstall git 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 texi2html zlib1g-dev \
  libssl1.0.0 libssl-dev libxvidcore-dev libxvidcore4 libass-dev


Yasm is an assembler and is recommended for x264 and FFmpeg. Version 1.2 is required to build the latest x264 and FFmpeg sources.

cd ~
mkdir src
cd src
tar xzvf yasm-1.2.0.tar.gz
cd yasm-1.2.0
sudo checkinstall --pkgname=yasm --pkgversion="1.2.0" --backup=no \
  --deldoc=yes --fstrans=no --default

Build and Install x264

x264 is one of the most popular implementations of the H.264 video compression algorithm which is used to compress video on blu-ray discs and is often the codec of choice for distributing high definition content on the internet. FFmpeg supports using the x264 library to compress video content.

x264 is required for streaming to iOS devices using MediaBrowser, and for the Enhanced profile option in ServiiGo.

To acquire and build x264, perform the following:

cd ~/src
git clone git://
cd x264
./configure --enable-static
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./ | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default

NOTE: New version of x264 contains by default support of OpenCL. If not installed or without sense (example Ubuntu 12.04LTS on VMWare) add to configure additional option –disable-opencl.

./configure --disable-opencl

Without this option ffmpeg could not be configured (ERROR: libx264 not found).

Build and Install librtmp

librtmp provides support for the RTMP content streaming protocol developed by Adobe and commonly used to distribute content to flash video players on the web. FFmpeg supports using the librtmp library to stream content from RTMP sources. To acquire and build librtmp, perform the following:

cd ~/src
git clone git://
cd rtmpdump
make SYS=posix
sudo checkinstall --pkgname=rtmpdump --pkgversion="2:$(date +%Y%m%d%H%M)-git" --backup=no \
    --deldoc=yes --fstrans=no --default

Build and Install FFmpeg

It is now time to build FFmpeg:

This guide uses latest FFmpeg source, Serviio is tailored to work with a certain version though - the source can be downloaded at
There have been a number of reports that you must use the version of FFmpeg source that is provided on the Serviio download page on Ubuntu if you want Http Live Streaming to work (required for MediaBrowser iOS and ServiiGo Enhanced profiles).

cd ~/src

To use the lastest version of ffmpeg

git clone --depth 1 git://

Else, to use the version that Serviio ships with

tar xvf ffmpeg-N-54096-ge41bf19.tar.gz


cd ffmpeg
./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb \
    --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 \
    --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-librtmp \
    --enable-libxvid --enable-libass
sudo checkinstall --pkgname=ffmpeg --pkgversion="99:$(date +%Y%m%d%H%M)-git" --backup=no \
  --deldoc=yes --fstrans=no --default

Optional Libraries

Additional libraries that aren't used by Serviio. You may want them if you use other software that uses ffmpeg.

Build and Install libvpx

libvpx is an emerging open video compression library which is gaining popularity for distributing high definition video content on the internet. FFmpeg supports using the libvpx library to compress video content (although Serviio does not). To acquire and build libvpx, perform the following:

cd ~/src
git clone
cd libvpx
sudo checkinstall --pkgname=libvpx --pkgversion="1:$(date +%Y%m%d%H%M)-git" --backup=no \
    --deldoc=yes --fstrans=no --default

Now rebuild ffmpeg by following the above steps except add


to the long ./configure command

Add Additional Support to x264 (Lavf)

Now that FFmpeg is built and installed, it is a good idea to re-configure and rebuild x264 to add additional functionality; see here for more information:

sudo apt-get remove x264
cd ~/src/x264
rm *.deb
make distclean
./configure --enable-static
sudo checkinstall --pkgname=x264 --pkgversion="3:$(./ | \
    awk -F'[" ]' '/POINT/{print $4"+git"$5}')" --backup=no --deldoc=yes \
    --fstrans=no --default


At this point, FFmpeg is installed and Serviio should now use the newly built version. Please visit the forum if you need assistance with this guide.


If you receive error:
ffmpeg: error while loading shared libraries: cannot open shared object file: No such file or directory

Then do as follows

sudo nano /etc/

Add the following line to the file

include /usr/local/lib/

Save the file

Now enter


Now reboot machine

build_ffmpeg_linux.txt · Last modified: 2015/01/22 16:19 by pcfascst