FFMPEG - Linux Build

This guild give you steps by step explanation on how to build ffmpeg from source for Linux. I am using CentOS 5.6 as platform

1. Additional repository. Get Epel so that you can yasm, git, etc... libraries

wget http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
rpm -Uvh epel-release-5*.rpm

2. Download FFMPEG source from http://www.ffmpeg.org/download.html

3. Download the following libraries from CentOS command line with wget

wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
wget http://downloads.xvid.org/downloads/xvidcore-1.2.2.tar.gz
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
wget http://downloads.sourceforge.net/faac/faad2-2.7.tar.gz
wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
wget http://downloads.sourceforge.net/project/libraw1394/libraw1394/libraw1394-2.0.5.tar.gz
wget http://downloads.sourceforge.net/project/libdc1394/libdc1394-2/2.1.2/libdc1394-2.1.2.tar.gz
wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
wget http://www.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2
wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gz
git clone git://git.videolan.org/x264.git

wget http://downloads.sourceforge.net/project/opencore-amr/vo-aacenc/vo-aacenc-0.1.1.tar.gz

4. Yum install the following development tools

yum install yasm
yum install nasm
yum install git
yum install libvpx*
yum install php-devel

5. Untar the download libraries

tar -zxf lame-3.98.4.tar.gz
tar -zxf xvidcore-1.2.2.tar.gz
tar -jxf ffmpeg-php-0.6.0.tbz2
tar -zxf a52dec-0.7.4.tar.gz
tar -zxf faad2-2.7.tar.gz
tar -zxf faac-1.28.tar.gz
tar -zxf libraw1394-2.0.5.tar.gz
tar -zxf libdc1394-2.1.2.tar.gz
tar -zxf opencore-amr-0.1.2.tar.gz
tar -jxf essential-20071007.tar.bz2
tar -jxf libtheora-1.1.1.tar.bz2
tar -zxf libogg-1.1.4.tar.gz
tar -zxf libvorbis-1.2.3.tar.gz

tar -zxf vo-aacenc-0.1.1.tar.gz


6. Make the following folders for x86

mkdir /usr/local/lib/codecs/
cp ./essential-20071007/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

7. Make the following folders for x64 as well

mkdir /usr/local/lib64/codecs/
cp ./essential-20071007/* /usr/local/lib64/codecs/
chmod -R 755 /usr/local/lib64/codecs/

8. Perform the following to configure, make and make install the downloaded libraries

cd x264
./configure --enable-shared
make
make install
cd ..

cd xvidcore/build/generic
./configure
make
make install
cd ../../../

cd lame-3.98.4
./configure
make
make install
cd ..

cd a52dec-0.7.4
./configure --enable-shared=PKGS
make
make install
cd ..

cd faad2-2.7
autoreconf -vif
./configure
make
make install
cd ..

cd faac-1.28
./bootstrap
./configure
make
make install
cd ..

cd libraw1394-2.0.5
./configure
make
make install
cd ..

cd libdc1394-2.1.2
./configure
make
make install
cd ..

cd opencore-amr-0.1.2
./configure
make
make install
cd ..

cd libogg-1.1.4
./configure
make
make install
cd ..

cd libvorbis-1.2.3
./configure
make
make install
cd ..

cd libtheora-1.1.1
./configure
make
make install
cd ..

cd vo-aacenc-0.1.1
./configure
make
make install
cd ..

9. Link the built libraries

export LD_LIBRARY_PATH=/usr/local/lib/
echo /usr/local/lib > /etc/ld.so.conf.d/custom-libs.conf
ldconfig

10. Build the FFMPEG with the following configuration and ldconfig link ffmpeg

cd ffmpeg
./configure --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libvo-aacenc --enable-libxvid --disable-ffplay --enable-shared --enable-gpl --enable-postproc --enable-nonfree --enable-avfilter --enable-pthreads --extra-cflags=-fPIC
make
make install
cd ..

ldconfig

11. Your FFMPEG is ready to use.

Comments

Popular Posts