Monday, September 6, 2010

FFmpeg FFmpeg-PHP Mplayer Mencoder flv2tool LAME MP3 Encoder INSTALLATION

Here We can discus how to install FFMPEG and it associated friends ( Supporting Software) on Linux Servers.
FFmpeg
FFmpeg-PHP
Mplayer Mencoder
flv2tool
LAME
MP3 Encoder

****************

For Installing FFMPEG and its friends we need to make sure the following packages already installed on your server
gcc,gmake,make, libcpplibgcc, libstdc++, gcc4, gcc4-c++, gcc4-gfortran, subversion, ruby ncurses-devel -y

If not please install these packages using yum
yum install gcc gmake make libcpp libgcc libstdc++ gcc4 gcc4-c++ gcc4-gfortran subversion ncurses-devel -y
Install Ruby, Ruby Gem, Fastthread, Mongrel and Rails on cpanel servers by using the command
/scripts/installruby
Please do the following Steps

cd /usr/local/src/

Next We need to Download the required 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
Or
wget http://space.dl.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.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

and wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz

After that extract these downloaded MODULES using ' tar zxf filename '

mkdir /usr/local/lib/codecs/

By using Subversion we can down load packages for FFMPEG and Mplayer
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

PS: Please note that now the SNV version has been not updated for a long time so it is good to use git installation instead of SNV: 19-08-2011(Firday)
cd /usr/local/src/
mv /usr/local/src/essential-20061022/* /usr/local/lib/codecs/
chmod -R 755 /usr/local/lib/codecs/

After that We can install one by one packages

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

LIBOGG:-
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/libvorbis-1.1.2
./configure && make && make install

FLVTOOL2:-
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/mplayer
./configure && make && make install

FFMPEG:-
cd /usr/local/src/ffmpeg/
./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
ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52

FFMPEG-PHP Extension:-
cd /usr/local/src/
wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download

[0.50 version throws me error once i have used this version fixed my error]

tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
phpize
./configure
make
make install

make install will shows you the extension file directory for ffmpeg.so. This Exension should be include in your php.ini file

extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/ffmpeg.so

Finally Restart Appache
service httpd restart

Veryfy: Create a info.php file (ie,) and verify this module is loaded or not.

*************************************
While compiling ffmpeg-php Error:ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)

/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_toGDImage’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_ffmpeg_frame’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)


***********************
update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

vi ffmpeg_frame.c

:%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

:w :q!

Solve my issue

**********************
# ffmpeg -v
ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

Fix:
location of these libraries is /usr/local/lib/ such as /usr/local/lib/libavdevice.so.52 .

ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
etc ... like we done for ibavformat.so.50

Or we can fix by

/etc/ld.so.conf.d/libc.conf open with your favourite editor and include this line /usr/local/lib

if /etc/ld.so.conf.d/libc.conf not there create one called /etc/ld.so.conf.d/ffmpeg.conf (or even libc.conf) and add the line /usr/local/lib in it, then run sudo ldconfig -v.


Iam Expecting some valuable suggestions on this posting
 *******

Error :   [STDERR] PHP Warning: Module 'ffmpeg' already loaded in Unknown on line 0

This seems you have multiple entries for ffmpeg.so extension on your php.ini file. So you need to check this file and remove the unwanted extension for ffmpeg.


*** THANK YOU ****

If you want to install ffmpeg and its components on your server please contact me on +91956799499 and i will help on this. Free of cost :)

Enhanced by Zemanta

3 comments:

  1. While compiling ffmpeg-php Error:ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)

    /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_toGDImage’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:336: error: for each function it appears in.) /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function ‘zif_ffmpeg_frame_ffmpeg_frame’: /usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32′ undeclared (first use in this function)

    ReplyDelete
  2. update ffmpeg_frame.c and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

    vi ffmpeg_frame.c

    :%s/PIX_FMT_RGBA32/PIX_FMT_RGB32

    :w :q!

    Solve my issue

    ReplyDelete
  3. # ffmpeg -v
    ffmpeg: error while loading shared libraries: libavdevice.so.52: cannot open shared object file: No such file or directory

    Fix:
    location of these libraries is /usr/local/lib/ such as /usr/local/lib/libavdevice.so.52 .

    ln -s /usr/local/lib/libavdevice.so.52 /usr/lib/libavdevice.so.52
    ln -s /usr/local/lib/libavformat.so.52 /usr/lib/libavformat.so.52
    etc ... like we done for ibavformat.so.50

    Or we can fix by

    /etc/ld.so.conf.d/libc.conf open with your favourite editor and include this line /usr/local/lib

    if /etc/ld.so.conf.d/libc.conf not there create one called /etc/ld.so.conf.d/ffmpeg.conf (or even libc.conf) and add the line /usr/local/lib in it, then run sudo ldconfig -v.

    ReplyDelete