S.M*_*ian 3 ffmpeg laravel laravel-5
我想在上传视频时获取视频的时长。为此,我像这样上传我的视频:
$video = Carbon::now()->timestamp . '_' .
$request->file('video')->getClientOriginalName();
$request->file('video')->move(
$this->getCorrectPathOnServerAndLocal('/assets/videos/videos'), $video
);
Run Code Online (Sandbox Code Playgroud)
我的电影上传得很好。现在我想知道这个视频的持续时间。我正在使用PHP-FFMpeg:
composer require php-ffmpeg/php-ffmpeg
Run Code Online (Sandbox Code Playgroud)
$ffprobe = FFProbe::create(); //error
dd("test");
$duration = $ffprobe
->format($this->getCorrectPathOnServerAndLocal('/assets/videos/videos').$video) // extracts file informations
->get('duration');
Run Code Online (Sandbox Code Playgroud)
但我收到了这个错误:
(2/2) ExecutableNotFoundException
Unable to load FFProbe
in FFProbeDriver.php (line 50)
at FFProbeDriver::create(array(), null)in FFProbe.php (line 207)
Run Code Online (Sandbox Code Playgroud)
小智 5
composer require james-heinrich/getid3
然后先安装getID3
$getID3 = new \getID3;
$file = $getID3->analyze($video_path);
$duration = date('H:i:s.v', $file['playtime_seconds']);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7067 次 |
| 最近记录: |