From 891c69d94d50b7c6fefa8677ebe26e516fb5af18 Mon Sep 17 00:00:00 2001 From: Jessica Stokes Date: Sat, 26 Mar 2022 18:18:11 -0700 Subject: [PATCH] Scale thumbnails in ffmpeg to avoid excessive memory use on UHD videos --- ext/media/main.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ext/media/main.php b/ext/media/main.php index afa36d07..3fd8b3af 100644 --- a/ext/media/main.php +++ b/ext/media/main.php @@ -335,7 +335,7 @@ class Media extends Extension $args = [ escapeshellarg($ffmpeg), "-y", "-i", escapeshellarg($inname), - "-vf", "thumbnail", + "-vf", "scale=$scaled_size[0]:$scaled_size[1],thumbnail", "-f", "image2", "-vframes", "1", "-c:v", "png", @@ -344,6 +344,8 @@ class Media extends Extension $cmd = escapeshellcmd(implode(" ", $args)); + log_debug('media', "Generating thumbnail with command `$cmd`..."); + exec($cmd, $output, $ret); if ((int)$ret === (int)0) {