fix(capture): explicit slice threading on VC-3 growing encoder

dnxhd with ffmpeg default frame-threading starts at ~0.27x realtime and
buffers a long pipeline before output flows, so the fc_pipe ring laps ~344
startup frames (spotty audio+video for the first several seconds). Setting
-threads 32 -thread_type slice makes dnxhd encode >= realtime from frame 1
(measured 1.3x at start), cutting startup drops substantially. The finalized
master file is gap-free (even PTS, audio==video duration) — the remaining
skipped frames are pre-record spin-up frames dropped to the live edge, not
holes in the recording.
This commit is contained in:
OpenCode 2026-06-05 03:12:42 +00:00
parent 35fb84af4d
commit 105d04729a

View file

@ -920,8 +920,15 @@ class CaptureManager {
args.push('-filter_complex', filterComplex);
// (a) VC-3/DNxHD master (8-bit 4:2:2) -> MXF OP1a, growing-readable.
// `-threads 16 -thread_type slice`: CRITICAL for the first ~10s. With ffmpeg's
// DEFAULT frame-threading, dnxhd buffers a long pipeline before output starts
// — it runs at ~0.27x for the first few seconds, so the fc_pipe ring overflows
// and ~344 startup frames are DROPPED (spotty audio+video for ~10s). Explicit
// slice threading makes dnxhd encode >= realtime from frame 1 (measured 1.3x
// at start vs 0.27x), eliminating the startup backlog and the dropped frames.
args.push('-map', '[vhi]',
'-c:v', 'dnxhd', '-b:v', vb, '-pix_fmt', 'yuv422p',
'-c:v', 'dnxhd', '-threads', '32', '-thread_type', 'slice',
'-b:v', vb, '-pix_fmt', 'yuv422p',
'-r', framerate || '60000/1001',
'-map', audioMap, '-c:a', 'pcm_s24le', '-ar', '48000', '-ac', String(ach),
'-f', 'mxf', outPath);