FFMPEG Installation Advanced

FFMPEG INSTALLATION FROM SOURCE
Supported OS: Fedora Core 4+/RHE, Centos 4+
(Same installation method can be applied to Ubuntu, Slackware, Suse(but using the the correct package manager based on OS)

Summary
download and install:
libffac, libffad2,nasm, x264,amr, xvid, libogg, libvorbis, mp3lame, 3gp, ffmpeg

Setting Up Install Folder, Logging and download Packages
1)Log into ssh
2) cd /usr/src && mkdir install && cd install

3) Check for these Packages
rpm -qa automake autoconf libtool m4 gcc-c++ libogg-devel libvorbis-devel ncurses nasm subversion

4) Install missing Packages
Make sure to have them all, otherwise this installation cannot work
yum install automake autoconf libtool m4 gcc-c++ libogg-devel libvorbis-devel ncurses nasm subversion

4a) *For Fedora Core/Centos Users*

If you have the dries repo, instead of manually downloading, untarring and installing, you can just use yum package installer
yum install libogg-devel libvorbis-devel x264-devel lame-devel faad2-devel faac-devel xvidcore-devel.i386 a52dec-devel.i386 amrnb-devel.i386
Skip to step 12 if this step is complete

5) Download Video Codecs
wget http://prdownloads.sourceforge.net/faac/faad2-2.0.tar.gz?download
wget http://prdownloads.sourceforge.net/faac/faac-1.24.tar.gz?download
wget http://mesh.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
wget http://downloads.xvid.org/downloads/xvidcore-1.1.2.tar.gz
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
svn co svn://svn.videolan.org/x264/trunk x264

6) Untar all of the packages
tar -zxvf faac-1.24.tar.gz
tar -zxvf faad2-2.0.tar.gz
tar -zxvf lame-3.97.tar.gz
tar -zxvf xvidcore-1.1.2.tar.gz

If any are missing than simply yum install (packagename), if you dont have a package manager than get one, it will save you alot of time
and headaches.

7)Installing Faac
# cd faac
# sh bootstrap
# ./configure
# make; make install && cd ..

8)Installing Faad2

# cd faad2
There is 2 bugs with this package, so need to manually edit these files
# nano Makefile.am
Edit the file to look like this
SUBDIRS = libfaad common frontend plugins
EXTRA_DIST = faad2.spec

# cd common/mp4ff && nano mp4ffint.h
Find this line
void mp4ff_track_add(mp4ff_t *f);

and Comment this out to look like
//void mp4ff_track_add(mp4ff_t *f);

Save file and # cd ../..
# autoreconf -vif
# ./configure
# make;make install
# cd ..

9)Installing LAME (for audio)

# cd lame*
# ./configure; make;make install
# cd ..

10) Installing Xvid
# cd xvid*/build/generic/
# ./configure; make; make install;
# cd ../../..

11)Installing x264

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

12) Configuring for 3gp Support
# cd ffmpeg/libavcodec
# wget http://www.3gpp.org/ftp/Specs/2004-03/Rel-5/26_series/26073-530.zip
# wget http://www.3gpp.org/ftp/Specs/2004-03/Rel-5/26_series/26104-540.zip
# mkdir amr amr_float && cd amr
# unzip ../26073-530.zip
# unzip 26073-530_ANSI_C_source_code.zip
# mv c-code/* .
# cd ../amr_float
# unzip ../26104-540.zip
# unzip 26104-540_ANSI_C_source_code.zip
# mv c-code/* .
# cd ../..

13) Setting up 3gp Support
nano libavcodec/amr/makefile
Find around Line 68 and comment the entire line like below

#CFLAGS = -Wall -pedantic-errors -I. $(CFLAGS_$(MODE)) -D$(VAD)
The line should look something like this, new packages may vary

Paste Below
CFLAGS = -Wall -DMMS_IO -I. $(CFLAGS_$(MODE)) -D$(VAD)

# Save file

14) Setting up the Libs
Now check to see if (/usr/local/lib exist) on ld.so.conf
# cat /etc/ld.so.conf

If line exists, you can move onto the next step, if it doesnt exist then, run this command

# echo /usr/local/lib >>/etc/ld.so.conf
# ldconfig


17) Configuring FFmpeg
# ./configure --enable-shared --enable-xvid --enable-libvorbis --enable-libogg --enable-libmp3lame --enable-gpl --enable-libfaad --enable-libfaac --enable-x264 --enable-amr_nb-fixed --enable-pp

# make
# make install

If Installation went ok, run
run ldd /usr/local/bin/ffmpeg
This checks the path to the libs, if any of them are missing they will show here

Below are some common errors that can happen.

If there was message about tmpdir
Unable to create and execute files in /tmp. Set the TMPDIR environment.........

Run
mkdir /home/tmp
TMPDIR="/home/tmp"
export TMPDIR="/home/tmp"
chmod 777 /home/tmp

If there was error message about missing x264, then try installing via rpm
wget http://dag.wieers.com/packages/x264/x264-0.0.0-0.3.20061214.el4.rf.i386.rpm (Fc4 only, make sure to match your distro)
wget http://dag.wieers.com/packages/x264/x264-devel-0.0.0-0.3.20061214.el4.rf.i386.rpm (Fc4 only make sure to match your distro)
svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
rpm -ivh x264-0.0.0-0.3.20061214.el4.rf.i386.rpm
rpm -ivh x264-devel-0.0.0-0.3.20061214.el4.rf.i386.rpm

If Libraries couldnt be found and it gave error message on make, try to run the ffmpeg configure lines with path to libs

./configure --disable-shared --enable-xvid --enable-libvorbis --enable-libogg --enable-libmp3lame --enable-gpl --enable-libfaad --enable-libfaac --enable-x264 --enable-amr_nb --enable-pp --extra-cflags=-I/usr/local/include --extra-ldflags=-L/usr/local/lib

make
make install