From 1b94221282871ade12f5d395f71c6c1225430865 Mon Sep 17 00:00:00 2001 From: lazerg Date: Fri, 10 Jul 2026 00:08:02 +0500 Subject: [PATCH] Fix video thumbnail generation logging an error on success --- src/Console/Processes/Ffmpeg.php | 5 ++++- tests/Console/FfmpegTest.php | 29 +++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 tests/Console/FfmpegTest.php diff --git a/src/Console/Processes/Ffmpeg.php b/src/Console/Processes/Ffmpeg.php index ace1a142733..696f35b1845 100644 --- a/src/Console/Processes/Ffmpeg.php +++ b/src/Console/Processes/Ffmpeg.php @@ -36,12 +36,15 @@ private function buildCommand(string $ffmpegBinary, string $path, string $output { return collect([ escapeshellarg($ffmpegBinary), + '-hide_banner', + '-loglevel error', '-y', '-ss', escapeshellarg($this->startTimestamp), '-i', escapeshellarg($path), - '-vframes 1', + '-frames:v 1', + '-update 1', escapeshellarg($output), ])->join(' '); } diff --git a/tests/Console/FfmpegTest.php b/tests/Console/FfmpegTest.php new file mode 100644 index 00000000000..46bddcf5668 --- /dev/null +++ b/tests/Console/FfmpegTest.php @@ -0,0 +1,29 @@ +buildCommand('/usr/bin/ffmpeg', '/path/to/video.mov', '/path/to/thumb.jpg'); + + $this->assertStringContainsString('-hide_banner', $command); + $this->assertStringContainsString('-loglevel error', $command); + $this->assertStringContainsString('-frames:v 1', $command); + $this->assertStringContainsString('-update 1', $command); + $this->assertStringNotContainsString('-vframes', $command); + } + + private function buildCommand(...$arguments) + { + $method = (new \ReflectionClass(Ffmpeg::class))->getMethod('buildCommand'); + + return $method->invoke(new Ffmpeg, ...$arguments); + } +}