Skip to content

Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.

v4.12.3 — one-shot takes stay in sync

mrbizarro93d6e0ebec14
diff --git a/README.md b/README.md
index c6f0377..170cc7b 100644
--- a/README.md
+++ b/README.md
@@ -19,7 +19,7 @@
</p>
-> **Current release: v4.12.2.** The morning's field reports: a One Shot with only a prompt is the prompt for the whole take (the beats box no longer half-fills itself), the H3 compact-engine build validates in a fresh process and marks itself built only after that (36 GB Macs, #78), more than 8 distilled steps is refused up front, a missing ffmpeg is named before an H3 render, a moved LoRA file is named as a missing file, and the stats page ranks errors by installs and shows failures per version. Includes 4.12.x: the talking one shot. Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
+> **Current release: v4.12.3.** **One-shot takes stay in sync**: the voice no longer falls behind the lips over a long take (each part's sound is now trimmed to its own frames before the join; a 50 s take used to end about a tenth of a second late). Full notes on the [releases page](https://github.com/mrbizarro/Phosphene/releases).
## Overview
diff --git a/VERSION b/VERSION
index f1cd7de..d140ced 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-4.12.2
+4.12.3
diff --git a/docs/STATE.md b/docs/STATE.md
index 7e037b3..e8d8965 100644
--- a/docs/STATE.md
+++ b/docs/STATE.md
@@ -1,5 +1,17 @@
# Phosphene — project state, history, open work
+> **🩹 2026-09-12 — v4.12.3 ships: one-shot takes stay in sync.** The
+> owner's 50 s "awkward silences" one-shot was out of sync by its last line:
+> every rendered part's audio comes out of the model a few hundredths of a
+> second longer than its picture, and the concat-demuxer join summed those
+> (five parts → the voice ~130 ms behind the lips). `_join_take_parts` trims
+> (or pads) each part's audio to exactly its frame count and joins through
+> the concat filter, sample-accurate; `test_take_join_sync.py` proves five
+> synthetic parts with model-style excess join to audio == video (<30 ms).
+> The owner's clip itself was repaired by re-timing its audio to the picture
+> (`…50s_q8pro_sync.mp4` beside the original). Promoted by cherry-pick
+> (9e3bbc1) onto origin/main.
+
> **🎙️ 2026-09-07, evening — the handoff is a J-cut, and audio-first is out.**
> Two questions from the owner. (1) *Can he keep talking through a cut?* Yes,
> when the next part is anchored on a frame where his mouth is mid-word:
diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.py
index 029d3bf..1bfea43 100644
--- a/mlx_ltx_panel.py
+++ b/mlx_ltx_panel.py
@@ -24183,6 +24183,40 @@ def _run_windows_chain(job: dict, p: dict, plan: dict, first: Path,
return plan
+def _join_take_parts(ff: str, parts: list[str], final: Path, fps: float = 24.0) -> None:
+ """Join the parts of a one-shot take with the sound locked to the picture.
+
+ Every part's audio comes out of the model a few hundredths of a second
+ LONGER than its frames (a 10.04 s picture with 10.07 s of sound). The
+ concat demuxer just adds those up, so a five-part take ended with the
+ voice ~130 ms behind the lips — "not in sync" by the last line. Here each
+ part's audio is trimmed to exactly its own frame count before the
+ concat filter joins them sample-accurately; a part whose sound is
+ shorter than its picture is padded with silence to the same length."""
+ n = len(parts)
+ if n == 1:
+ subprocess.run([ff, "-loglevel", "error", "-y", "-i", parts[0],
+ "-c:v", "libx264", "-preset", "medium", "-crf", "17", "-pix_fmt", "yuv420p",
+ "-c:a", "aac", "-b:a", "192k", "-movflags", "+faststart", str(final)], check=True)
+ return
+ cmd = [ff, "-loglevel", "error", "-y"]
+ graph = []
+ for k, part in enumerate(parts):
+ cmd += ["-i", part]
+ frames = _probe_video_frames(part) or 0
+ dur = frames / float(fps) if frames else 0.0
+ if dur > 0:
+ graph.append(f"[{k}:a]atrim=0:{dur:.6f},asetpts=PTS-STARTPTS,"
+ f"apad=whole_dur={dur:.6f}[a{k}]")
+ else:
+ graph.append(f"[{k}:a]asetpts=PTS-STARTPTS[a{k}]")
+ graph.append("".join(f"[{k}:v][a{k}]" for k in range(n)) + f"concat=n={n}:v=1:a=1[v][a]")
+ cmd += ["-filter_complex", ";".join(graph), "-map", "[v]", "-map", "[a]",
+ "-c:v", "libx264", "-preset", "medium", "-crf", "17", "-pix_fmt", "yuv420p",
+ "-c:a", "aac", "-b:a", "192k", "-movflags", "+faststart", str(final)]
+ subprocess.run(cmd, check=True)
+
+
def run_take_job_inner(job: dict) -> None:
"""One take on either engine: N parts, each continuing from the last frame
of the part before, joined into one clip. H3 parts are 15 s (three beats)
@@ -24416,9 +24450,7 @@ def run_take_job_inner(job: dict) -> None:
final = _unique_output_path(
OUTPUT, _descriptive_filename(label, p.get("prompt") or "", fallback="take") + f"_take{take['seconds']}s")
push(f"[take] joining {n_parts} parts → {final.name}")
- subprocess.run([ff, "-loglevel", "error", "-y", "-f", "concat", "-safe", "0", "-i", str(lst),
- "-c:v", "libx264", "-preset", "medium", "-crf", "17", "-pix_fmt", "yuv420p",
- "-c:a", "aac", "-b:a", "192k", "-movflags", "+faststart", str(final)], check=True)
+ _join_take_parts(ff, outs, final)
side: dict = {}
try:
side = json.loads(Path(outs[-1] + ".json").read_text())
diff --git a/test_take_join_sync.py b/test_take_join_sync.py
new file mode 100644
index 0000000..01d6035
--- /dev/null
+++ b/test_take_join_sync.py
@@ -0,0 +1,50 @@
+"""The one-shot join keeps the sound locked to the picture.
+
+Each rendered part's audio runs a few hundredths of a second longer than its
+frames; the old concat-demuxer join summed those, so a five-part take ended
+with the voice ~130 ms behind the lips. `_join_take_parts` trims every part's
+audio to its own frame count first. Synthetic parts: 241 frames of picture,
+10.10 s of tone — the join must come out with audio == video."""
+import os, shutil, subprocess, tempfile, unittest
+from pathlib import Path
+
+import mlx_ltx_panel as P
+
+FF = shutil.which("ffmpeg") or str(getattr(P, "FFMPEG", "ffmpeg"))
+FP = shutil.which("ffprobe") or str(getattr(P, "FFPROBE", "ffprobe"))
+
+
+def _dur(path, kind):
+ out = subprocess.run([FP, "-v", "error", "-select_streams", f"{kind}:0", "-show_entries",
+ "stream=duration", "-of", "csv=p=0", path], capture_output=True, text=True).stdout
+ return float(out.strip().split("\n")[0].strip(","))
+
+
[email protected](shutil.which("ffmpeg") or os.path.exists(str(getattr(P, "FFMPEG", ""))), "ffmpeg needed")
+class TakeJoinKeepsSync(unittest.TestCase):
+ def test_audio_matches_video_after_join(self):
+ with tempfile.TemporaryDirectory() as td:
+ parts = []
+ for k in range(5):
+ p = os.path.join(td, f"part{k + 1}.mp4")
+ # 241 frames @24 = 10.0417 s of picture; 10.10 s of sound (model-style excess)
+ vid, aud = os.path.join(td, f"v{k}.mp4"), os.path.join(td, f"a{k}.wav")
+ subprocess.run([FF, "-v", "error", "-y", "-f", "lavfi", "-i", "testsrc=size=320x180:rate=24",
+ "-frames:v", "241", "-c:v", "libx264", "-preset", "ultrafast", "-crf", "30",
+ "-pix_fmt", "yuv420p", vid], check=True)
+ subprocess.run([FF, "-v", "error", "-y", "-f", "lavfi", "-i", "sine=frequency=440:sample_rate=48000",
+ "-t", "10.10", "-c:a", "pcm_s16le", aud], check=True)
+ subprocess.run([FF, "-v", "error", "-y", "-i", vid, "-i", aud, "-map", "0:v", "-map", "1:a",
+ "-c:v", "copy", "-c:a", "aac", "-b:a", "96k", p], check=True)
+ parts.append(p)
+ excess = sum(_dur(p, "a") - _dur(p, "v") for p in parts)
+ self.assertGreater(excess, 0.15, "the synthetic parts must carry the audio excess the model produces")
+ final = Path(td) / "take.mp4"
+ P._join_take_parts(FF, parts, final)
+ v, a = _dur(str(final), "v"), _dur(str(final), "a")
+ self.assertAlmostEqual(v, 5 * 241 / 24.0, delta=0.05)
+ self.assertLess(abs(a - v), 0.03, f"audio {a:.3f}s vs video {v:.3f}s — drift survived the join")
+
+
+if __name__ == "__main__":
+ unittest.main()