How To Install FFmpeg

In: Linux

25 Apr 2009

Following are the steps to install FFmpeg on Redhat OS. The –enable-libfaad option requires that libfaad has already been installed. This is a library for decoding mpeg4 audio (mp4a). If you don’t mind not having the ability to upload mpeg 4 audio then you won’t need it, but if you do want to be able to upload videos with mp4a encoding you’ll have to struggle to get the faad libraries installed.

Download the a52dec library and compile it as below,

curl -O http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
tar xvfz a52dec-0.7.4.tar.gz
cd a52dec-0.7.4
./configure
make
make install

May be you can get newer faad2 library, check first this url and compile it.

wget http://downloads.sourceforge.net/faac/faad2-2.6.tar.gz
tar xvfz faad2-2.6.tar.gz
cd faad2
aclocal -I .
autoheader
libtoolize --automake --copy
automake --add-missing --copy
autoconf
./configure
make
make install

Install the yasm library as below.

wget http://www.tortall.net/projects/yasm/releases/yasm-0.8.0.tar.gz
tar xvfj yasm-0.8.0.tar.gz
cd yasm-0.8.0
./configure
make
make install

x264 is necessary if you want to use it on your FFmpeg.

wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20090424-2245.tar.bz2
tar xvfj x264-snapshot-20090424-2245.tar.bz2
cd x264-snapshot-20090424-2245
./configure
make
make install

wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
tar xvfz faac-1.26.tar.gz
cd faac
dos2unix bootstrap
find . -exec dos2unix '{}' \;
sh bootstrap
./configure
make
make install

wget http://downloads.xvid.org/downloads/xvidcore-1.1.2.tar.gz
tar xvfz xvidcore-1.1.2.tar.gz
cd xvidcore-1.1.2/build/generic
./configure
make
make install

wget http://www3.mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc1.tar.bz2
tar xvfj MPlayer-1.0rc1.tar.bz2
cd MPlayer-1.0rc1
./configure
make
make install

wget http://ronald.bitfreak.net/priv/amrnb-0.0.1.tar.gz
tar xvfz amrnb-0.0.1.tar.gz
cd amrnb-0.0.1
./configure
make
make install

wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
tar xvfz xvidcore-1.1.3.tar.gz
cd xvidcore-1.1.3
cd build/generic/
./bootsttap.sh
./configure
make
make install

wget http://ffmpeg.mplayerhq.hu/ffmpeg-checkout-snapshot.tar.bz2
tar xvfj ffmpeg-checkout-snapshot.tar.bz2
cd ffmpeg-checkout-2007-10-23

or if your OS has svn command you can do like this to get latest version.

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

then compile ffmpeg use this options.

./configure --enable-libfaac --enable-libfaad --enable-libamr-nb --enable-memalign-hack --enable-gpl --enable-libxvid --enable-pthreads --enable-libfaac --enable-libfaad --enable-libxvid --enable-nonfree --enable-libmp3lame --enable-libx264 --disable-demuxer=v4l --disable-demuxer=v4l2 --enable-bzlib --enable-zlib
make
make install

Some (older?) versions of ffmpeg used “–enable-faad” rather than “–enable-libfaad”, so if it doesn’t work, try the other option.
If you get error like this, you need to do /sbin/ldconfig first.

Running ffmpeg

Gemin-i Plus uses the following script to convert to .FLV flash video format. Try from the command line to see if it works. inputfile.mov is a .mov file on your server, outputfile.flv is the name you’re giving to the converted file.

$ ffmpeg -i inputfile.mov -f flv -r 30 -y outputfile.flv

The above command produced slow movies on two installs. Try:

$ ffmpeg -i source.mov -ar 22050 -b 200 -r 12 -f flv -s 640x480 destination.flv

This will resize to 640×480.

For thumbnails, try:

$ ffmpeg -i source.avi -an -ss 00:00:03 -an -r 1 -s 300x200 -vframes 1 -y -pix_fmt rgb24 destination%d.jpg

You will get a file called destination1.jpg, which will show a scene three seconds into the movie you have to remove the 1 yourself, or write a script. There’s a theoretical possibility of getting more than one destination file, numbered 2 upwards.

The output filename MUST include %d or you will get the error below. The %d will turn into a number 1 once processed. unable for find a suitable output format for destination1.jpg

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

Comment Form

Categories

Archives