发布于 2015-03-17 09:59:29 | 138 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的PHP教程,程序狗速度看过来!

PHP开源脚本语言

PHP(外文名: Hypertext Preprocessor,中文名:“超文本预处理器”)是一种通用开源脚本语言。语法吸收了C语言、Java和Perl的特点,入门门槛较低,易于学习,使用广泛,主要适用于Web开发领域。PHP的文件后缀名为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);
}
?>


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务