Setup ffmpeg and ffmpeg-php

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:

name=Dag Repository for Red Hat Enterprise

Install Dag GPC Key

rpm --import

Download RPMForge


RHEL5 and CentOS-5

RHEL4 and CentOS-4

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:


Files list:

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:

Make && make install

Install mplayer, Mencoder and flvtool2:

yum install mplayer mencoder flvtool2

Add the text below into php.ini:


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.


/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


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 extension in php.ini and check phpinfo for the server you should see ffmpeg listed.

Print Friendly, PDF & Email



Bài viết liên quan

Be the first to comment

Để lại lời nhắn