/*********Only for beginners***********/
First of all a very little introduction to installing FFMPEG. We will be follow these procedures:
- We will first download the required packages (different libs and extensions). These include::: mplayer, flvtool2, lame, libogg, libvorbis, ffmpeg-php etc.
- The above packages are in compressed form so we will uncompress those.
- The uncompressed set of files are source for those, so we will compile and build them.
- At the end we will configure these with our apache.
To download wget is used.
e.g. wget --no-check-certificate https://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgz
To extract, we use:
tar -xjf amrwb-7.0.0.3.tar.bz2 etc
To compile we use:
./configuremakemake install
This will make its binaries.
/******end of Only for beginners******/
/******Real stuff starts here*********/
First of all get all the packages we need:
//Better make a separate folder for this stuff here:::
wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20071007.tar.bz2wget --no-check-certificate https://rubyforge.org/frs/download.php/17497/flvtool2-1.0.6.tgzwget http://biznetnetworks.dl.sourceforge.net/sourceforge/lame/lame-398-2.tar.gzwget http://jaist.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2wget http://downloads.xiph.org/releases/ogg/libogg-1.1.4.tar.gzwget http://downloads.xiph.org/releases/vorbis/libvorbis-1.2.3.tar.gzwget http://ftp.penguin.cz/pub/users/utx/amr/amrwb-7.0.0.3.tar.bz2
(If any of the above links are expired, you may just search google for these, but prefer using the latest version. An IMPORTANT note, use ffmpeg-php-0.6.0. Older version will make problems. This solves most of the issues.
Now extract them all.
tar -xjf amrwb-7.0.0.3.tar.bz2tar -xjf essential-20071007.tar.bz2tar -xjf ffmpeg-php-0.6.0.tbz2tar -xzf flvtool2-1.0.6.tgztar -xzf lame-398-2.tar.gztar -xzf libogg-1.1.4.tar.gztar -xzf libvorbis-1.2.3.tar.gz
Now make directory for codecs and move them there.
mkdir /usr/local/lib/codecsmv essential-20071007/* /usr/local/lib/codecs/chmod -R 755 /usr/local/lib/codecs/
We will now download MPlayer and FFMPEG using SVN and update.
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpegsvn checkout svn://svn.ffmpeg.org/ffmpeg/trunk mplayercd mplayer/svn update
IMPORTANT: Download these both from SVN, by other ways it will give error (I got them).
If you do not have SVN, you can install it using:
yum install subversionyum install rubyyum install ncurses-develor you can use apt-get too
Some guides asked to update configuration file too. But for me it worked without it. To update libs use vi
vi /etc/ld.so.conf
It will open up vi editor. Add the following line:
/usr/local/lib
and then load config file using
ldconfig -vNow make all other libs
cd amrwb-7.0.0.3./configuremakemake installcd ../flvtool2-1.0.6ruby setup.rb config && ruby setup.rb setup && ruby setup.rb installcd ../lame-398-2./configuremakemake installcd ../libogg-1.1.4./configuremakemake installldconfig -vcd ../libvorbis-1.2.3./configuremakemake installcd ../mplayer/./configuremakemake installcd ../ffmpeg./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-sharedmakemake install
Here, you may have problem with ffmpeg. I was having some issues with libvorbis. I first tried it by removing this. It works but you may need libvorbis. You may try using other version of vorbis we downloaded above. FFMPEG will take some time too on ./configure and make.
Also some of the guides used
echo '#define HAVE_LRINTF 1' >> config.h
after configure. I didn't use it but I think it will help.
Now add links to codecs:
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52ln -s /usr/local/lib/libavcodec.so.52 /usr/lib/libavcodec.so.52ln -s /usr/local/lib/libavutil.so.50 /usr/lib/libavutil.so.50ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52ln -s /usr/local/lib/libamrwb.so.3 /usr/lib/libamrwb.so.3
Now here comes an IMPORTANT part. This is a must do, it solved my all issues :P
Goto ffmpeg-php and edit ffmpeg_frame.c
cd ../ffmpeg-php-0.6.0vi ffmpeg_frame.c
Now run this command:
:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32
save and quit. Use :wq for this.
Now in the same folder (i.e. ffmpeg-php-0.6.0) do the following.
phpize./configuremakemake install
Now major stuff is done. We just have to add the php extension to php.ini file. You will first need to locate php.ini. You may find it in /etc/
vi /etc/php.ini
Add this line at the end
extension=ffmpeg.so
Ok, all done now. Just restart the server and check phpinfo for ffmpeg extension.
To restart use:
/etc/init.d/httpd restart
You can also use your server's cpanel/plesk for restarting the service.
Now to test you may run php command for phpinfo. Use this:
php -r 'phpinfo();' | grep ffmpeg
You should get version info and build date etc.
ffmpegffmpeg-php version => 0.6.0-svnffmpeg-php built on => Nov 21 2009 23:35:23ffmpeg-php gd support => enabledffmpeg libavcodec version => Lavc52.32.0ffmpeg libavformat version => Lavf52.36.0ffmpeg swscaler version => SwS0.7.1ffmpeg.allow_persistent => 0 => 0ffmpeg.show_warnings => 0 => 0PWD => /usr/src/ffmpeg-php-0.6.0_SERVER["PWD"] => /usr/src/ffmpeg-php-0.6.0_ENV["PWD"] => /usr/src/ffmpeg-php-0.6.0
I will discuss a serious error in another post.
No comments:
Post a Comment