Merge pull request #877 from friends-of-the-core/reduced-video-thumbnail-memory-usage

Scale thumbnails in ffmpeg to avoid excessive memory use on high-resolution videos
This commit is contained in:
Shish 2022-05-01 10:19:26 +01:00 committed by GitHub
commit 895207bf6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -335,7 +335,7 @@ class Media extends Extension
$args = [ $args = [
escapeshellarg($ffmpeg), escapeshellarg($ffmpeg),
"-y", "-i", escapeshellarg($inname), "-y", "-i", escapeshellarg($inname),
"-vf", "thumbnail", "-vf", "scale=$scaled_size[0]:$scaled_size[1],thumbnail",
"-f", "image2", "-f", "image2",
"-vframes", "1", "-vframes", "1",
"-c:v", "png", "-c:v", "png",
@ -344,6 +344,8 @@ class Media extends Extension
$cmd = escapeshellcmd(implode(" ", $args)); $cmd = escapeshellcmd(implode(" ", $args));
log_debug('media', "Generating thumbnail with command `$cmd`...");
exec($cmd, $output, $ret); exec($cmd, $output, $ret);
if ((int)$ret === (int)0) { if ((int)$ret === (int)0) {