Php 如何为CentOS 6.5版服务器设置ffmpeg
我需要从视频中创建一个屏幕快照 我已经按照教程在Windows8、PHP5.3中进行了初始设置 1) 我从这里下载了ffmpeg-[ ]对于64位操作系统 2) 我跟踪了视频,成功地完成了所有配置,Php 如何为CentOS 6.5版服务器设置ffmpeg,php,video,ffmpeg,centos,screenshot,Php,Video,Ffmpeg,Centos,Screenshot,我需要从视频中创建一个屏幕快照 我已经按照教程在Windows8、PHP5.3中进行了初始设置 1) 我从这里下载了ffmpeg-[ ]对于64位操作系统 2) 我跟踪了视频,成功地完成了所有配置,phpinfo()显示ffmpeg已安装 3) 然后我试着弄清楚它是否起作用 它成功地工作了 4) 接下来,我学习了这个视频教程,并成功地创建了缩略图 下面是我的代码 /** * FFMPEG-PHP Test Script * * Special thanks to http://www.sa
phpinfo()
显示ffmpeg
已安装
3) 然后我试着弄清楚它是否起作用
它成功地工作了
4) 接下来,我学习了这个视频教程,并成功地创建了缩略图
下面是我的代码
/**
* FFMPEG-PHP Test Script
*
* Special thanks to http://www.sajithmr.me/ffmpeg-sample-code for this code example!
* See the tutorial at http://myownhomeserver.com on how to install ffmpeg-php.
*/
error_reporting(1);
error_reporting(E_ALL ^ E_NOTICE);
// Check if the ffmpeg-php extension is loaded first
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
// Determine the full path for our video
$vid = realpath('./videos/myvideo.mp4');
$videosize = filesize($vid);
$remoteVideo = 'http://video-js.zencoder.com/oceans-clip.mp4';
//ffmpeg
$ffmpeg = dirname(__FILE__) . "\\ffmpeg\\bin\\ffmpeg";
$imageFile = "1.png";
$image2 = "2.png";
$size = "120x90";
$getfromsecond = 7;
$cmd = "$ffmpeg -i $vid -an -ss $getfromsecond -s $size $imageFile";
$cmd2 = "$ffmpeg -i $remoteVideo -an -ss $getfromsecond -s $size $image2";
if(!shell_exec($cmd)){
echo "Thumbnail created";
}else{
echo "Error Creating thumbnail";
}
if(!shell_exec($cmd2)){
echo "Thumbnail for remote url was created";
}else{
echo "Error Creating thumbnail for remote url ";
}
现在,上面的代码在我的本地窗口机器中按预期工作,我需要在我的服务器环境(Linux服务器)中使用PHP5.5来完成。如何使用PHP5.5在CentOS 6.5版服务器中配置ffmpeg 我按照本教程在服务器中安装了它 一, 二, 控制台中的输出 但是在服务器中,当我打开我的php文件时,我在加载ffmpeg时遇到了这个错误
错误
我还检查了phpinfo(),它显示ffmpeg安装在我的本地服务器上,但没有安装在服务器上
在Cent Os 6.5 php 5.5中配置ffmpeg还需要做些什么。我找不到您的安装步骤或命令,您需要使用ffmpeg php进行配置
# git clone https://github.com/tony2001/ffmpeg-php.git
# cd ffmpeg-php
# make clean
# phpize
# ./configure
# make
# make install
# vim /usr/lib/php.ini
[ffmpeg]
extension=ffmpeg.so
# pkill -9 httpd
# /etc/init.d/httpd start
# php -i|grep ffmpeg
ffmpeg
ffmpeg-php version => 0.7.0
您在linux设备上有root访问权限吗?安装了什么Linux?可能它已经安装了带有
哪个ffmpeg
的签入控制台,它将为您提供ffmpeg的完整路径,所以只需替换$ffmpeg
变量中的路径,它没有安装我已经检查过对不起,伙计们,我与团队检查过它是CentOS 6.5版。。。我在加载ffmpeg时遇到错误error
它似乎已安装,但在检查已加载的扩展(“ffmpeg”)或die(“加载ffmpeg时出错”)时,它抛出了错误代码>。。。。
[root@BRANDWEB01D ~]# ffmpeg -version
ffmpeg version 2.2.1
built on Apr 13 2014 13:00:18 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
[root@BRANDWEB01D ~]# which ffmpeg
/usr/bin/ffmpeg
[root@BRANDWEB01D ~]# ffmpeg -formats
ffmpeg version 2.2.1 Copyright (coffee) 2000-2014 the FFmpeg developers
built on Apr 13 2014 13:00:18 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --enable-shared --enable-runtime-cpudetect --enable-gpl --enable-version3 --enable-postproc --enable-avfilter --enable-pthreads --enable-x11grab --enable-vdpau --disable-avisynth --enable-frei0r --enable-libopencv --enable-libdc1394 --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librtmp --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --extra-cflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC' --disable-stripping
libavutil 52. 66.100 / 52. 66.100
libavcodec 55. 52.102 / 55. 52.102
libavformat 55. 33.100 / 55. 33.100
libavdevice 55. 10.100 / 55. 10.100
libavfilter 4. 2.100 / 4. 2.100
libswscale 2. 5.102 / 2. 5.102
libswresample 0. 18.100 / 0. 18.100
libpostproc 52. 3.100 / 52. 3.100
File formats:
D. = Demuxing supported
.E = Muxing supported
# git clone https://github.com/tony2001/ffmpeg-php.git
# cd ffmpeg-php
# make clean
# phpize
# ./configure
# make
# make install
# vim /usr/lib/php.ini
[ffmpeg]
extension=ffmpeg.so
# pkill -9 httpd
# /etc/init.d/httpd start
# php -i|grep ffmpeg
ffmpeg
ffmpeg-php version => 0.7.0