FFmpeg 安装以及 windows linux环境使用


Centos history 
#安装依赖程序
 2227  2017-05-04 04:39:04 root wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
 2228  2017-05-04 04:39:21 root tar -zxvf yasm-1.3.0.tar.gz
 2229  2017-05-04 04:39:25 root cd yasm-1.3.0
 2230  2017-05-04 04:39:34 root ./configure
 2231  2017-05-04 04:39:49 root make && make install
#安装ffmpeg
 2233  2017-05-04 04:40:35 root wget http://www.ffmpeg.org/releases/ffmpeg-3.1.tar.gz
 2234  2017-05-04 04:40:47 root tar -zxvf ffmpeg-3.1.tar.gz
 2235  2017-05-04 04:40:51 root cd ffmpeg-3.1
 2236  2017-05-04 04:40:56 root ./configure
 2237  2017-05-04 04:41:37 root make
 2238  2017-05-04 09:06:17 root make install
 
 #测试安装成功
 [root@iZ25o0ipjpmZ 20170504]# ffmpeg 
ffmpeg version 3.1 Copyright (c) 2000-2016 the FFmpeg developers
  built with gcc 4.4.7 (GCC) 20120313 (Red Hat 4.4.7-17)
  configuration: 
  libavutil      55. 27.100 / 55. 27.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 40.101 / 57. 40.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.102 /  6. 46.102
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'
[root@iZ25o0ipjpmZ 20170504]#


windows  FFmpeg.exe 下载地址: http://pan.baidu.com/s/1jIjzMbc 密码: qhyw


程序调用:

# copy 模式 高清转码
if(PHP_OS == 'WINNT'){
    //windows 直接使用exe 执行程序
   $cmd = $_SERVER['DOCUMENT_ROOT']."/ffmpeg.exe -i ".$file_path." -y -vcodec copy ".$new_file_path;
}else{
    //调用命令
   $cmd = "ffmpeg -i ".$file_path." -y -vcodec copy ".$new_file_path;
}
exec($cmd);
#截图
if(PHP_OS == 'WINNT'){
   $cmd_thumb = $_SERVER['DOCUMENT_ROOT']."/ffmpeg.exe -i ".$file_path." -ss 00:00:01 -f image2 ".$thumbs;
}else{
   $cmd_thumb = "ffmpeg -i ".$file_path." -ss 00:00:01 -f image2 ".$thumbs;
}
exec($cmd_thumb);

blob.png

上一篇 下一篇

评论



分享

热门文章

最新加入

最新评论

ss就这样吧: 还是用原声的写吧,这样就不会出现兼容性的问题了 。 查看原文 05月25日 15:55
指尖: 数据库主从配置 查看原文 03月03日 11:26




kefu
0.0569s