cPanel ffmpeg howto
In this tutorial I will explain how to install and configure ffmpeg for php on a CentOS with or without cPanel.
You will still need a some linux knowledge in order to accomplish this.
As a side note, this is for 64bit and 32bit distributions.
Before you start please read this carefully
Since this is a 32bit and 64bit tutorial you will have to uncomment a few lines,
therefore you can’t just copy and paste the code.
We begin by downloading the needed packages:
cd /usr/local/src # For 64bit distribution uncomment the following line: #wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-amd64-20071007.tar.bz2 # For 32bit distribution uncomment the following line: #http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2 wget http://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz wget http://switch.dl.sourceforge.net/sourceforge/lame/lame-398-2.tar.gz wget http://mesh.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2 wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.bz2 wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gz wget http://sourceforge.net/projects/opencore-amr/files/opencore-amr/0.1.2/opencore-amr-0.1.2.tar.gz/download wget http://downloads.xiph.org/releases/theora/libtheora-1.1.1.tar.bz2
Now that we have all this files, let’s decompress them.
# For 64bit distribution uncomment the following line: #tar xvjf essential-amd64-20071007.tar.bz2 # For 32bit distribution uncomment the following line: #tar xvjf essential-20071007.tar.bz2 tar xvzf opencore-amr-0.1.2.tar.gz tar xvzf flvtool2-1.0.6.tgz tar xvzf libogg-1.1.4.tar.gz tar xvjf libvorbis-1.2.3.tar.bz2 tar xvjf ffmpeg-php-0.6.0.tbz2 tar xvzf lame-398-2.tar.gz tar xvjf libtheora-1.1.1.tar.bz2
Let’s get ffmpeg and mplayer using the default svn available on the official web sites.
mkdir /usr/local/lib/codecs/ svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer # For 64bit distribution uncomment the following line: #cp /usr/local/src/essential-amd64-20071007/* /usr/local/lib/codecs/ # For 32bit distribution uncomment the following line: #cp /usr/local/src/essential-20071007/* /usr/local/lib/codecs/ chmod -R 755 /usr/local/lib/codecs/ mkdir /usr/local/src/tmp chmod 777 /usr/local/src/tmp export TMPDIR=/usr/local/src/tmp
Next it’s the boring part, let’s compile all the downloaded packages:
cd /usr/local/src/lame-398-2/ ./configure make make install cd /usr/local/src/libogg-1.1.4 ./configure make make install cd /usr/local/src/libvorbis-1.2.3 ./configure make make install
If during ./configure for libvorbis you get this error:
checking for pkg-config... no
Then you need to install pkg-config, this depends on the distribution you are using,
on CentOS run:
yum install pkgconfig export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig
Let’s resume…
cd /usr/local/src/flvtool2-1.0.6 ruby setup.rb config ruby setup.rb setup ruby setup.rb install cd /usr/local/src/mplayer/ ./configure --enable-jpeg make make install cd opencore-amr-0.1.2 ./configure make make install cd /usr/local/src/libtheora-1.1.1 ./configure make make install cd /usr/local/src/ffmpeg ./configure --enable-libmp3lame --enable-libvorbis --enable-shared --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-nonfree --enable-libtheora --enable-version3 make make install cd /usr/local/src/ffmpeg-php-0.6.0 phpize ./configure make
At this point you will get a error:
/usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zif_ffmpeg_frame_toGDImage': /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: 'PIX_FMT_RGBA32' undeclared (first use in this function) /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.) /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function 'zif_ffmpeg_frame_ffmpeg_frame': /usr/local/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: 'PIX_FMT_RGBA32' undeclared (first use in this function) make: *** [ffmpeg_frame.lo] Error 1
You need to edit ffmpeg_frame.c and replace a few strings, do it using vi like this:
vi ffmpeg_frame.c
Now type :
That’s Shift ; (just in case some one understands this wrong).
When you type : in vi you will be prompted to enter a command, and that will be the following:
%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
Hit enter and you will see that a few strings were replaced.
Save the file by typing
:wq
That’s : and wq (write and quit)
Let’s finish this by compiling ffmpeg-php
make make install
The final step in this is to activate the extension in php, edit your php.ini,
using cPanel’s advanced editor or use your favorite text editor.
Add this into php.ini:
extension=ffmpeg.so
January 14, 2010
Working like a charm, thanks.
February 21, 2010
I want to thank the blogger very much not only for this post but also for his all previous efforts. I found http://www.serverhostingsecrets.com to be greatly interesting. I will be coming back to http://www.serverhostingsecrets.com for more information.
March 13, 2010
nice information about cPanal, your blog is worth reading i will
go through all of your posts for getting relevant
information,regards from
free mp3 download