Compiling ffmpeg on RedHat

Most of the instructions needed to compile ffmpeg on RedHat are here and here. This builds upon my previous post Compiling LAME on RedHat.

[Includes update below for libfaac/libfaad]

Following these I first tried:

./configure --disable-debug --disable-network --disable-ffserver --disable-ffplay --enable-libmp3lame --enable-gpl --enable-shared --log=log.txt

but I received the following error:

ffmpeg: error while loading shared libraries: libavformat.so.51: cannot open shared object file: No such file or directory

Note the ‘–log=log.txt’ - a handy way of having the makefile dump out a log file which tells you exactly where things have failed.

For the makefile to see the source and libs for libmp3lame I had to read-up on adding cflags and ldflags to the configure line:

./configure --disable-debug --disable-network --disable-ffserver --disable-ffplay --enable-libmp3lame --enable-gpl --extra-cflags=-I/$HOME/include/ --extra-ldflags=-L/$HOME/lib --prefix=$HOME --enable-shared

Finally it is necessary to export an ‘LD_LIBRARY_PATH’ so that ffmpeg can see the shared libraries for LAME. I chose to add the following to my .bash_profile:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/$HOME/lib

The final steps are to build ffmpeg:

make
make install

The result is a working ffmpeg that can encode to the FLV format that we use inside ShowMeDo.

Update to enable mp4a (libfaad/libfaac):

Our version of ffmpeg didn’t support libfaac/libfaad for mp4 audio/video support. To fix that first I compiled the libfaac and libfaad libraries, then updated our ffmpeg src:

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

The configuration had to change to include libfaac and libfaad:

./configure --disable-debug --disable-network --disable-ffserver --disable-ffplay --enable-libmp3lame --enable-libfaad --enable-libfaac --enable-gpl --extra-cflags=-I/$HOME/include/ --extra-ldflags=-L/$HOME/lib --prefix=$HOME --enable-shared
make
make install

and next we have a working ffmpeg.

There is one change in usage - previously we had ‘-acodec mp3′ which had to be changed to ‘-acodec libmp3lame’.

Oddly the mp4a stream is recognised as ‘Stream #0.0(eng): Audio: mpeg4aac, 44100 Hz, stereo’ - but it works just fine.

4 Responses to “Compiling ffmpeg on RedHat”

  1. ShowMeDo Blog » Blog Archive » Compiling LAME on RedHat Says:

    [...] ShowMeDo Blog ShowMeDo News and Thoughts « ShowMeDo: ‘Python for Math Teachers’ - Subclassing for Beginners (1 video) Compiling ffmpeg on RedHat » [...]

  2. Administrator Says:

    Alan Pope (Ubuntu) has instructions on compiling ffmpeg on Ubuntu:
    http://popey.com/cgi-bin/wiki.pl?CompilingFfmpegForFunAndProfit

  3. Entrepreneurial Geekiness » ShowMeDo - new videos, ffmpeg, Google Group Says:

    [...] made two posts a little while back on the ShowMeDo blog about compiling ffmpeg on RedHat and compiling LAME on [...]

  4. ShowMeDo Blog » Blog Archive » Compiling FAAD and FAAC (libfaad/libfaac) on RedHat Says:

    [...] builds upon my Compiling LAME on RedHat and Compiling ffmpeg on RedHat [...]

Leave a Reply

You must be logged in to post a comment.