الجمعة، 17 سبتمبر 2010

How-To: Installing FFmpeg + FFmpeg-PHP + Mplayer + Mencoder + flv2tool + LAME MP3 Encoder How to install many software for manipolate the video

FFmpeg is so important if you are planning to run a video website with streaming with conversion of video files to different video formats. This tutorial is intended for Centos/Redhat versions of Linux where any novice user can install ffmpeg without compiling the source which is a more traditional way of installing the FFmpeg software on linux servers. In this tutorial i will show you the easy way to install ffmpeg and ffmpeg-php (php extension) with just yum rather than compiling ffmpeg from source files.

In this tutorial i let learn how to install this codecs on Linux/Unix System.

We start connecting to the server shell by ssh (with root or sudo login)


cd /usr/local/src/


DOWNLOAD MODULES

wget www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2
 wget rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz
 wget easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz
 wget superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.1.tbz2
 wget downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz
 wget downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz
wget mplayerhq.hu/MPlayer/releases/MPlayer-1.0rc2.tar.bz2
wget ffmpeg.org/releases/ffmpeg-0.5.tar.bz2


EXTRACT MODULES

tar zxvf lame-3.97.tar.gz
 tar zxvf libogg-1.1.3.tar.gz
 tar zxvf libvorbis-1.1.2.tar.gz
 tar zxvf flvtool2_1.0.5_rc6.tgz
 tar jxvf essential-20061022.tar.bz2 
 tar jxvf ffmpeg-php-0.5.1.tbz2
tar jxvf MPlayer-1.0rc2.tar.bz2
tar jxvf ffmpeg-0.5.tar.bz2
 
 mkdir /usr/local/lib/codecs/
 
 yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran subversion ruby ncurses-devel -y


DOWNLOAD FFMPEG and MPLAYER by snv

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
 svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer
 cd /usr/local/src/mplayer
 
 svn update
 
 cd /usr/local/src/
 mv /usr/local/src/essential-20061022/* /usr/local/lib/codecs/
 chmod -R 755 /usr/local/lib/codecs/
 

LAME:

cd /usr/local/src/lame-3.97
 ./configure
 make && make install


LIBOGG

cd /usr/local/src/
 cd /usr/local/src/libogg-1.1.3
 ./configure --enable-shared && make && make install
 PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
 export PKG_CONFIG_PATH


LIBVORBIS
cd /usr/local/src/
 cd /usr/local/src/libvorbis-1.1.2
 ./configure && make && make install


FLVTOOL2

cd /usr/local/src/
 cd /usr/local/src/flvtool2_1.0.5_rc6/
 ruby setup.rb config
 ruby setup.rb setup
 ruby setup.rb install


MPLAYER
cd /usr/local/src/
 cd /usr/local/src/MPlayer-1.0rc2
 ./configure && make && make install
 
 cd /usr/local/src/


FFMPEG:

cd /usr/local/src/ffmpeg-0.5
 ./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared
 make
 make install
 
 export LD_LIBRARY_PATH=/usr/local/lib/
 
 ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50
 ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51
 ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49
 ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0
 ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
 

FFMPEG-PHP:

cd /usr/local/src/
 cd /usr/local/src/ffmpeg-php-0.5.1/
 phpize
 ./configure
 make
 make install



NOTICE: Make sure this is the correct php.ini for the box!!

echo 'extension=ffmpeg.so' >> /usr/local/Zend/etc/php.ini


NOTICE: Make sure this is the correct php.ini for the box!!

RESTART APACHE

service httpd restart
You do just edit your php.ini:
(if you can't find your php.ini run the command "locate php.ini" and open the correct php.ini)

Add this extension to php.ini
[i][ffmpeg]
 extension_dir=/usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
 extension=ffmpeg.so[/i]


After for run and verify:

Restart Apache and check that the module is loaded in PHP:



Test ffmpeg from command line and if you get this errors:

ffmpeg: error while loading shared libraries: libavformat.so.51:…

execute:and reload library cache with
/etc/init.d/httpd restart

/usr/local/lib >>/etc/ld.so.conf

[i]ldconfig -v[/i]



Verify ffmpeg installation:



If you get the folowing results then FFMPEG and all it’s components are installed correctly:





php -r ‘phpinfo();’ | grep ffmpeg

ffmpeg
 ffmpeg support (ffmpeg-php) => enabled
 ffmpeg-php version => 0.5.3.1
 ffmpeg-php gd support  => enabled
 ffmpeg.allow_persistent => 0 => 0
 ffmpeg.show_warnings => 0 => 0

ليست هناك تعليقات:

إرسال تعليق