Installing ffmpeg-php on Centos 5

It took me a couple of days to figure out the right way to install ffmpeg-php extension for php, so i documented all the instructions to not waste another 2 days for me and anyone interested
i started with http://www.amman-dj.com/Slim/2008/01/29/how-to-installing-ffmpeg-mplayer-flvtool-2-and-ffmpeg-php-4-youtube-clone-script/ but didn’t work with me and i needed more plugins, so i modified it and added the other packages
enjoy 🙂

##########################
# add dag repository

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

##########################
# update system

yum -y update

##########################
# Download Packages

mkdir ~/ffmpeg-packages
cd ~/ffmpeg-packages
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
wget http://superb-east.dl.sourceforge.net/sourceforge/lame/lame-3.98b8.tar.gz
wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
wget ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-20080630-2245.tar.bz2
wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
wget http://www.linux1394.org/dl/libraw1394-1.3.0.tar.gz
wget http://mesh.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.3.1.tbz2

##########################
# Install SVN/Ruby

yum install subversion
yum install ruby
yum install ncurses-devel

##########################
# Extract all the source files

bunzip2 essential-20061022.tar.bz2; tar xvf essential-20061022.tar
tar zxvf flvtool2_1.0.5_rc6.tgz
bunzip2 ffmpeg-php-0.5.3.1.tbz2; tar xvf ffmpeg-php-0.5.3.1.tar
tar zxvf libogg-1.1.3.tar.gz
tar zxvf libvorbis-1.1.2.tar.gz
tar -zxf a52dec-0.7.4.tar.gz
tar zxf faad2-2.6.1.tar.gz
tar zxfv faac-1.26.tar.gz
tar zxfv lame-3.98b8.tar.gz
tar zfvx yasm-0.7.0.tar.gz
bunzip2 < x264-snapshot-20080630-2245.tar.bz2 | tar -xf -
tar zxfv xvidcore-1.1.3.tar.gz
tar zxfv libraw1394-1.3.0.tar.gz

##########################
#Create the codecs directory & import them

mkdir /usr/local/lib/codecs/
mv essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

##########################
# Install Lame

cd lame-3.98b8
export LD_LIBRARY_PATH=/usr/local/lib
./configure
make
make install
cd ..

##########################
# Install libOGG

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

##########################
# Install libVorbis

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

##########################
# Install flvtool2

cd flvtool2_1.0.5_rc6
ruby setup.rb config
ruby setup.rb setup
ruby setup.rb install
cd ..

##########################
# Install a52

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

##########################
# Install FAAD2

cd faad2
autoreconf -vif
./configure --disable-drm --disable-mpeg4ip
make
make install
cd ..

##########################
# Install FAAC

cd faac
./bootstrap
./configure --disable-mp4v2
make
make install
cd ..

##########################
# Install yasm

cd yasm-0.7.0
./configure
make
make install
cd ..

##########################
# Install x264

cd x264-snapshot-20080630-2245
./configure --enable-shared
make
make install
cd ..

##########################
# Install Xvid

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

##########################
# Install libraw1394

cd libraw1394-1.3.0
./configure
make dev
make
make install
cd ..

##########################
# Install libdc1394

yum install libdc1394 libdc1394-devel

##########################
# Install libtheora

yum install libtheora libtheora-devel

##########################
# Install vlc & mplayer

yum install vlc mplayer

##########################
# Install ffmpeg

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-gpl --enable-postproc --enable-nonfree --enable-postproc --enable-libfaad --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-liba52 --enable-libfaac --disable-ffserver --disable-ffplay --enable-libtheora --enable-libvorbis --enable-shared

make
make install
export LD_LIBRARY_PATH=/usr/local/lib
cd ..

##########################
# Install FFMPEG-PHP (make sure the php.ini path is correct.)

cd ffmpeg-php-0.5.3.1
phpize
./configure
make
make install

echo 'extension=ffmpeg.so' >> etc/php.ini
cd ..
service httpd restart

php -r 'phpinfo();' | grep ffmpeg

17
Leave a Reply

avatar
17 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
15 Comment authors
meggaeMakisjamesGregElvis McNeely Recent comment authors
  Subscribe  
Notify of
greg sidberry
Guest

you might want to check out the ffmpeg installer: it runs flawless on centos. I recommend commenting out its ruby and flvtool2 installation, those are better handled manually.

http://www.sherin.in/ffmpeg/index.php?option=com_content&task=view&id=25&Itemid=39

trackback

[…] the final FLV videos on server, plus other features like extracting image frames from videos .. this article describes how to install FFMPEG on Centos […]

paul
Guest
paul

after half a day o installing, at ffmpeg-php-0.5.3.1 the fun is over.
it won’t make, and neither will any other version.

