fix: generate thumbnails in one ffmpeg pass, not ~N/30

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 <noreply@anthropic.com>
This commit is contained in:
Your Name 2026-06-30 01:36:27 -04:00
parent b05b440922
commit 5bc53c03f3

View file

@ -17,7 +17,10 @@ logger = logging.getLogger(__name__)
THUMB_INTERVAL_SECONDS = 1.0 THUMB_INTERVAL_SECONDS = 1.0
THUMB_MAX_HEIGHT = 360 THUMB_MAX_HEIGHT = 360
THUMB_JPEG_QUALITY = 9 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): def _otio_frames(rational_time):