CentOS 5 Build FFmpeg with X264

From Hawk Wiki
Jump to: navigation, search
07/07/2011 Installation procedure

Server environment:
CentOS 5.6
Linux version 2.6.18-238.12.1.el5 (mockbuild@builder10.centos.org) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50))

FFmpeg install detailed procedure: We took http://www.austenconstable.com/2008/08/06/howto-compiling-the-latest-ffmpeg-x264-on-centos-4/ as reference
1. add repository:

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm"

2.

yum update

Note: This procedure is not required.
3.

yum remove ffmpeg x264 faad2 faad2-devel

4.

yum install gcc gcc-c++ automake autoconf libtool yasm git subversion

If subversion has problems in install, then just install the rest.
5.

yum install zlib-devel libmad-devel libvorbis-devel libtheora-devel lame-devel faac-devel a52dec-devel xvidcore-devel freetype-devel

6. Compile & Install faad2

cd ~
wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
tar xzvf faad2-2.6.1.tar.gz
cd faad2
autoreconf -vif   
./configure
make
make install

7. Compile & Install GPAC

cd ~
wget http://downloads.sourceforge.net/gpac/gpac-0.4.4.tar.gz
tar -xzvf gpac-0.4.4.tar.gz
cd gpac
./configure
make
make install
make install-lib

Note: the compile will probably cause an osmozilla related error (osmozilla.h:175: error: âresultâ does not name a type).

Solution: edit applications/Makefile and comment out the following lines:

    #INSTDIRS+=osmozilla
    #APPDIRS+=osmozilla

I just removed osmozilla part in Makefile (details will be added later)

8.
echo '/usr/local/lib/' > /etc/ld.so.conf.d/gapc-1386.conf
ldconfig

9. Compile & Install x264

cd ~
git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-pthread --enable-mp4-output --enable-shared
make
make install

11.

 ldconfig

12. Install ffmpeg

cd ~
svn co svn://svn.ffmpeg.org/soc/libavfilter
./checkout.sh
cd ffmpeg
./configure --prefix=/usr/local --disable-debug --enable-shared --enable-gpl --enable-nonfree --enable-postproc --enable-swscale --enable-pthreads --enable-x11grab --enable-libx264 --enable-libxvid --enable-libvorbis --enable-libfaac --enable-libmp3lame --enable-avfilter --enable-filter=movie
make
make install

13. If ffmpeg has problems finding shared libraries, set the LD_LIBRARY_PATH

echo 'LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib; export LD_LIBRARY_PATH' >> /etc/ld.so.conf
ldconfig

Note: This version is not latest, but it contains most avfilters we need.