Skip to content

fix(mix): no tirar el diálogo en Recast cuando solo algunos clips tienen pista - #17

Merged
IAnMove merged 3 commits into
mainfrom
cursor/critical-bug-management-eb7f
Aug 29, 2026
Merged

fix(mix): no tirar el diálogo en Recast cuando solo algunos clips tienen pista#17
IAnMove merged 3 commits into
mainfrom
cursor/critical-bug-management-eb7f

Conversation

@cursor

@cursor cursor Bot commented Aug 25, 2026

Copy link
Copy Markdown

El concat duro de concatenate_multi_clip_videos sondaba solo el clip 0 para decidir si había audio embebido. Recast / Repaint / Outpaint (y el fallback del join suave) van siempre por ese camino desde el PR #13.

Impacto

  • Bumper o plano H3 mudo primero + diálogo después → mix silencioso (el diálogo se descarta).
  • Diálogo primero + clip sin audio después → ffmpeg pide [n:a] que no existe, el join falla y Recast borra el MP4.

Esto es el mismo síntoma que el PR #16, pero en el grafo de concat duro. El #16 solo toca el join suave de mix_concat.py, que Recast ya no usa.

Qué cambia

  • Se sonda audio en todos los clips.
  • Si el lote es mixto, los clips sin pista reciben silencio estéreo (anullsrc) para que concat=a=1 sea legal y el diálogo se conserve.
  • Lotes todos-audio o todos-mudos siguen el grafo de siempre.

Cómo reproducir

  1. Recast / Repaint de un vídeo sin audio fuente, con 2+ planos (o un plano H3 mute junto a uno con diálogo).
  2. Tras generar los segmentos, el concat duro decidía el audio solo por el primer archivo.
  3. El mix salía mudo o ffmpeg fallaba y el check de frames borraba el resultado.

Validación
pytest tests/test_mix_concat.py — 12 passed, incluidos dos concats reales con ffmpeg (mudo+diálogo y diálogo+mudo).

El PR #16 (join suave) sigue abierto y no se solapa con estos archivos de filtro duro.

Open in Web View Automation 

Note

Medium Risk
Changes the ffmpeg concat path used by length-locked Recast-style assembly; wrong filter graphs could still break joins or timing, though behavior is heavily covered by new unit and ffmpeg integration tests.

Overview
Fixes Recast / Repaint / Outpaint hard multi-clip joins (and the soft-join fallback) that previously inferred embedded audio from only the first clip. That could yield a silent mix when dialogue lived in later segments, or crash ffmpeg when the first clip had audio but a later one did not.

concatenate_multi_clip_videos now probes every clip via shared probe_audio_flags, and builds the hard-concat filter_complex through new build_hard_concat_filter. When the batch is mixed, clips without an audio stream get stereo silence (anullsrc) sized from per-clip duration so concat=a=1 stays valid and dialogue is kept; all-audio and all-silent batches keep the previous simple graphs.

probe_has_audio also tries an ffmpeg stderr fallback when ffprobe fails before failing open, so flaky probes are less likely to drop later dialogue.

Tests cover filter graphs for mixed/silent/all-audio cases, assert wgp no longer keys audio off clip 0, and run real ffmpeg joins for silent+talk and talk+silent.

Reviewed by Cursor Bugbot for commit 6d3e242. Configure here.

Recast/Repaint/Outpaint (y el fallback del join suave) sondaban solo el
primer clip. Un bumper o plano H3 mudo en el slot 0 tiraba el diálogo;
un clip sin audio más tarde tumbaba ffmpeg.

Co-authored-by: ignaciodelcano+dcl <ignaciodelcano+dcl@gmail.com>
@github-actions

github-actions Bot commented Aug 25, 2026

Copy link
Copy Markdown

PR Review — Loreframe Studio

Risk: low
Scope: 3 file(s); +229/-29; backend services, generation pipeline

Automated review from scripts/analyze_pr.py. This is a heuristic pass (no LLM) so humans still own the merge decision.

Findings

  • No heuristic issues. Still run the CI checklist below.

Changed files

  • modified: app/services/mix_concat.py, app/wgp.py, tests/test_mix_concat.py

CONTRIBUTING checklist

  • python scripts/verify_clean_repo.py
  • python -m compileall -q app/services app/launch.py scripts
  • cd ui && npm run build if the UI changed
  • No weights, CivitAI sidecars, or generated guides
  • Stays local-first (no required accounts / telemetry)

Posted by the repo PR review workflow. Re-runs on each push to the PR.

cursoragent and others added 2 commits August 29, 2026 12:13
Keep probe_has_audio / probe_audio_flags from #16 as the single probe
path, add the ffmpeg fallback from this branch, and keep the Recast
hard-concat graph. Tests cover both the soft join and the hard concat.

Co-authored-by: THEINAOG <IAnMove@users.noreply.github.com>
Co-authored-by: THEINAOG <IAnMove@users.noreply.github.com>
@IAnMove
IAnMove marked this pull request as ready for review August 29, 2026 12:14

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 6d3e242. Configure here.

Comment thread app/wgp.py
if audio_flags and not all(audio_flags):
silent_durations = [
probe_duration_seconds(path, ffmpeg_bin) or 1.0
for path in valid_paths

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Silence fallback desyncs mixed concat

High Severity

Mute clips get a hardcoded 1.0s anullsrc pad when probe_duration_seconds returns nothing. concat then keeps audio and video on separate timelines, so later dialogue plays at the wrong time while Recast's frame check still accepts the file. That probe rewrites ffmpeg_bins inside FFMPEG_BINARY to a missing ffprobe_bins path, so the fallback is the live mixed-audio path.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6d3e242. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Risk: medium. No apruebo: Cursor Bugbot quedó en skipping y dejó un hallazgo de alta severidad sin resolver sobre el pad de silencio en el concat mixto. Security Agent pasó sin hallazgos; se asignaron revisores humanos.

Open in Web View Automation 

Sent by Cursor Approval Agent: Pull Request Router and Approver

@cursor
cursor Bot requested a review from IAnMove August 29, 2026 12:19
@IAnMove
IAnMove merged commit 546ea4b into main Aug 29, 2026
5 of 7 checks passed
@IAnMove
IAnMove deleted the cursor/critical-bug-management-eb7f branch August 29, 2026 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants