• Could not connect to Twitter

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.

Please share:
  • DZone
  • del.icio.us
  • Reddit
  • Furl
  • Ma.gnolia
  • email
  • StumbleUpon
  • Technorati
  • TwitThis
  • Slashdot
If you enjoyed this post, make sure you subscribe to my RSS feed!

Related posts:

  1. Compiling FAAD and FAAC (libfaad/libfaac) on RedHat
  2. Compiling LAME on RedHat
  3. New Ruby ShowMeDo: Using and Configuring Ruby’s IRB

4 comments to Compiling ffmpeg on RedHat