Juan Pablo Garc?a Nieto
Guest
Juan Pablo Garc?a Nieto

Hi,

I have this error.

[root@lin7 src]# php -r ‘phpinfo();’ | grep ffmpeg
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ – /usr/lib/php/modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
OLDPWD => /usr/src/ffmpeg-php-0.5.3.1
_SERVER[“OLDPWD”] => /usr/src/ffmpeg-php-0.5.3.1
_ENV[“OLDPWD”] => /usr/src/ffmpeg-php-0.5.3.1
[root@lin7 src]#

Kamal
Guest
Kamal

I got same PHP Warning.

[root@localhost ffmpeg-php-0.5.3.1]# php -r ‘phpinfo();’ | grep ffmpeg
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’ – /usr/lib/php/modules/ffmpeg.so: undefined symbol: le_ffmpeg_frame in Unknown on line 0
OLDPWD => /root/ffmpeg-packages
PWD => /root/ffmpeg-packages/ffmpeg-php-0.5.3.1
_SERVER[“OLDPWD”] => /root/ffmpeg-packages
_SERVER[“PWD”] => /root/ffmpeg-packages/ffmpeg-php-0.5.3.1
_ENV[“OLDPWD”] => /root/ffmpeg-packages
_ENV[“PWD”] => /root/ffmpeg-packages/ffmpeg-php-0.5.3.1

Has any one resolved this issue?

Thanks

mrtek
Guest
mrtek

the best… tkns very much

now my server can make website like youtube

tkns

Buzz
Guest

RE: PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib/php/modules/ffmpeg.so’

Do the following:

ln -s /usr/lib/php/modules/no-debug-non-zts-20060613/ffmpeg.so /usr/lib/php/modules/ffmpeg.so

All is then again well.

Cheers

Buzz

Saiweb.co.uk

Rafferty
Guest

I wanted to comment and thank the author, good stuff

Abhay
Guest
Abhay

That ffmpeginstall somebody is recommending above to use SUCKS !!!

I don't know, who have done that patch, but please, at least test it's running……

God forbid me, but don't recommend such crap…

It's better you go from the scratch….

sionice
Guest
sionice

I had to make a couple minor tweaks to this posted process, though it was by FAR the best guide out there that helped with a ton of my questions. I’m not very knowledgeable on this type of thing, though you made it moderately painless. Thanks =)

Elvis McNeely
Guest

Hi, thanks for the tutorial. I am running into a few probelms. On several occasions I am getting this error repeatedly when running "make" make: *** No rule to make target `install' Any tips would be appreciated. I am running on Centos 5, 32bit. Here is the output of the "# Install ffmpeg" step [root@tricera a52dec-0.7.4]# cd .. [root@tricera ffmpeg-packages]# cd ffmpeg [root@tricera ffmpeg]# ./configure –enable-gpl –enable-postproc –enable-nonfree –enable-postproc –enable-libfaad –enable-avfilter –enable-pthreads –enable-libxvid –enable-libx264 –enable-libmp3lame –enable-liba52 –enable-libfaac –disable-ffserver –disable-ffplay –enable-libtheora –enable-libvorbis –enable-shared Unknown option "–enable-liba52". See ./configure –help for available options. [root@tricera ffmpeg]# make Makefile:1: config.mak: No such file or… Read more »

Greg
Guest

Worked like a charm! Thank you!

james
Guest
james

same problem as above liba52

james
Guest
james

Having the same problem with liba52 when installing fmpeg

running centos 5.3 64 bit.

help please.

Makis
Guest

Thanks for this guide. I m running a centos 5.x server on 64 bits. I m getting error while trying to “make instal” ffmpeg-php this is my error log: —————————— /bin/sh /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/libtool –mode=compile gcc -I. -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1 -DPHP_ATOM_INC -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/include -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/main -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/ffmpeg -I/usr/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg-php.c -o ffmpeg-php.lo mkdir .libs gcc -I. -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1 -DPHP_ATOM_INC -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/include -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/main -I/usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1 -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/ffmpeg -I/usr/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg-php.c -fPIC -DPIC -o .libs/ffmpeg-php.o /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg-php.c: In function ‘zm_startup_ffmpeg’: /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg-php.c:110: warning: implicit declaration of function ‘avcodec_build’ /bin/sh /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/libtool –mode=compile gcc… Read more »

meggae
Guest
meggae

hi makis,

i get the same error as you do for

make: *** [ffmpeg_frame.lo] Error 1

maybe you should try to go to where you install your ffmpeg file for example

cd /usr/local/src/ffmpeg-php-0.5.2.0/

and try ls -l

you can see a file called ffmpeg_frame.loT in there,

change the name of the file

mv ffmpeg_frame.loT ffmpeg_frame.lo

and try to rebuild again, type :

make

make install

cheers.