From bc586e7d700b31f23292dc10d8e340199fe0d22b Mon Sep 17 00:00:00 2001 From: Martin Kampas Date: Wed, 3 Sep 2025 15:32:30 +0200 Subject: [PATCH] Improve performance of frame extraction With an H.265 video the CPU time consumption got reduced by ~70 %, RAM usage by ~10 %. --- lib/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/index.js b/lib/index.js index 64cd3ba..50319c5 100644 --- a/lib/index.js +++ b/lib/index.js @@ -70,7 +70,8 @@ exports.still = function (source, target, options, callback) { function extractFrame (source, target, options, callback) { getSeekPoint(source, options, (_, seekPoint) => { - const atseek = ['-i', source, '-vframes', 1, '-ss', seekPoint, '-y', target] + const atseek = ['-skip_frame', 'nokey', '-i', source, '-vframes', 1, '-ss', + seekPoint, '-y', target] const fallback = ['-i', source, '-vframes', 1, '-y', target] ffmpeg.exec(atseek, (err) => { if (fs.existsSync(target)) {