From 7e252fd56c8364d88731851a6f811543c66084c3 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sat, 29 Apr 2023 10:56:43 -0700 Subject: [PATCH] binext: improve ffmpeg check Signed-off-by: Varun Patil --- lib/Service/BinExt.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/Service/BinExt.php b/lib/Service/BinExt.php index 7b3fe879..8909c09e 100644 --- a/lib/Service/BinExt.php +++ b/lib/Service/BinExt.php @@ -402,20 +402,14 @@ class BinExt return $ffmpegPath; } - public static function testFFmpeg(string $path, string $vername) + public static function testFFmpeg(string $path, string $name) { $version = shell_exec("{$path} -version"); - if (!preg_match("/{$vername} version\\s+([0-9\\.]+)/", $version, $matches)) { + if (!preg_match("/{$name} version \\S*/", $version, $matches)) { throw new \Exception("failed to detect version, found {$version}"); } - $minver = '4.0'; - $semver = $matches[1]; - if (!version_compare($semver, $minver, '>=')) { - throw new \Exception("version must be >= {$minver}, found {$semver}"); - } - - return $semver; + return explode(' ', $matches[0])[2]; } public static function testSystemPerl(string $path): string