Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin
Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin
The other day I was requested to set-up few requirements for a client such as mod_rewrite
, GD library
, PHP Dom
, bcmath
etc.. and among these in the list there was theFFMPEG
library and the FFMPEG-PHP
extension. OK, no big deal, but this box has CentOS 6 (RHEL6) with Virtualmin/Webmin
set-up on top of it using the base repositories only, 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, always do backup of the original ones.
cp -prv ../yum.repos.d{,.orig}
in order for a repository to be protected, a line protect=1
needs to be added to each repository section in CentOS-Base.repo
, CentOS-Media.repo
and virtualmin.repo
.
So, edit these files using your favourite editor or do the sed
if you're feeling brave
sed -i '/gpgkey=/a\protect=1' CentOS-{Base,Media}.repo
sed -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 Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
enabled=1
protect=0
next import dag's rpm gpg
key by
wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt -P /tmp
rpm --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 FFMPEG
is installed successfully by executing
ffmpeg
you should get something like
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 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-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
6. Compile and install the FFMPEG-PHP extension
mkdir /srv/build
cd /srv/build
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/
phpize
./configure
now run the following to prevent compilation failure with something like ffmpeg_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
make
make install
you should end up with 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 that the FFMPEG-PHP
extension is loaded
php -i | grep ffmpeg
php -m | grep ffmpeg
最新文章
- JSTL标签库
- 按钮在cell上的高亮状态出现的慢
- 一、swoole安装
- 使用Python一步一步地来进行数据分析总结
- 自动装配【Spring autowire】
- Html5实现头像上传和编辑,保存为Base64的图片过程
- 【转】深入理解Java内存模型(一)——基础
- 使用AFNetworking请求新浪微博数据接口出错解决办法
- weblogic一些基本概念
- 用Eclipse 统计代码行数小技巧
- Object-C知识点 (一) 常用知识点
- 【原】Sql Server 2008---安装时卸载Visual Studio
- 【20190305】CSS-响应式图片:srcset+sizes,picture,svg
- django虚拟环境安装
- 使用while和read命令读取文件内容
- [转载]MACD 各周期指标状态
- spring——事务管理
- LeetCode--231--2的幂函
- Extjs4处理后台json数据中日期和时间的方法
- 根据模板导出excel
热门文章
- [NOI2007 Day1] 货币兑换 Cash
- c/c++面试题(3)strcat/strcmp/strlen/strcpy的实现
- 性能测试报告的指标选择、数据选择和分析的参考【以Apache AB test为例】
- 在你决定从事iOS开发前需要清楚的几个问题
- 安装生物信息学软件-R
- PATH变量
- jQuery 中 offset()方法与用position()的区别
- Kerberos安装及使用
- toad 9.6和toad 12.1工具使用比较
- JSONObject转换JSON--将Date转换为指定格式