You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Per-timestamp frame extraction spawns ffmpeg serially (up to 1000 in a row) #290
Several tools grab frames one ffmpeg process at a time in a for ... await loop. Each spawn costs ~200 ms before decoding, and only one core is used.
Where
src/tools/sampleFrames.ts:186-197 (timestamps/scenes, up to MAX_FRAMES_CEILING = 1000)
src/tools/indexRecording.ts:118-126 (up to 120 keyframes)
src/tools/stepGuide.ts:132-137, 168-175
src/tools/contactSheet.ts:91-96
src/utils/images.ts:57-65 (encodeInlineImages)
Details
for (const [i, t] of ts.entries()) { ... await runFfmpeg(buildSampleAtTimestampArgs(...)) }.
Impact
Scenes mode with maxFrames 1000 on an hour-long recording takes minutes; index_recording spends 30-60 s on frame grabs before OCR starts.
Steps to reproduce
sample_frames { input: <1h recording>, mode: "scenes", maxFrames: 1000 } and watch: one ffmpeg at a time
Suggested fix
Add a small shared concurrency pool (e.g. Math.max(2, os.availableParallelism()/2)) used by these loops, preserving output order. Optionally batch nearby timestamps into one ffmpeg with a select filter.
Acceptance criteria
Frame-extraction loops run with bounded concurrency
Filed by repo-audit/full-audit at f2fda28. Severity: medium. Effort: M. audit-key: performance|src/tools/sampleFrames.ts|timestamp loop sequential spawn
Fixed in fd1c1e6: mapPool (src/utils/pool.ts) runs the frame-extraction loops in sample_frames, index_recording, step_guide, contact_sheet and encodeInlineImages with bounded concurrency (a quarter of the cores, 2 to 4), keeping output order and names. Measured: 40 timestamp grabs from a 720p clip, 14.8 s serial vs 5.5 s pooled (2.7x, 12 cores). Verified with pool unit tests and the full suite (1085 passed).
Activity
TMHSDigital commentedon Nov 10, 2026
Fixed in fd1c1e6:
mapPool(src/utils/pool.ts) runs the frame-extraction loops in sample_frames, index_recording, step_guide, contact_sheet and encodeInlineImages with bounded concurrency (a quarter of the cores, 2 to 4), keeping output order and names. Measured: 40 timestamp grabs from a 720p clip, 14.8 s serial vs 5.5 s pooled (2.7x, 12 cores). Verified with pool unit tests and the full suite (1085 passed).perf(ocr): one ffmpeg per frame for all passes, bounded (#291)
chore: release 0.49.0