2014-04-05 28 views
1

我已經在我的windows 2008服務器上安裝了ffmpeg。ffprobe json輸出不能在exec中工作,但在CMD中工作

我用這個字符串CMD和我得到了我想要在我的

PHP文件獲得:

ffprobe -v quiet -print_format json -show_format -show_streams "C:\wamp\www\uploads\fc30e528b500b26a391ed4f5ed484310.mp4" 

這是我的PHP函數,我在另一計算器的問題發現,它有很好的意見所以我測試了它。

$file_name = 'fc30e528b500b26a391ed4f5ed484310'; 
$file_ext = 'mp4'; 
$ffprobe = 'C:\\ffmpeg\\bin\\ffprobe.exe'; 
$videoFile = 'C:\\wamp\\www\\uploads\\'.$file_name.'.'.$file_ext; 

$cmd = shell_exec($ffprobe .' ffprobe -v quiet -print_format json -show_format -show_streams "'.$videoFile.'"'); 
$parsed = json_decode($cmd, true); 
print_r($parsed); 

回來什麼都沒有。我也嘗試使用與ffmpeg(我爲ffmpeg工作)使用相同的功能。

$cmd = $ffprobe.' ffprobe -v quiet -print_format json -show_format -show_streams "'.$videoFile.'" 2>&1'; 
echo shell_exec($cmd); 

這也沒有帶回任何東西。

任何想法?

回答

1
包括該.exe固定的問題後

移除ffprobe:

$file_name = 'fc30e528b500b26a391ed4f5ed484310'; 
$file_ext = 'mp4'; 
$ffprobe = 'C:\\ffmpeg\\bin\\ffprobe.exe'; 
$videoFile = 'C:\\wamp\\www\\uploads\\'.$file_name.'.'.$file_ext; 
$cmd = shell_exec($ffprobe .' -v quiet -print_format json -show_format -show_streams "'.$videoFile.'"'); 
$parsed = json_decode($cmd, true); 
print_r($parsed); 
相關問題