From 690f27218dfe1ecc52a61ee71e7f7dd2e6d917f4 Mon Sep 17 00:00:00 2001 From: ZGaetano Date: Thu, 4 Jun 2026 18:52:07 +0000 Subject: [PATCH] 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 0ffmpeg mpeg2video 422->raw2bmx rdd9) produces a valid 1080p29.97 MXF matching the working Delta7 file. --- services/capture/src/capture-manager.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/services/capture/src/capture-manager.js b/services/capture/src/capture-manager.js index 6f3bafb..b0732ae 100644 --- a/services/capture/src/capture-manager.js +++ b/services/capture/src/capture-manager.js @@ -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; } trap stop INT TERM