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
  • Share/Bookmark

No related posts.

17 comments

  1. 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

  2. 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.

  3. 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]#

  4. 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

  5. the best… tkns very much

    now my server can make website like youtube

    tkns

  6. 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

  7. I wanted to comment and thank the author, good stuff

  8. 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….

  9. @greg sidberry : Some people has encountered errors with the ffmpeg installer, i believe building from sources is more reliable, since you know what exactly you are installing.

    @paul : You should remove any failure trials completely first, any luck so far ?

    @Juan Pablo Garc?a Nieto , @Kamal , @Buzz: Have you tried to reinstall the php module again

    @mrtek, @Rafferty, @Abhay, @sionice : You are welcome :)

  10. 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 =)

  11. 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 directory

    libavdevice/Makefile:1: libavdevice/../config.mak: No such file or directory

    libavformat/Makefile:1: libavformat/../config.mak: No such file or directory

    libavcodec/Makefile:1: libavcodec/../config.mak: No such file or directory

    libavutil/Makefile:1: libavutil/../config.mak: No such file or directory

    libswscale/Makefile:1: libswscale/../config.mak: No such file or directory

    > libswscale/yuv2rgb.d

    > libswscale/swscale.d

    > libswscale/rgb2rgb.d

    > libswscale/options.d

    make: *** No rule to make target `libswscale/../config.mak'. Stop.

    [root@tricera ffmpeg]# make install

    Makefile:1: config.mak: No such file or directory

    libavdevice/Makefile:1: libavdevice/../config.mak: No such file or directory

    libavformat/Makefile:1: libavformat/../config.mak: No such file or directory

    libavcodec/Makefile:1: libavcodec/../config.mak: No such file or directory

    libavutil/Makefile:1: libavutil/../config.mak: No such file or directory

    libswscale/Makefile:1: libswscale/../config.mak: No such file or directory

    make: *** No rule to make target `libswscale/../config.mak'. Stop.

    [root@tricera ffmpeg]# export LD_LIBRARY_PATH=/usr/local/lib

    [root@tricera ffmpeg]# cd ..

  12. Worked like a charm! Thank you!

  13. same problem as above liba52

  14. Having the same problem with liba52 when installing fmpeg

    running centos 5.3 64 bit.

    help please.

  15. 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 -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_movie.c -o ffmpeg_movie.lo
    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_movie.c -fPIC -DPIC -o .libs/ffmpeg_movie.o
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_movie.c: In function ‘_php_get_av_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_movie.c:1246: warning: ‘avcodec_decode_video’ is deprecated (declared at /usr/local/include/ffmpeg/avcodec.h:3256)
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_movie.c: In function ‘_php_get_ff_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_movie.c:1333: warning: implicit declaration of function ‘img_copy’
    /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_frame.c -o ffmpeg_frame.lo
    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_frame.c -fPIC -DPIC -o .libs/ffmpeg_frame.o
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_convert_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:202: warning: implicit declaration of function ‘img_convert’
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_crop_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:260: warning: implicit declaration of function ‘img_copy’
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘_php_resample_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: ‘ImgReSampleContext’ undeclared (first use in this function)
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: (Each undeclared identifier is reported only once
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: for each function it appears in.)
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:282: error: ‘img_resample_ctx’ undeclared (first use in this function)
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:308: warning: implicit declaration of function ‘img_resample_full_init’
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:321: warning: implicit declaration of function ‘img_resample’
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:326: warning: implicit declaration of function ‘img_resample_close’
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘zif_toGDImage’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:448: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame’:
    /usr/src/ffmpeg-packages/ffmpeg-php-0.5.3.1/ffmpeg_frame.c:533: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)
    make: *** [ffmpeg_frame.lo] Error 1
    ——————————

  16. 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.

Leave a comment