GIT – Setup ffmpeg and ffmpeg- : ffmpeg is a versatile tool that can record, convert and stream digital audio and video in numerous formats. ffmpeg- is an extension of that provides a simple way for user to accessing and retrieving information from video and audio files.

Best of all, it support object-oriented API which mean you are given the right to integrate it to your program using the common OOP (object orientated Programing). It has noble way to convert movie’s frame files to images files that can manipulate and utilize by PHP’s image functions. This effectively works for creating thumbnail images from movies automatically.

ffmpeg on RedHat and  

Add Dag Repository – Create a file /etc/yum.repos.d/dag.repo. Add the text below:

[dag]
name=Dag Repository for Red Hat Enterprise
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

Install Dag GPC Key

rpm --import http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt

Download RPMForge

RHEL6
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

RHEL5 and CentOS-5
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.i386.rpm
x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm

RHEL4 and CentOS-4
i386: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el4.rf.i386.rpm
x86_64: http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el4.rf.x86_64.rpm

Install RPMGorge Package:

rpm –Uhv rpmforge-release-0.5.1-1.el*.rf.*.rpm

Install ffmpeg Package:

yum install ffmpeg

Check ffmpeg Version:

ffmpeg -version

Continue for installing ffmpeg-php

Compile dynamic extensions to ffmpeg:

yum install ffmpeg-devel

Download ffmpeg-php:

wget http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2/download


Files list: http://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/

Extract ffmpeg-php:

tar -xjf ffmpeg-php-0.6.0.tbz2

Go into ffmpeg-php directory:

cd ffmpeg-php-0.6.0

Compile dynamic extensions to PHP:

yum install php-devel

Configure and install ffmpeg-php:

phpize
./configure
Make && make install

Install mplayer, Mencoder and flvtool2:

yum install mplayer mencoder flvtool2

Add the text below into php.ini:

[ffmpeg]
extension=ffmpeg.so

Restart your web master and installation complete!

ffmpeg-php compile error – make: *** [ffmpeg_frame.lo] Error 1

If you are getting the following error while compiling the latest release of ffmpeg-php-0.6.0 , This will article will let you know how to get this fix.

Error:

/usr/src/ffmpeg-php-0.6.0/ffmpeg_frame.c: In function âzim_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 âzim_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)
make: *** [ffmpeg_frame.lo] Error 1

Solution:

Under the ffmpeg-php-0.6.0 directory modify the file: ffmpeg_frame.c with nano or vi editor and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32

# nano ffmpeg_frame.c
# Search for PIX_FMT_RGBA32 and replace it with PIX_FMT_RGB32
# Exit from the editor

Then run the following commands:

# cd /usr/local/src/ffmpeg-php-0.6.0
# cp -aP ffmpeg_frame.loT ffmpeg_frame.lo
# make clean
# ./configure
#   make
#   make install

This should fix the errors given above. Finally add the ffmpeg.so extension in php.ini and check phpinfo for the server you should see ffmpeg listed.

Print Friendly

Comments

comments

Bài viết liên quan