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); + } +}