Install FFMPEG and ffmpeg-php in CentOS 6 with Virtualmin1 ago-by Daniel- howto centos virtualmin ffmpeg ffmpeg-php
The other day I is requested to set-up few requirements for a client such as mod_rewrite
, GD library
, PHP Dom
, bcmath
etc: and among t Hese in the list there is the FFMPEG
library and the FFMPEG-PHP
extension. OK, no big deal, but this box have CentOS 6 (RHEL6) with Virtualmin/Webmin
set-up on top of it using the base repositories on Ly, so let's do it I said ...
OK, I took the following steps in order to install and set-up FFMPEG and ffmpeg-php in CentOS 6 with Virtualmin
- Update the System
- Install Development Tools
- Protect Base Repositories
- Add Dag ' s repository
- Install FFMPEG
- Install ffmpeg-php
- Load ffmpeg-php Extension
1. Make sure the CentOS 6 system is fully up-to-date
yum update
2. Install Development Tools
yum groupinstall "Development tools"
3. Protect the base repositories so the packages don ' t get updated by the unprotected ones
Install the Protectbase
yum plugin
By
yum install yum-protectbase
And then navigate to/etc/yum.repos.d
cd /etc/yum.repos.d/
Before doing any changes to the repositories and always does backup of the original ones.
cp -prv ../yum.repos.d{,.orig}
In order for a repository to is protected, a line protect=1
needs to is added to each repository sections CentOS-Base.repo
in, and CentOS-Media.repo
c6/>.
So, edit these files using your favourite editor or does the sed
if you ' re feeling brave
sed -i ‘/gpgkey=/a\protect=1‘ CentOS-{Base,Media}.reposed -i ‘/gpgkey=/a\protect=1‘ virtualmin.repo
4. Add dag ' s repository by adding the following to/etc/yum.repos.d/dag.repo
[dag]name=Dag RPM Repository for Red Hat Enterprise Linuxbaseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/daggpgcheck=1gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txtenabled=1protect=0
Next import dag ' s rpm gpg
key by
wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt -P /tmprpm --import /tmp/RPM-GPG-KEY.dag.txt
5. Proceed with installing FFMPEG and some development packages
yum install ffmpeg-devel php-devel re2c php-xml ffmpeg
Verify is FFMPEG
installed successfully by executing
ffmpeg
You should get something like
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developersbuilt on Jan 17:52:15 with GCC 4.4.5 20110214 ( Red Hat 4.4.5-6) configuration:--prefix=/usr--libdir=/usr/lib64--shlibdir=/usr/lib64--mandir=/usr/share/man-- Incdir=/usr/include--disable-avisynth--extra-cflags= '-o2-g-pipe-wall-wp,-d_fortify_source=2-fexceptions- Fstack-protector--param=ssp-buffer-size=4-m64-mtune=generic-fpic '--enable-avfilter--ENABLE-AVFILTER-LAVF-- enable-libdc1394--enable-libdirac--ENABLE-LIBFAAC--enable-libfaad--enable-libfaadbin--enable-libgsm-- Enable-libmp3lame--enable-libopencore-amrnb--ENABLE-LIBOPENCORE-AMRWB--enable-librtmp--enable-libschroedinger- -enable-libspeex--enable-libtheora--enable-libx264--ENABLE-GPL--enable-nonfree--enable-postproc-- Enable-pthreads--enable-shared--enable-swscale--enable-vdpau--enable-version3--enable-x11grablibavutil 50.15. 1/50.15. 1libavcodec 52.72. 2/52.72. 2libavformat 52.64. 2/52.64. 2libavdevice 52. 2.0/52.2.0libavfilter 1.19. 0/1.19. 0libswscale 0.11. 0/0.11. 0libpostproc 51. 2.0/51. 2.0Hyper Fast Audio and Video encoder
6. Compile and install the ffmpeg-php extension
mkdir /srv/buildcd /srv/buildwget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2tar -xjf ffmpeg-php-0.6.0.tbz2cd ffmpeg-php-0.6.0/phpize./configure
Now run the following to prevent compilation failure and something likeffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)
sed -i ‘s#PIX_FMT_RGBA32#PIX_FMT_RGB32#‘ ./ffmpeg_frame.c
and compile and install using
makemake install
You should end and something like
Installing shared extensions: /usr/lib64/php/modules/
7. Load the ffmpeg-php extension and reload Apache
echo -e "extension=ffmpeg.so\n" > /etc/php.d/ffmpeg.ini
Restart the webserver by
/etc/init.d/httpd restart
Verify the FFMPEG-PHP
extension is loaded
php -i | grep ffmpegphp -m | grep ffmpeg
Install FFMPEG and ffmpeg-php in CentOS 6 with Virtualmin