Install FFMPEG & x264 on CentOS

Intro

This guide is meant to walk system administrators through the process of setting up ffmpeg, x264, and the codecs & libraries required to run the CumulusClips on CentOS 5.5 (or higher) and Red Hat (RHEL) Linux. This is helpful if you purchased a VPS or dedicated server to run CumulusClips, or if you’re a hosting company setting up your infrastructure to support CumulusClips. This guide was adapted from the following two guides:

http://www.pawprint.net/news/article/105/Compiling-FFMpeg-on-Centos-5/
http://ubuntuforums.org/showthread.php?t=786095

The version numbers of the various downloads were the latest at the time of this writing (9/17/2011). Please check the respective vendors’ sites to ensure you obtain the latest stable version of each library

Prepare Your System

Add EPEL Repository to CentOS / RHEL. Only the core and EPEL repositories are required for this guide. This is to obtains the necessary tools for the install process, not the actual codecs & libraries themselves. Those will be compiled from source.

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

Remove any of the codecs that were pre-installed.

yum remove libvpx libogg libvorbis libtheora libx264 x264 ffmpeg

Update your system and install the tools required for compiling and installing all the codecs.

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

Temporarily disable your firewalls and SELinux

iptables -F
service iptables save
vi /etc/selinux/config

Set the SELinux value to disabled. Make sure your shared library paths are in order

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

Codecs

Xvid Codec

Visit the Xvid site to retrieve the latest version of the codec.

wget http://downloads.xvid.org/downloads/xvidcore-1.3.2.tar.gz
tar -zxf xvidcore-1.3.2.tar.gz
cd xvidcore/build/generic
./configure
make && make install
ldconfig
cd

Lame Codec

Visit the LAME MP3 Encoder project to obtain their latest version.

wget http://downloads.sourceforge.net/project/lame/lame/3.98.4/lame-3.98.4.tar.gz
tar -zxf lame-3.98.4.tar.gz
cd lame-3.98.4
./configure
make && make install
ldconfig
 cd

Faac Codec

Visit the AudioCoding site for the latest version of the codec.

wget http://downloads.sourceforge.net/faac/faac-1.28.tar.gz
tar -xzf faac-1.28.tar.gz
cd faac-1.28
./bootstrap
./configure
make && make install
ldconfig
cd

OpenCore AMR Codec

Get the latest version of OpenCore AMR from their repository at SourceForge.

wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz
tar -xzf opencore-amr-0.1.2.tar.gz
cd opencore-amr-0.1.2
./configure
make && make install
ldconfig
cd

OGG Codec

Visit Xiph.org for the latest version of libogg.

wget http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz
tar -xzf libogg-1.3.0.tar.gz
cd libogg-1.3.0
./configure
make && make install
ldconfig
cd

Vorbis Codec

Visit Xiph.org for the latest version of Vorbis (libvorbis).

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.2.tar.bz2
tar -xjf libvorbis-1.3.2.tar.bz2
cd libvorbis-1.3.2
./configure
make && make install
ldconfig
 cd

Theora Codec

Visit Theora.org for the latest version of Theora (libtheora).

wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
tar -xjf libtheora-1.1.1.tar.bz2
cd libtheora-1.1.1
./configure
make && make install
ldconfig
 cd

x264

git clone git://git.videolan.org/x264.git
cd x264
./configure --enable-static
make && make install
ldconfig
cd

FFMPEG

git clone git://git.videolan.org/ffmpeg.git 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-libxvid --enable-gpl --enable-postproc \
--enable-nonfree
make && make install
ldconfig

qt-faststart

qt-faststart ships with FFMPEG. No seprate download is required for it. At this point you should still be in the ffmpeg directory.

cd tools
make qt-faststart
cp qt-faststart /usr/local/bin
ldconfig
cd