A Robust FFMPEG Install for CentOS 5

A little while back, I posted a basic install of ffmpeg for CentOS 5. After working with that build over the last month, I found I needed to expand it to include many different video codecs. Because of licensing restrictions, binaries of the build cannot be distributed. However, instructions for a similar build can! I spent several days (or more) researching the packages I would need and I must have combed dozens of blogs to find this information. The build I made strips sound from videos [See update at the end of this post for more information on this subject], this decreases the final file size. If you need sound, you will not want to follow these steps exactly. I also stripped ffserver and ffplay from my build.

These packages were executed in the following order. I cannot say for certain this exact order must be followed, it was the order in which ffmpeg threw the errors. This tutorial assumes you have wget, bzip2, tar and subversion installed on your system. If you do not, please find and install the lastest versions of these utilities for CentOS 5. Additionally, I have allowed all packages to install into their default directories, typically this is /usr/local/[bin | lib]. If at any point during the process of a ‘make’ you run into errors, be sure and run ‘make clean’ before running ‘make’ again. You will either need root access of su access to install ffmpeg. The marker ‘codec:$’ is my prompt, it is merely to indicate separate commands.

Getting Started


codec:$
codec:$ mkdir -p ./tmp/ffmpeg-packages
codec:$ cd ./tmp/ffmpeg-packages

Installing a52


codec:$ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
codec:$ tar -zxf a52dec-0.7.4.tar.gz
codec:$ cd a52dec-0.7.4
codec:$ ./configure --enable-shared=PKGS
codec:$ make && make install
codec:$ cd ..

Installing FAAD2


codec:$ wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
codec:$ tar zxf faad2-2.6.1.tar.gz
codec:$ cd faad2
codec:$ autoreconf -vif
codec:$ ./configure --disable-drm --disable-mpeg4ip
codec:$ make && make install
codec:$ cd ..

Installing FAAC


codec:$ wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
codec:$ tar zxfv faac-1.26.tar.gz
codec:$ cd faac
codec:$ ./bootstrap
codec:$ ./configure --disable-mp4v2
codec:$ make && make install
codec:$ cd ..

Installing LAME


codec:$ wget \
http://superb-east.dl.sourceforge.net/sourceforge/lame/\
lame-3.98b8.tar.gz
codec:$ tar zxfv lame-3.98b8.tar.gz
codec:$ cd lame-3.98b8
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing yasm

YASM is a modular assembler, it is required by the x264 package.


codec:$ wget \
http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
codec:$ tar zfvx yasm-0.7.0.tar.gz
codec:$ cd yasm-0.7.0
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing x264
The x264 package is under git revision control, which is much like CVS or SVN. Thankfully, they provide daily tarballs. I grabbed this one:


codec:$ wget \
ftp://ftp.videolan.org:21//pub/videolan/x264/snapshots/\
x264-snapshot-20080513-2245.tar.bz2

I just did a little exploring via an FTP program to find the snapshot I was after. If you are feeling adventurous, download git and try checking out the latest version from their repository.


codec:$ bzip2 -d x264-snapshot-20080513-2245.tar.bz2
codec:$ tar xfv x264-snapshot-20080513-2245.tar
codec:$ cd x264-snapshot-20080513-2245
codec:$ ./configure --enable-mp4-output --enable-shared --enable-pthread
codec:$ make && make install
codec:$ cd ..

Installing Xvid


codec:$ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
codec:$ tar zxfv xvidcore-1.1.3.tar.gz
codec:$ cd xvidcore-1.1.3/build/generic
codec:$ ./configure
codec:$ make && make install
codec:$ cd ../../..

Installing libraw1394


codec:$ wget http://www.linux1394.org/dl/libraw1394-1.3.0.tar.gz
codec:$ tar zxfv libraw1394-1.3.0.tar.gz
codec:$ cd libraw1394-1.3.0
codec:$ ./configure
codec:$ make dev
codec:$ make && make install
codec:$ cd ..

Installing libdc1394

This project requires libraw1394, you must build it first. This project is a little confusing there is both a libdc1394 and a libdc1394-2. I have only installed the former. Visit Sourceforge here. I grabbed the tarball here:


codec:$ wget \
http://superb-west.dl.sourceforge.net/sourceforge/libdc1394/\
libdc1394-1.2.2.tar.gz
codec:$ tar zxfv libdc1394-1.2.2.tar.gz
codec:$ cd libdc1394-1.2.2
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing ffmpeg

