fix(growing): parent shell drops fd0 so ffmpeg is sole stdin reader

Root cause of growing 'video empty / No filtered frames': when video comes from fc_pipe, node pipes it to the bash orchestrator's stdin (fd0). The ffmpeg subshell inherits fd0, BUT the parent bash kept fd0 open too (in its wait loop). Both held the read end of the same pipe, so the kernel split the raw video bytes between them and ffmpeg was starved -> zero decoded frames -> empty mpeg2video -> raw2bmx broken pipe. Manual 'fc_pipe | ffmpeg' worked because ffmpeg was the sole reader. Fix: parent execs 0</dev/null right after spawning ffmpeg, making ffmpeg the sole stdin reader. Verified the full pipeline (fc_pipe->ffmpeg mpeg2video 422->raw2bmx rdd9) produces a valid 1080p29.97 MXF matching the working Delta7 file.
This commit is contained in:
Zac Gaetano 2026-06-04 18:52:07 +00:00
parent c2e3ee7dd2
commit 690f27218d

View file

@ -955,6 +955,14 @@ BMXPID=$!
# harmless.
( exec 7>&- 8>&- 0<&0; exec ${ffLine} ) &
FFPID=$!
# CRITICAL: the parent shell must DROP its own copy of stdin (fd 0) now that
# ffmpeg has inherited it. When video comes from fc_pipe (node pipes it to this
# orchestrator's stdin), leaving fd 0 open in the parent means BOTH the parent
# and the ffmpeg subshell hold the read end of that pipe the kernel delivers
# bytes to whichever reads first, so ffmpeg is starved of the raw video and its
# filtergraph gets "No filtered frames" / empty output. Closing fd 0 here makes
# ffmpeg the SOLE reader so all fc_pipe video reaches pipe:0.
exec 0</dev/null
# Forward a clean stop to ffmpeg; raw2bmx then gets EOF and finalizes the footer.
stop() { kill -INT "$FFPID" 2>/dev/null; }
trap stop INT TERM