PHP实现将视频转成MP4并获取视频预览图的方法

yipeiwu_com5年前PHP代码库

本文实例讲述了PHP实现将视频转成MP4并获取视频预览图的方法。分享给大家供大家参考。具体实现方法如下:

复制代码 代码如下:
<?php
flv_convert_get_thumb('input.avi', 'output.jpg', 'output.ogm');
// code provided and updated by steve of phpsnaps ! thanks
// accepts:
// 1: the input video file
// 2: path to thumb jpg
// 3: path to transcoded mpeg?
function flv_convert_get_thumb($in, $out_thumb, $out_vid)
{
  // get thumbnail
  $cmd = 'ffmpeg -v 0 -y -i '.$in.' -vframes 1 -ss 5 -vcodec mjpeg -f rawvideo -s 286x160 -aspect 16:9 '.$out_thumb;
  $res = shell_exec($cmd);
  // $res is the output of the command
  // transcode video
  $cmd = 'mencoder '.$in.' -o '.$out_vid.' -af volume=10 -aspect 16:9 -of avi -noodml -ovc x264 -x264encopts bitrate=500:level_idc=41:bframes=3:frameref=2: nopsnr: nossim: pass=1: threads=auto -oac mp3lame';
  $res = shell_exec($cmd);
}
?>

希望本文所述对大家的php程序设计有所帮助。

相关文章

Linux平台PHP5.4设置FPM线程数量的方法

本文实例讲述了Linux平台PHP5.4设置FPM线程数量的方法。分享给大家供大家参考,具体如下: PHP5.4安装完毕后,FPM的默认配置文件位于/usr/local/php/etc/...

试用php中oci8扩展

给大家分享个php操作Oracle的操作类 Oracle_db.class.php <?php class Oracle_db{ public $link; p...

PHP使用两个栈实现队列功能的方法

本文实例讲述了PHP使用两个栈实现队列功能的方法。分享给大家供大家参考,具体如下: 问题 用两个栈来实现一个队列,完成队列的Push和Pop操作。 队列中的元素为int类型。 解决思路...

PHP数组排序函数合集 以及它们之间的联系分析

下边提到的几个数组函数的排序有一些共性:1 数组被作为排序函数的参数,排序以后,数组本身就发生了改变,函数的返回值为bool类型。2 函数名中出现单a表示association,含义为,...

解决wincache不支持64位PHP5.5/5.6的问题(提供64位wincache下载) 原创

解决wincache不支持64位PHP5.5/5.6的问题(提供64位wincache下载) 原创

这几天公司有台服务器需要配置,系统是Windows 2008 R2,在IIS上配置环境是64位的PHP5.5,要求支持wincache。原本心想无非就是去wincache的官网下载下来,...