gpt4 book ai didi

laravel - 如何获取视频的持续时间 - laravel

转载 作者:行者123 更新时间:2023-12-04 01:43:57 27 4
gpt4 key购买 nike

我想在上传视频时获取视频的时长。为此,我像这样上传我的视频:

$video = Carbon::now()->timestamp . '_' .
$request->file('video')->getClientOriginalName();


$request->file('video')->move(
$this->getCorrectPathOnServerAndLocal('/assets/videos/videos'), $video
);

我的电影上传得很好。现在我想得到这个视频的持续时间。我正在使用 PHP-FFMpeg:

composer require php-ffmpeg/php-ffmpeg

$ffprobe = FFProbe::create(); //error
dd("test");
$duration = $ffprobe
->format($this->getCorrectPathOnServerAndLocal('/assets/videos/videos').$video) // extracts file informations
->get('duration');

但我收到了这个错误:

  (2/2) ExecutableNotFoundException

Unable to load FFProbe
in FFProbeDriver.php (line 50)
at FFProbeDriver::create(array(), null)in FFProbe.php (line 207)

最佳答案

首先由 composer 安装 getID3 需要 james-heinrich/getid3那么

$getID3 = new \getID3;
$file = $getID3->analyze($video_path);
$duration = date('H:i:s.v', $file['playtime_seconds']);

关于laravel - 如何获取视频的持续时间 - laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44955402/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com