From 5bc53c03f3dfffd26b51ddc8b90956d9fe72241f Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 30 Jun 2026 01:36:27 -0400 Subject: [PATCH] fix: generate thumbnails in one ffmpeg pass, not ~N/30 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ffmpeg's select filter re-decodes the whole clip on every pass, so chunking by 30 turned a 670-frame job into 23 full decodes (minutes on shared CPU — long enough to be killed mid-run and leave thumbnail_status stuck at 'running'). One pass now. Co-Authored-By: Claude Opus 4.8 --- scenes/thumbnails.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/scenes/thumbnails.py b/scenes/thumbnails.py index 1d70123..0cb5f06 100644 --- a/scenes/thumbnails.py +++ b/scenes/thumbnails.py @@ -17,7 +17,10 @@ logger = logging.getLogger(__name__) THUMB_INTERVAL_SECONDS = 1.0 THUMB_MAX_HEIGHT = 360 THUMB_JPEG_QUALITY = 9 -CLIP_SELECT_CHUNK_SIZE = 30 +# ffmpeg's select filter decodes the whole clip on every pass, so each chunk is +# a full re-decode. Keep it one pass (one decode) for all but absurdly long clips +# — a single select expression with thousands of terms is cheap to evaluate. +CLIP_SELECT_CHUNK_SIZE = 4096 def _otio_frames(rational_time):