2017-08-13 52 views
0

我按照命令,在github上找到的参考了很多,但它返回一个大对象,而不能访问期间无法取得持续时间的FFmpeg laravel

这里是我的代码

$ffprobe = \FFMpeg\FFProbe::create(); 
    $ffprobe 
     ->format($file) // extracts file informations 
     ->get('duration');    // returns the duration property 

    dd($ffprobe); 

enter image description here

如果我使用回声或返回它会给我错误

Object of class FFMpeg\FFProbe could not be converted to string 

回答

0

看起来像你试图回显FFProb的实例不是持续时间。这个怎么样:

$duration = FFMpeg\FFProbe::create() 
     ->format($file) 
     ->get('duration'); 

echo $duration; 
+0

它的工作原理!该文件令我感到困惑 – chengwei