2014-12-04 29 views
0

如何知道ffmpeg命令中發生了錯誤?和我如何得到我的PHP中的錯誤?獲取FFMPEG返回的錯誤

下面

是我的代碼

<?php 
     $cmd = "$ffmpeg -i $vid -an -ss $getfromsecond -s $size -vframes 1 $imageFile"; 

     if(!shell_exec($cmd)){ 
     echo "Thumbnail created" . "<br/>"; 
     }else{ 
      echo "Error Creating thumbnail". "<br/>"; 
     } 
    ?> 

我不知道,如果上面的方法是right.I也嘗試下面的代碼

exec($cmd, $output, $return); 
echo '$output :' ; print_r($output); echo "<br/>";echo '$return :' . $return . "<br/>";exit; 

但在服務器它只是顯示出把儘可能

$output :Array () 
$return127 

我不明白那是什麼錯誤沒有,如何知道錯誤是否發生並返回ffmpeg錯誤號和ffmpeg錯誤文本,在PHP中。

回答

1

使用它

exec($cmd,$test); 

然後檢查

if(file_exists($image)) 
{ 
echo 'suc'; 
} 
+0

但這是自定義錯誤我想'返回的錯誤ffmpeg' – Hitesh 2014-12-04 13:06:55

+0

檢查我的問題,我已經有自定義錯誤 – Hitesh 2014-12-04 13:07:19

+0

錯誤是由返回exec函數默認 – 2014-12-04 13:44:55