HowTo install and configure FFmpeg and FFmpeg-Php on a DA server

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,285
I saw this headline on another part of the forum and the instructions I thought were a lot more than was needed. And that might be fine for some but I thought I would post a much shorter process. Here is what I do on my servers running CentOS. Its so easy that I just do it by default on every server I set up.

Code:
# Install FFMPEG CentOS
cd /root
echo "[dag]" > /etc/yum.repos.d/dag.repo
echo "name=Dag RPM Repository for Red Hat Enterprise Linux" >> /etc/yum.repos.d/dag.repo
echo "baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag" >> /etc/yum.repos.d/dag.repo
echo "gpgcheck=0" >> /etc/yum.repos.d/dag.repo
echo "enabled=1" >> /etc/yum.repos.d/dag.repo

yum -y install ffmpeg ffmpeg-devel flvtool2 mencoder
wget http://internap.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
/usr/local/bin/phpize
./configure --with-php-config=/usr/local/bin/php-config
make
make install
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /usr/local/lib/php/extensions/
echo "extension=ffmpeg.so" >> /etc/php.ini
service httpd restart
 

nimafire

Verified User
Joined
Aug 10, 2008
Messages
246
tnx alot floyd.
and can i know what FFmpeg and FFmpeg-Php do exactly ?

i mean where (which server)should us install it?
on share server... ..?
on forum server...?
multimedia server (for online radio shoutcast and ... )

tnx
 

jonn

Verified User
Joined
Mar 29, 2009
Messages
112
Location
Queensland, Australia.
trying re-install got error

Hi Floyd, my server dont like my audio files, keeps spiiting out in logs:
Code:
/usr/bin/mencoder: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/bin/mencoder)
/usr/bin/mplayer: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/bin/mplayer)
/usr/bin/mplayer: /usr/local/lib/libpng12.so.0: no version information available (required by /usr/lib/libcairo.so.2)
Cannot find HOME directory.
Seek failed
So i tried to re-install, got this.

Code:
[root@ns1 ~]# cd /root
[root@ns1 ~]# echo "[dag]" > /etc/yum.repos.d/dag.repo
[root@ns1 ~]# echo "name=Dag RPM Repository for Red Hat Enterprise Linux" >> /etc/yum.repos.d/dag.repo
[root@ns1 ~]# echo "baseurl=http://apt.sw.be/redhat/el\$releasever/en/\$basearch/dag" >> /etc/yum.repos.d/dag.repo
[root@ns1 ~]# echo "gpgcheck=0" >> /etc/yum.repos.d/dag.repo
[root@ns1 ~]# echo "enabled=1" >> /etc/yum.repos.d/dag.repo
[root@ns1 ~]#
[root@ns1 ~]# yum -y install ffmpeg ffmpeg-devel flvtool2 mencoder
Loading "fastestmirror" plugin
rpmdb: Lock table is out of available locker entries
rpmdb: Unknown locker ID: 9c32
error: db4 error(22) from db->close: Invalid argument
error: cannot open Providename index using db3 - Cannot allocate memory (12)
Determining fastest mirrors
 * dag: apt.sw.be
YumRepo Warning: not using ftp, http[s], or file for repos, skipping - $releasever is not a valid release or hasnt been released yet
removing mirrorlist with no valid mirrors: //var/cache/yum/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
[root@ns1 ~]#
any solutions, change in mirrors.
 

nealdxmhost

Verified User
Joined
Jan 1, 2009
Messages
234
Location
Los Angeles CA
When I try to install ffmpeg-php I get this when I run make test

Code:
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/p                                                                              hp/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/local/php5/lib/php/ext                                                                              ensions/no-debug-non-zts-20060613/ffmpeg.so: cannot open shared object file: No                                                                               such file or directory in Unknown on line 0
PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/local/php5/lib/p                                                                              hp/extensions/no-debug-non-zts-20060613/ffmpeg.so' - /usr/local/php5/lib/php/ext                                                                              ensions/no-debug-non-zts-20060613/ffmpeg.so: cannot open shared object file: No                                                                               such file or directory in Unknown on line 0
PHP Warning:  Module 'ffmpeg' already loaded in Unknown on line 0

Warning: Module 'ffmpeg' already loaded in Unknown on line 0
PHP Warning:  Module 'ffmpeg' already loaded in Unknown on line 0

Warning: Module 'ffmpeg' already loaded in Unknown on line 0
PHP Warning:  Module 'ffmpeg' already loaded in Unknown on line 0

Warning: Module 'ffmpeg' already loaded in Unknown on line 0
PHP Warning:  Module 'ffmpeg' already loaded in Unknown on line 0

Warning: Module 'ffmpeg' already loaded in Unknown on line 0

