Skip to content

Open-source AI podcast clipper. Generate vertical clips with face tracking and burned-in captions. CLI, MCP server, web app.

fix: suppress Remotion/FFmpeg terminal noise, add swap speaker + custom feedback

Nika Siradzea2cada1e84c0
diff --git a/backend/cli.py b/backend/cli.py
index e6510a9..83e96f8 100644
--- a/backend/cli.py
+++ b/backend/cli.py
@@ -563,6 +563,7 @@ def cmd_process(args):
_rq.Choice("Make longer (extend 5s)", value="longer"),
_rq.Choice("Start earlier (5s)", value="earlier"),
_rq.Choice("Start later (3s)", value="later"),
+ _rq.Choice("Swap speaker (camera on wrong person)", value="swap"),
_rq.Choice("Tell me what to change", value="custom"),
_rq.Choice("Render the rest without asking", value="skip_review"),
],
@@ -577,6 +578,25 @@ def cmd_process(args):
_skip_review = True
break
+ if _raction == "swap":
+ # Swap speaker labels in the words for this clip's time range
+ # so the camera follows the other person
+ clip_speakers = sorted(set(
+ w.get("speaker") for w in words
+ if w.get("speaker") and w["start"] >= clip["start_second"] and w["end"] <= clip["end_second"]
+ ))
+ if len(clip_speakers) >= 2:
+ swap_map = {clip_speakers[0]: clip_speakers[1], clip_speakers[1]: clip_speakers[0]}
+ for w in words:
+ if w["start"] >= clip["start_second"] and w["end"] <= clip["end_second"]:
+ sp = w.get("speaker")
+ if sp in swap_map:
+ w["speaker"] = swap_map[sp]
+ print(f" Swapped speakers: {clip_speakers[0]} ↔ {clip_speakers[1]}")
+ else:
+ print(f" Only one speaker detected in this clip")
+ continue
+
if _raction == "custom":
_feedback = _rq.text(
"What should I change?",
@@ -633,8 +653,26 @@ def cmd_process(args):
config["caption_style"] = s
print(f" Changing to {s} style")
break
+ elif any(w in fb for w in ["wrong person", "swap", "other speaker", "other face", "wrong face", "wrong speaker"]):
+ _raction = "swap"
+ # Will hit the swap handler on next iteration
+ clip_speakers = sorted(set(
+ w.get("speaker") for w in words
+ if w.get("speaker") and w["start"] >= clip["start_second"] and w["end"] <= clip["end_second"]
+ ))
+ if len(clip_speakers) >= 2:
+ swap_map = {clip_speakers[0]: clip_speakers[1], clip_speakers[1]: clip_speakers[0]}
+ for w in words:
+ if w["start"] >= clip["start_second"] and w["end"] <= clip["end_second"]:
+ sp = w.get("speaker")
+ if sp in swap_map:
+ w["speaker"] = swap_map[sp]
+ print(f" Swapped speakers: {clip_speakers[0]} ↔ {clip_speakers[1]}")
+ else:
+ print(f" Only one speaker in this clip")
+ continue
else:
- print(f" Couldn't parse that. Try: 'shorter', 'longer 10', 'start 3s earlier', 'hormozi style'")
+ print(f" Couldn't parse that. Try: 'shorter', 'longer 10', 'start 3s earlier', 'hormozi style', 'wrong person'")
continue
else:
continue
diff --git a/backend/services/clip_generator.py b/backend/services/clip_generator.py
index a242faf..acba080 100644
--- a/backend/services/clip_generator.py
+++ b/backend/services/clip_generator.py
@@ -278,11 +278,13 @@ def _render_with_remotion(
if logo_path and os.path.exists(logo_path):
cmd.extend(["--logo", os.path.abspath(logo_path)])
- # Stream stderr to terminal for progress
+ # Redirect stderr to devnull to suppress Chrome/FFmpeg noise
+ # (avoids buffer deadlock and terminal spam)
+ _devnull = open(os.devnull, 'w')
result = subprocess.run(
cmd,
stdout=subprocess.PIPE,
- stderr=None,
+ stderr=_devnull,
text=True,
timeout=600,
cwd=project_root,
diff --git a/remotion/render.mjs b/remotion/render.mjs
index a51cd18..e136bfa 100644
--- a/remotion/render.mjs
+++ b/remotion/render.mjs
@@ -243,10 +243,10 @@ async function main() {
const { execSync } = await import("child_process");
process.stderr.write(" compositing...\n");
execSync(
- `ffmpeg -y -i "${path.resolve(opts.video)}" -i "${captionOverlay}" ` +
+ `ffmpeg -y -hide_banner -loglevel warning -i "${path.resolve(opts.video)}" -i "${captionOverlay}" ` +
`-filter_complex "[0:v][1:v]overlay=0:0:shortest=1" ` +
`-c:v libx264 -crf 18 -preset fast -map 0:a -c:a copy "${opts.output}"`,
- { stdio: ["pipe", "pipe", "inherit"], timeout: 300000 }
+ { stdio: ["pipe", "pipe", "pipe"], timeout: 300000 }
);
// Clean up overlay