Skip to content

Commit 1341624

Browse files
Fix duration getter
1 parent cc298f1 commit 1341624

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/Service/ThumbnailGenerator.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public function generate(string $path, string $thumbnailPath, int $thumbnailWidt
2525
$ffmpeg = FFMpeg::create();
2626
$video = $ffmpeg->open($path);
2727
$stream = $video->getStreams()->videos()->first();
28-
$duration = $stream->get('duration');
2928
$width = $stream->getDimensions()->getWidth();
3029
$height = $stream->getDimensions()->getHeight();
3130
} else {
@@ -48,7 +47,7 @@ public function generate(string $path, string $thumbnailPath, int $thumbnailWidt
4847
}
4948

5049
if ($mime === 'video/mp4' || $mime === 'video/webm' || $mime === 'image/gif') {
51-
$second = $duration * 0.1;
50+
$second = $video->getFormat()->get('duration') * 0.1;
5251
$video->frame(TimeCode::fromSeconds($second))->save($thumbnailPath);
5352
} else {
5453
$image = match ($mime) {

0 commit comments

Comments
 (0)