2010-05-27 77 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上設置任何事情嗎?

相關問題