=====================================================================
PHP         : /usr/local/bin/php
PHP_SAPI    : cli
PHP_VERSION : 5.2.13
ZEND_VERSION: 2.2.0
PHP_OS      : Linux - Linux cp.dxmhosting.com 2.6.18-164.11.1.el5 #1 SMP Wed Jan                                                                               20 07:32:21 EST 2010 x86_64
INI actual  : /usr/local/etc/php5/cgi/php.ini
More .INIs  :
CWD         : /root/ffmpeg-php-0.6.0
Extra dirs  :
VALGRIND    : Not used
=====================================================================
Running selected tests.
FAIL ffmpeg getAudioBitRate test [tests/getAudioBitRate.phpt]
FAIL ffmpeg getAudioChannels test [tests/getAudioChannels.phpt]
FAIL ffmpeg getAudioCodec test [tests/getAudioCodec.phpt]
FAIL ffmpeg getAudioSampleRate test [tests/getAudioSampleRate.phpt]
FAIL ffmpeg getAudioStreamId test [tests/getAudioStreamId.phpt]
FAIL ffmpeg getBitRate test [tests/getBitRate.phpt]
FAIL ffmpeg getDuration test [tests/getDuration.phpt]
FAIL ffmpeg getFileName test [tests/getFileName.phpt]
FAIL ffmpeg getFrame test [tests/getFrame.phpt]
FAIL ffmpeg getFrameCount test [tests/getFrameCount.phpt]
FAIL ffmpeg getFrameHeight test [tests/getFrameHeight.phpt]
FAIL ffmpeg getFrameNumber test [tests/getFrameNumber.phpt]
FAIL ffmpeg getFrameRate test [tests/getFrameRate.phpt]
FAIL ffmpeg getFrameWidth test [tests/getFrameWidth.phpt]
FAIL ffmpeg getFrame backwards test [tests/getFramesBackwards.phpt]
FAIL ffmpeg getFrames forward test [tests/getFramesForward.phpt]
FAIL ffmpeg getFrames forward test [tests/getFramesForwardPassedEnd.phpt]
FAIL ffmpeg getFramesNoArg test [tests/getFramesNoArg.phpt]
FAIL ffmpeg getID3Info() test [tests/getID3Info.phpt]
FAIL ffmpeg get key frames test [tests/getNextKeyFrame.phpt]
FAIL ffmpeg getPTS test (Fixme: This test is no good with robot.avi) [tests/getP                                                                              TS.phpt]
FAIL ffmpeg getPixelAspectRatio test [tests/getPixelAspectRatio.phpt]
FAIL ffmpeg getPixelFormat test [tests/getPixelFormat.phpt]
FAIL ffmpeg getVideoBitRate test [tests/getVideoBitRate.phpt]
FAIL ffmpeg getVideoCodec test [tests/getVideoCodec.phpt]
FAIL ffmpeg getVideoStreamId test [tests/getVideoStreamId.phpt]
FAIL ffmpeg hasAudio test [tests/hasAudio.phpt]
FAIL ffmpeg test key frame [tests/isKeyFrame.phpt]
FAIL ffmpeg persistent movie test [tests/persistentMovie.phpt]
=====================================================================
Number of tests :   29                29
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   29 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :   22 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
ffmpeg getAudioBitRate test [tests/getAudioBitRate.phpt]
ffmpeg getAudioChannels test [tests/getAudioChannels.phpt]
ffmpeg getAudioCodec test [tests/getAudioCodec.phpt]
ffmpeg getAudioSampleRate test [tests/getAudioSampleRate.phpt]
ffmpeg getAudioStreamId test [tests/getAudioStreamId.phpt]
ffmpeg getBitRate test [tests/getBitRate.phpt]
ffmpeg getDuration test [tests/getDuration.phpt]
ffmpeg getFileName test [tests/getFileName.phpt]
ffmpeg getFrame test [tests/getFrame.phpt]
ffmpeg getFrameCount test [tests/getFrameCount.phpt]
ffmpeg getFrameHeight test [tests/getFrameHeight.phpt]
ffmpeg getFrameNumber test [tests/getFrameNumber.phpt]
ffmpeg getFrameRate test [tests/getFrameRate.phpt]
ffmpeg getFrameWidth test [tests/getFrameWidth.phpt]
ffmpeg getFrame backwards test [tests/getFramesBackwards.phpt]
ffmpeg getFrames forward test [tests/getFramesForward.phpt]
ffmpeg getFrames forward test [tests/getFramesForwardPassedEnd.phpt]
ffmpeg getFramesNoArg test [tests/getFramesNoArg.phpt]
ffmpeg getID3Info() test [tests/getID3Info.phpt]
ffmpeg get key frames test [tests/getNextKeyFrame.phpt]
ffmpeg getPTS test (Fixme: This test is no good with robot.avi) [tests/getPTS.ph                                                                              pt]
ffmpeg getPixelAspectRatio test [tests/getPixelAspectRatio.phpt]
ffmpeg getPixelFormat test [tests/getPixelFormat.phpt]
ffmpeg getVideoBitRate test [tests/getVideoBitRate.phpt]
ffmpeg getVideoCodec test [tests/getVideoCodec.phpt]
ffmpeg getVideoStreamId test [tests/getVideoStreamId.phpt]
ffmpeg hasAudio test [tests/hasAudio.phpt]
ffmpeg test key frame [tests/isKeyFrame.phpt]
ffmpeg persistent movie test [tests/persistentMovie.phpt]
=====================================================================
and the result being that it fails.

