-
21
May
In this how to i will describe how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert / manipulate videos easily on CentOS 5.x. If you want to run sites like youtube e.g www.indianpad.in, www.danceindiadance.in this howto will help you to install the base for your software. There are many other way to perform this but this works for me, so i want to share.
1 Setting Up RPMForge Respository.
RPMForge repository (http://dag.wieers.com) is the biggest rpm respository for RHEL, CentOS for all versions. To enable RPMForge respository run following command to install all necessary files for getting RPMForge repository. The following command directly install rpm from http://da.wieers.com site.
rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
This rpm will add necessary files in our repository configuration and can be viewed at /etc/yum.repos.d/rpmforge.repo
2 Install ffmpeg, mplayer, mencoder with all supported modules.
Now we have rpmforge repository, so we will use yum to install ffmpeg, mplayer, mencoder as well as all dependent software.
yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2
This command will some time to download and install all packages depends on your internet speed.
3 Install FFMPEG-PHP
ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. ffmpeg-devel and php-devel is needed to compile ffmpeg-php from source code. Use following steps to install ffmpeg-php
cd /usr/src
wget http://garr.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.6.0.tbz2
tar jxvf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0
phpize
./configure
make
make install
It will copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.
vi /etc/php.ini
and append following line
extension=ffmpeg.so
Restart apache service to take effect of php.ini
/etc/init.d/httpd restart
Run following command to ffmpeg module listing in php.
php -m | grep ffmpeg
Have a nice streaming.
- Published by Sohail Riaz in: Linux ffmpeg
- If you like this blog please take a second from your precious time and subscribe to my rss feed!











31 Responses to “How To Install FFmpeg, Mplayer, Mencoder, FFmpeg-PHP on CentOS 5.x”
after running
php -m | grep ffmpeg
i m getting the following error:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – libavformat.so.51: cannot open shared object file: No such file or directory in Unknown on line 0
so i checked about file:
libavformat.so.51
and i cant find in anywhere
can you please check this software, does it has any update version.
ffmpeg-php-0.6.0.tbz2
If yes compile that instead of it.
Regards,
awesome, installed everything without a glitch. Works a treat, thank you.
Centos 5.3
Yeah, I followed this verbatim and it didn’t work on Centos 5.3 – fresh installation too. Make test fails and despite not giving errors php doesn’t show it in php test
@Mike: Can you describe what fails. First of assure you have install ffmpeg, mplayer, mencoder and ffmpeg-php installed correctly. For this execute following commands and you should see some help
ffmpeg
mplayer
mencoder
———–
For ffmpeg-php, you should see ffmpeg module in phpinfo, you can see on shell by issuing following command
php -m | grep -i ffmpeg
——
Regards,
Hi!
I m having also issues with Centos 64bit.
This is what i get when i run your commands:
ffmpeg:
FFmpeg version SVN-r19583, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –enable-libmp3lame –disable-mmx –enable-shared
libavutil 50. 3. 0 / 50. 3. 0
libavcodec 52.32. 0 / 52.32. 0
libavformat 52.37. 0 / 52.37. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 7. 1 / 0. 7. 1
built on Sep 18 2009 10:48:22, gcc: 4.1.2 20080704 (Red Hat 4.1.2-44)
mplayer:
MPlayer SVN-r29475-4.1.2 (C) 2000-2009 MPlayer Team
mencoder:
MEncoder SVN-r29475-4.1.2 (C) 2000-2009 MPlayer Team
No file given
Exiting… (error parsing command line)
after restarting php and running
php -r ‘phpinfo();’ | grep ffmpeg
i get the following:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so/libavformat.so.51: cannot open shared object file: No such file or directory in Unknown on line 0
after doing an ls for usr/lib for libavformat.so.51 i get a result for libavformat.so.51 in red background.
While ls /usr/lib64/libavformat.so.51
give a not found message.
Since i m in 64bit i believe the lib should be found under lib64
@Makis: FFMPEG with Mplayer and Mencoder installation is successful. The issue is with ffmpeg-php module.
php should load
/usr/lib64/php/modules/ffmpeg.so
not
/usr/lib64/php/modules/ffmpeg.so/libavformat.so.51
—————–
Whats you have in your php.ini for ffmpeg
———
Regards,
I m trying this installation for the last 3 hours
Managed to get ffmpeg working since i get all my videos converted successfully but i noticed that my video length is not calculated properly so i guess ffmpeg-php is not working as it should.
ffmpeg give me this:
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –enable-gpl
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
built on Sep 20 2009 15:47:16, gcc: 4.1.2 20080704 (Red Hat 4.1.2-44)
At least one output file must be specified
php -i | grep -i ffmpeg
gives me this:
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: img_convert in Unknown on line 0
PWD => /usr/local/src/ffmpeg-0.5
_SERVER["PWD"] => /usr/local/src/ffmpeg-0.5
_ENV["PWD"] => /usr/local/src/ffmpeg-0.5
my php.ini has the following:
[ffmpeg]
extension=ffmpeg.so
ps: thank you for helping us out
A similar guide which I have created: http://lijeesh.in/ffmpeg-install-guide-for-centos-cpanel/
When I am at your step 2, I ran into this error:
flvtool2-1.0.6-1.el5.rf.noarch from rpmforge has depsolving problems
–> Missing Dependency: ruby is needed by package flvtool2-1.0.6-1.el5.rf.noarch (rpmforge)
flvtool2-1.0.6-1.el5.rf.noarch from rpmforge has depsolving problems
–> Missing Dependency: /usr/bin/ruby is needed by package flvtool2-1.0.6-1.el5.rf.noarch (rpmforge)
Error: Missing Dependency: ruby is needed by package flvtool2-1.0.6-1.el5.rf.noarch (rpmforge)
Error: Missing Dependency: /usr/bin/ruby is needed by package flvtool2-1.0.6-1.el5.rf.noarch (rpmforge)
At the end of the installation. Can you show me how to fix this?
@Michael: its seems your centos default repository doesnt contain ruby rpm. You can first clean yum cache and then try to install ruby first
yum clean all
yum -y install ruby
——————-
If again says nothing to do, please install ruby rpm manually from http://www.centos.org for correct OS. then reapply step 2 again.
——–
Regards,
I have done all things as said but phpize commant not working.
Now i have installed phpize. then after i get this error
phpize
Configuring for:
PHP Api Version: 20041225
Zend Module Api No: 20060613
Zend Extension Api No: 220060519
[root@air923 ffmpeg-php-0.6.0]#
[root@air923 ffmpeg-php-0.6.0]# ./configure
checking for egrep… grep -E
checking for a sed that does not truncate output… //bin/sed
checking for cc… no
checking for gcc… no
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.
[root@air923 ffmpeg-php-0.6.0]#
@Raj: Your machine didnt have compilers to compile ffmpeg-php, kindly execute following command then do ./configure
——–
yum -y groupinstall “Development Tools”
——–
Regards,
Thanks i have now installed Development Tools. But i have another problem, because i am newbie in linux, ssh etc.
I typed vi /etc/php.ini and closed the session.
Then i logged in again. then it shows me about the php.ini swap files exist.
i have now
php.ini.rpmnew
php.ini_saved_by_psa
And i have deleted my original php.ini file by misstake.
How can i delete the swap files. and is php.ini.rpmnew the new file?
Now i have to do following delete swap files. and resotre old php.ini or do i have to rename php.ini.rpm to php.ini?
Please help
It’s cool. work great
i m still getting this error after
php -i | grep -i ffmpeg
—-
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: img_convert in Unknown on line 0
—-
any help?
@Makis: Kindly confirm that you have following software installed…. you can get your answer by running following commands.
yum list | grep gd
php -m | grep -i gd
Well for yum list | grep gd i get:
–
Not using downloaded repomd.xml because
it is older than what we have:
Current : Sun Dec 27 05:43:47 2009
Downloaded: Fri Nov 27 05:35:18 2009
– gd.i386
2.0.33-9.4.el5_1.1(installed)
– gd.x86_64
2.0.33-9.4.el5_1.1(installed)
– gd-devel.i386
2.0.33-9.4.el5_1.(installed)
– gd-devel.x86_64
2.0.33-9.4.el5_1.1(installed)
– gdb.x86_64
6.8-37.el5(installed)
– gdbm.i386
1.8.0-26.2.1(installed)
– gdbm.x86_64
.8.0-26.2.1(installed)
– php-gd.x86_64
5.2.11-2.el5.art(installed)
– sysklogd.x86_64
1.4.1-44.el5(installed)
– aspell-gd.x86_64
50:0.50-4.2.2(base)
– eggdrop.x86_64
1.6.19-1.el5.rf(dag)
– gd-progs.x86_64
2.0.33-9.4.el5_1.1(base)
– gdal.x86_64
1.4.4-2.el5.rf(dag)
– gdal-devel.x86_64
1.4.4-2.el5.rf(dag)
– gdbm-devel.i386
1.8.0-26.2.1(base)
– gdbm-devel.x86_64
1.8.0-26.2.1(base)
– gdk-pixbuf.i386
1:0.22.0-25.el5(base)
– gdk-pixbuf.x86_64
1:0.22.0-25.el5(base)
– gdk-pixbuf-devel.i386
1:0.22.0-25.el5(base)
– gdk-pixbuf-devel.x86_64
1:0.22.0-25.el5(base)
– gdm.x86_64
1:2.16.0-56.el5.centos(base)
– gdm-docs.x86_64
1:2.16.0-56.el5.centos(base)
– jigdo.x86_64
0.7.3-1.el5.rf(dag)
– libgdiplus.x86_64
1.2.5-1.el5.centos(extras)
– libgdiplus-devel.x86_64
1.2.5-1.el5.centos(extras)
–
and for php -m | grep -i gd i get:
–
PHP Warning: PHP Startup:
Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so:
cannot open shared object file:
No such file or directory in Unknown on line 0
gd
–
please disregard my reply regarding php -m | grep -i gd
because i got the wrong copy paste.
The real output after running php -m | grep -i gd is:
–
PHP Warning: PHP Startup:
Unable to load dynamic library ‘/usr/lib64/php/modules/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: ffmpeg_img_convert in Unknown on line 0
–
@makis: put full output of
php -m
because in first output its clear that gd is installed… but in second ouput it shows its not installed.
do php -m and if the list contain gd then its good. else please install gd module for php.
Regards,
here you go:
—
PHP Warning: PHP Startup: Unable to load dynamic library ‘/usr/lib64/php/module s/ffmpeg.so’ – /usr/lib64/php/modules/ffmpeg.so: undefined symbol: ffmpeg_img_co nvert in Unknown on line 0
[PHP Modules]
bcmath
bz2
calendar
ctype
curl
date
dbase
dom
exif
filter
ftp
gd
gettext
gmp
hash
iconv
imap
ionCube Loader
json
ldap
libxml
mysql
mysqli
odbc
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_ODBC
pdo_sqlite
phpSHIELD
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
standard
tokenizer
wddx
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend Optimizer
zip
zlib
[Zend Modules]
Zend Optimizer
the ionCube PHP Loader
—
Note: If you’re on WHM / cPanel, you need to edit /etc/yum.conf and remove the ruby* entry under exclusions so you can install ruby.
Sorry for the newbie question but how do I connect to the server in the first place? Do I use WinSCP for that or what client should I use? I’m pretty sure that I can follow the steps in this “how to” but I’m missing the very first step which is what client to use and how to connect to my server.
Thanks in advance.
@Jerry: Please download Putty and connect your server with Putty. You can download it from here.
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
WinSCP is ftp like file transfer software, so use it when you need to transfer anything to and from server
——–
Regards,
I was trying to install ffmpeg-php on Fedora9, I’ve downloaded the ffpmeg-php-0.6.0 and used phpize and ./configure –enable-shared –prefix=/usr and both of them workrd find but when I tried to run make I got the following error:
“make: *** No targets specified and no makefile found. Stop.”
I tried the same procedure with ffmpeg-php-0.5.1 and ffmpeg-0.5.0 but failed.
Can anyone help me with this.
I was trying to install ffmpeg-php on Fedora9, I’ve downloaded the ffpmeg-php-0.6.0 and used phpize and ./configure –enable-shared –prefix=/usr and both of them worked fine but when I tried to run make I got the following error:
“make: *** No targets specified and no makefile found. Stop.”
I tried the same procedure with ffmpeg-php-0.5.1 and ffmpeg-0.5.0 but failed.
Can anyone help with this.
@Sayan: Make sure your ./configure execute correctly and generate Makefile. If possible put last 10 lines from ./configure
————–
Regards,
GREAT ! i INSTALLED SUCCESFULLY.
BUT CONVERSION OF 3GP FILE IS PLAYING TOO FAST WITH NO SOUND AND CONVERSION OF X264 IS PLAYING WITH NO SOUND.
ANY ISSUE ?..
THANKS ANY WAY…..
I have installed to Centos 5.3 with your instruction:
ffmpeg: error while loading shared libraries: libavutil.so.50 No Such file or directory.
I have found only libavutil.so.49……. What is the problem?
Any solution?
Leave a Reply