For FFMPEG, you will need to get the latest out of SVN. FFMPEG doesn’t ever make releases. To do so, run:


codec:$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
codec:$ cd ffmpeg


codec:$ ./configure --enable-gpl --enable-postproc --enable-nonfree --enable-postproc --enable-libfaad --enable-swscale --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libdc1394 --enable-liba52 --enable-libfaac --disable-ffserver --disable-ffplay
codec:$ make
codec:$ make install

It usually takes at least 5 mins for ‘make’ to run, be sure you have a good file before attempting to install. You will need to be sure and run the ldconfig setting if you have to re-compile, otherwise ffmpeg will throw an error that it cannot find library files. Here is a good resource for using ffmpeg.

Post-Installation Actions

After the install in complete, you may need to add the /usr/local/lib directory to your ld.so.config file. Do the following:


codec:$ cd /etc/
codec:$ cd ld.so.conf.d
codec:$ vi ffmpeg.conf

You need to add ‘/usr/local/lib’ [sans-quotes] to this file and save it. Press Esc, :, x to do so in vi. Afterwords you need to run the following from the commandline


codec:$ ldconfig

That’s it, you now have a fairly robust build of ffmpeg that can take almost anything you can throw at it. Sadly, licensing restrictions prevent binaries from being made of the above steps. Happy (video) encoding!

Update: This build doesn’t actually strip sound from videos, I am doing that with a flag when I run ffmpeg, however, it should be noted that all the audio codecs you may find in many common video formats may not be supported in this build of ffmpeg, which is why I am choosing to strip audio entirely from videos.

6 Responses to “A Robust FFMPEG Install for CentOS 5”


  1. 1 Maxim

    Thanks for this fine tutorial Gregory. Worked for me except one error with x264. During its “make” I got:
    “libavcodec/libx264.c:224: error: ‘X264_ME_TESA’ undeclared”

    I then left it out during the compilation of ffmpeg which finished without problems.

    Still searching for the solution.

  2. 2 gregory

    @Maxim

    Thanks, if you come across a solution please post back. I used SVN revision: SVN-r13141. You may try checking out that revision and see if the error still occurs.

  3. 3 Artem Russakovskii

    I just experienced the same problem as Maxim and after installing various versions of libx264-devel from official repositories, including 0.60, I still couldn’t get ffmpeg to compile.

    Here’s the solution: ffmpeg is so cutting edge that it needs the very latest x264 sources. You need to get x264 from their git repository or a daily snapshot.

    Here’s what I did:
    yast -i git # or whatever package manager you use
    rm -fr x264
    git clone git://git.videolan.org/x264.git
    cd x264
    ./configure –enable-shared –prefix=/usr && make && sudo make install

    Then compile ffmpeg and it should be fine. I compiled yesterday with no problem.

  4. 4 gregory

    @Artem, thanks for the code snippets. To all others seeking to install ffmpeg, if you are checking it out from the head, which is constantly changing, be sure and get the latest x264 package. I will be posting more on using Git in the future for those who are not familiar with it as a revision control system.

  5. 5 JORGE ORTEGA

    First it takes me a lot of more problems and till i arrive here:

    ./configure –enable-gpl –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-swscale –enable-avfilter –enable-pthreads –enable-libxvid –enable-libx264 –enable-libmp3lame –enable-libdc1394 –enable-liba52 –enable-libfaac –disable-ffserver –disable-ffplay
    ERROR: x264 not found
    If you think configure made a mistake, make sure you are using the latest
    version from SVN. If the latest version fails, report the problem to the
    ffmpeg-user@mplayerhq.hu mailing list or IRC #ffmpeg on irc.freenode.net.
    Include the log file “config.err” produced by configure as this will help
    solving the problem.

    So i am tired to search the solution over the night, i cant find this so i need to find this but i think there is a lack of information in every site including this.

    So i need this to be up for tomorrow and only is this problem and i cant find a solution, is hard to find what exactly match this but i think people should put their websites more explained because like this is very plain.

  6. 6 shashank

    Hi guys

    i am ona deadline and the time is ticking

    I keep getting this error whenever i try to convert a wmv to flv
    Unsupported codec (id=0) for input stream #0.1

    any help is greatly appreciated

    Thank You

  1. 1 Installing FFMPEG on CentOS 5 at Encoded | Gregory Tomlinson
  2. 2 Instalasi FFMPEG dan Library Pelengkap di CentOS 5 64 bit | Artikel Magnet

Leave a Reply