Download Tarballs to 'src' directory:

1          cd /usr/local/src

2          wget

3          wget

4          wget

5          wget

6          wget

7          wget

8          wget

9          wget


Un-tar sources:

1          tar xvzf flvtool2-1.0.6.tgz

2          tar xvzf lame-3.98.4.tar.gz

3          tar jxvf ffmpeg-php-0.6.0.tbz2

4          tar xvzf libogg-1.2.0.tar.gz

5          tar xvzf libvorbis-1.3.1.tar.gz

6          tar jxvf essential-20071007.tar.bz2

7          tar jxvf mplayer-export-snapshot.tar.bz2

8          tar xvzf ffmpeg-0.6.tar.gz


Make a directory to store all the codecs:

1          # mkdir /usr/local/lib/codecs/


Install any necessary packages:

1          yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++  ncurses-devel


Copy codecs for mplayer:

1          mv /usr/local/src/essential-20071007/* /usr/local/lib/codecs/

2          chmod -R 755 /usr/local/lib/codecs/


Installing Lame:

1          cd /usr/local/src/lame-3.98.4

2          ./configure

3          make && make install


Installing Libogg:

1          cd /usr/local/src/libogg*

2          ./configure && make && make install

3          Installing libvorbis:

view source


1          cd /usr/local/src/libvorbis*

2          ./configure && make && make install


Installing flvtool2:

1          cd /usr/local/src/flvtool*

2          ruby setup.rb config

3          ruby setup.rb setup

4          ruby setup.rb install


Installing mplayer:

1          # cd /usr/local/src/mplayer*

2          ./configure && make && make install


Installing ffmpeg PHP module

1          cd /usr/local/src/ffmpeg-*

2          ./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared


(If you need to customize your install, run "./configure –help" to see a complete list of the available flags)

1          make && make install



1          ln -s /usr/local/lib/ /usr/lib/

2          ln -s /usr/local/lib/ /usr/lib/

3          ln -s /usr/local/lib/ /usr/lib/

4          ln -s /usr/local/lib/ /usr/lib/

5          ln -s /usr/local/lib/ /usr/lib/


Installing ffmpeg-php:

1          # cd /usr/local/src/ffmpeg-php*

2          phpize

3          ./configure


There's a small issue in this version of ffmpeg-php which, when "make" is run, will cause the following error:

1          gcc -I. -I/usr/local/src/ffmpeg-php-0.6.0 -DPHP_ATOM_INC -I/usr/local/src/ffmpeg-php-0.6.0/include -I/usr/local/src/ffmpeg-php-0.6.0/main -I/usr/local/src/ffmpeg-php-0.6.0 -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/libavcodec/ -I/usr/local/include/libavformat/ -I/usr/local/include/libavutil/ -I/usr/local/include/libswscale/ -I/usr/local/include/libavfilter/ -I/usr/local/include/libavdevice/ -I/usr/include/php -DHAVE_CONFIG_H -g -O2 -Wall -fno-strict-aliasing -c /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c  -fPIC -DPIC -o .libs/ffmpeg_frame.o

2          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_toGDImage':

3          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)

4          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once

5          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.)

6          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zim_ffmpeg_frame_ffmpeg_frame':

7          /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function)

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


To correct this issue, we'll update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

1          vi ffmpeg_frame.c

2          :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

3          :w :q!


Now we can proceed with compiling:

1          make

2          make install


Now that we've compiled, let's make sure that is in the proper extensions directory:

1          php -i | grep extensions

2          /usr/local/lib/php/extensions/no-debug-non-zts-20060613


Now we'll tell PHP that it needs to load our module:

1          echo '' >> /usr/local/lib/php.ini


Restart Apache:

1          service httpd restart


Now we'll do a quick list of the modules to ensure that ffmpeg-php is loaded:

1          php -m | grep ffmpeg

2          ffmpeg

All done!