2010-05-27 79 views

回答

6

exec()帮助和ffmpeg

+0

您好我创造这样的,但它不工作 的ffmpeg -i/SHO B的测试video.MPG -ar 22050-AB 32 -f -s FLV 320×240/FLV/SHO B的测试video.flv – 2010-05-27 06:18:47

+0

我在Windows开发平台工作如果出现任何问题,请填写表格 – 2010-05-27 06:20:52

+1

将您尝试过的任何内容添加到最初的问题中:完整的命令和出错的输出部分。 – zerkms 2010-05-27 07:07:22

3

检查了这一点..这个代码应工作

<?php 
class media_handler 
{ 
function convert_media($filename, $rootpath, $inputpath, $outputpath, $width, $height, $bitrate, $samplingrate) 
{ 
$outfile = ""; 
// root directory path, where FFMPEG folder exist in your application. 
$rPath = $rootpath."\ffmpeg"; 
// which shows FFMPEG folder exist on the root. 
// Set Media Size that is width and hieght 
$size = $width."x".$height; 
// remove origination extension from file adn add .flv extension, becuase we must give output file name to ffmpeg command. 
$outfile =$filename; 
$out=explode(".",$outfile); 


// Media Size 
//$size = Width & "x" & Height; 

// remove origination extenstion from file and add .flv extension , becuase we must give output filename to ffmpeg command. 

$outfile = $out[0].".flv"; 
// Use exec command to access command prompt to execute the following FFMPEG Command and convert video to flv format. 

$ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -ar " .$samplingrate." -ab ".$bitrate." -f flv -s ".$size." ".$outputpath."/".$outfile; 

//$ffmpegcmd1 = "/usr/local/bin/ffmpeg -i ".$inputpath."/".$filename. " -b 500 -r 25 -s 320×240 -hq -deinterlace -ab 56 -ar 22050 -ac 1 ".$outputpath."/".$outfile." 2>&1"; 


$ret = shell_exec($ffmpegcmd1); 

// return output file name for other operations 
return $ffmpegcmd1; 
} 

} 
?> 
-1

include_once( “media_handler.php”);

$ _objMda = new mandler(); // $ _ objMda as new mandler();

$ rootpath =“”; $ nputpath = $ rootpath。“/ Default”; $ outputpath = $ rootpath。 “/ FLV”; $ ThumbPath = $ rootpath。 “/大拇指”;

if($ _POST){//将原始视频保存在默认文件夹中。

$ source = $ _FILES ['file1'] ['tmp_name']; $ name = $ _FILES ['file1'] ['name']; $ fileSize = $ _FILES ['file1'] ['size']; $ filetype = $ _FILES ['file1'] ['type']; $ dest ='';

copy($ source,$ inputpath。$ name);

//转换成FLV格式

$ OUTFILE = $ _objMda-> convert_media($名称,$ ROOTPATH,$ inputpath,$ outputpath,320,240,32,22050);

我用过乌尔班,但没有结果先生。我可以在我的phpini上设置任何事情吗?

相关问题