1、添加仓库 导入秘钥 环境:centos6.5 php5.4.29
vi /etc/yum.repos.d/dag.repo[dag]name=Dag RPM Repository for Red Hat Enterprise Linuxbaseurl=http://www.mirrorservice.org/sites/apt.sw.be/redhat/el$releasever/en/$basearch/daggpgcheck=1enabled=1导入签名认证rpm --import http://www.mirrorservice.org/sites/apt.sw.be/RPM-GPG-KEY.dag.txtrpm -ivh http://www.mirrorservice.org/sites/apt.sw.be/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
2、安装ffmpeg
yum install ffmpeg ffmpeg-devel
如果遇到这个错误
Error: Package: librtmp-2.3-1.el6.rf.x86_64 (rpmforge) Require: libgnutls.so.26()(64bit)Error: Package: librtmp-2.3-1.el6.rf.x86_64 (rpmforge) Require: libgnutls.so.26(GNUTLS_1_4)(64bit)
解决方法
yum -y install epel-releaserpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.rorpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpmyum -y install ffmpeg ffmpeg-devel
3、下载 ffmpeg-fpm-0.6.0 如果没有svn 先 yum install svn
svn co svn://svn.code.sf.net/p/ffmpeg-php/code/branches/ffmpeg-php/ffmpeg-php-0.6.0/ /usr/local/src/ffmpeg-php-0.6.0
4、安装
cd /usr/local/src/ffmpeg-php-0.6.0 /usr/bin/phpize./configure --enable-skip-gd-check (不启用此选项的话 安装完会显示 ffmpeg-php gd support => disabled)make
到这里会报错 ,如下
make: *** [ffmpeg_movie.lo] 错误 1
解决办法:
vim ffmpeg_movie.crow 311: list_entry *le; 改为zend_rsrc_list_entry *le;row 346: list_entry new_le;改为 zend_rsrc_list_entry new_le;row 360: hashkey_length+1, (void *)&new_le, sizeof(list_entry),改为hashkey_length+1, (void *)&new_le,sizeof(zend_rsrc_list_entry),
重新make
报错如下:
解决办法:
sed -i 's/PIX_FMT_RGBA32/PIX_FMT_RGB32/g' ffmpeg_frame.c
重新make make install
5、添加PHP配置文件echo "extension = ffmpeg.so" /etc/php.d/ffmpeg.ini
参考资料:
第二次我的是cenos7 用上面的方法安装不行,用源码安装ffmpeg就可以了
参考资料 源码安装
有错误Error: operand type mismatch for `cmp'
解决方法