what am I doing wrong?????
 

jonn

Verified User
Joined
Mar 29, 2009
Messages
112
Location
Queensland, Australia.
@floyd

installed okay, excluding replacing .Lot error then it installed perfect. now......

coverts audio ok, doesnt convert video.

error.
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al. configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --extra-cflags=-fPIC --enable-libamr-nb --enable-libamr-wb --enable-libdirac --enable-libfaac --enable-libfaad --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-x11grab libavutil 49.15. 0 / 49.15. 0 libavcodec 52.20. 0 / 52.72. 0 libavformat 52.31. 0 / 52.67. 0 libavdevice 52. 1. 0 / 52. 2. 0 libswscale 0. 7. 1 / 0.10. 0 libpostproc 51. 2. 0 / 51. 2. 0 built on Nov 6 2009 19:11:04, gcc: 4.1.2 20080704 (Red Hat 4.1.2-46) Stream mapping: Stream #0.0 -> #0.0 Press [q] to stop encoding /usr/bin/ffmpeg: symbol lookup error: /usr/bin/ffmpeg: undefined symbol: frame_hook_process

???
 

floyd

Verified User
Joined
Mar 29, 2005
Messages
5,285
I only posted what worked for me. If you need help diagnosing problems you have on your particular setup then several on this forum are available for hire.
 

daveyw

Verified User
Joined
Jan 5, 2008
Messages
702
Location
/dev/null
For the people that wanna know: Used the instructions of floyd without any problems on our CentOS boxes.

Thanks Floyd!
 

groomy

Verified User
Joined
Dec 16, 2011
Messages
261
Location
AUGNY (France)
hi, i have a problem with this code
./configure --with-php-config=/usr/local/bin/php-config
make
make install
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /usr/local/lib/php/extensions/
echo "extension=ffmpeg.so" >> /etc/php.ini
service httpd restart
after
./configure --with-php-config=/usr/local/bin/php-config
i have
-bash: ./configure: No such file or directory
thanks
 
Last edited:

groomy

Verified User
Joined
Dec 16, 2011
Messages
261
Location
AUGNY (France)
the problem is autoconf , i intall and after i have a prblem with
cp /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so /usr/local/lib/php/extensions/
I don't have this folder in my server , i don't no where ffmpeg is ?
Thanks
 

chatwizrd

Verified User
Joined
Jul 3, 2005
Messages
2,007
If you dont have the ./configure script then you are in the wrong folder.

Your php install might use a different folder. You can just search for the file like this:

Code:
find / -name "ffmpeg.so"
 

groomy

Verified User
Joined
Dec 16, 2011
Messages
261
Location
AUGNY (France)
Hi, thanks.
I dont have a result for this code.
my serveur is centos 5.3, directadmin and custombuild 1 and suphp ..
Grrrrrrr
 

nobaloney

NoBaloney Internet Svcs - In Memoriam †
Joined
Jun 16, 2003
Messages
26,119
Location
California
Try:
Code:
# locate ffmpeg.so
Of course without the # mark, which is only to show you that you run this as root.

If you still don't get any return then ffmpeg isn't installed.

Jeff
 

rsdrsd

Verified User
Joined
Jan 12, 2013
Messages
10
Isn't it better for CentOS to follow the guide on the FFMpeg page. The version of FFMpeg is very old in the DAG repo.
 

SupermanInNY

Verified User
Joined
Sep 28, 2004
Messages
350
In case you are running PHP 5.4 and get 'make' errors of

ffmpeg_movie.c:311: error: ‘list_entry’ undeclared (first use in this function)

(or something like that),. then see the solution proposed here: http://sourceforge.net/p/ffmpeg-php/bugs/52/#2fe8
Contributed by user CentTom

Changes in ffmpeg_movie.c:

row 311: list_entry *le; TO zend_rsrc_list_entry *le;
row 346: list_entry new_le; TO zend_rsrc_list_entry new_le;
row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry), TO hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),

Thats all... change it and make it
Worked for me.

-Sup.
 
Top