Skip to content

Local video editor for coding agents: 42 FFmpeg tools with a machine-readable contract and an MCP server, for Claude Code, Cursor and Codex. Cut, captions, reframe, loudness, platform exports. No cloud, no API keys.

fix(join): plain-cut dry run names a pending clip's trim as a placeholder; #302 follow-ups (#308)

Shogo Kajiyama95cc074fa3ec
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 796ab6d..928e33a 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,7 +4,8 @@
## Unreleased
-(nothing yet)
+- fix(join): a `--dry-run` plain cut (`--transition none`) with a pending input now notes that the planned `trim` lengths are the stub's 0 s placeholders, as the crossfade path already did for its offsets.
+- note (2.4.1): a plain cut's `expected_duration` is now the sum of each clip's `clip_length` (the length both streams are trimmed or held to), not the container durations. A value that callers see changed; the old one could not be met, so `verified` was false.
## 2.4.1
diff --git a/docs/design-decisions.md b/docs/design-decisions.md
index 3a0865a..6b89920 100644
--- a/docs/design-decisions.md
+++ b/docs/design-decisions.md
@@ -815,7 +815,7 @@ not a new file format this tool would have to maintain.
as `kind: input`, `reason: "no_speech"`, naming the engine and the caller's input rather than
the engine's deleted temporary SRT. Tests: `AsrNoSpeechTests`.
-## Unreleased
+## 2.4.1 — a plain join keeps its picture
- **A plain `join.py` cut gives each clip one length, as a crossfade does.** The concat filter
starts the next clip after the *longer* stream of this one, so the picture of a clip whose sound
diff --git a/scripts/join.py b/scripts/join.py
index c44d472..6eef884 100755
--- a/scripts/join.py
+++ b/scripts/join.py
@@ -529,6 +529,11 @@ def main() -> int:
if d and any(m.get("dry_run") for m in metas[:-1]):
STATE_NOTES.append("the planned xfade offsets count each pending input as 0 s long: a real run offsets "
"by its measured length")
+ elif not d and any(m.get("dry_run") for m in metas):
+ # the plain cut trims/holds every clip to clip_length too (2.4.1), so a pending clip's
+ # planned trim=duration=0.000 is the stub's placeholder, not the cut
+ STATE_NOTES.append("the planned trim lengths count each pending input as 0 s long: a real run trims "
+ "or holds it to its measured length")
output = args.output or default_output(args.inputs[0], "joined", "mp4")
cmd += ["-filter_complex", ";".join(parts), "-map", "[vout]", "-map", "[aout]"]
# the fps filter already made the picture constant-rate, and the per-clip trims (then xfade or
diff --git a/tests/test_editing.py b/tests/test_editing.py
index 9bc1f37..f70e612 100644
--- a/tests/test_editing.py
+++ b/tests/test_editing.py
@@ -1234,6 +1234,20 @@ class EditingTests(MediaFixtures):
"--json", "-o", d / "mute.mp4").stdout)
self.assertEqual((doc["status"], doc["silent"]), ("completed", []))
+ def test_join_plain_cut_dry_run_names_a_pending_clips_trim_as_a_placeholder(self):
+ """2.4.1 trims/holds every plain-cut clip to clip_length, so a pending clip's planned
+ `trim=duration=0.000` is the unmeasured stub's 0 s, not the cut. The plan says so (#77),
+ as the crossfade path already does for its offsets."""
+ d = OUT / "join_pending_video"
+ d.mkdir(exist_ok=True)
+ sh("ffmpeg", "-y", "-hide_banner", "-loglevel", "error", "-f", "lavfi", "-i", "testsrc=size=160x120:rate=25",
+ "-f", "lavfi", "-i", "sine=frequency=440", "-t", "1", "-shortest", "-c:v", "libx264", "-pix_fmt", "yuv420p",
+ d / "a.mp4")
+ doc = json.loads(script("join.py", d / "a.mp4", d / "later.mp4", "--transition", "none", "--dry-run", "--json",
+ "-o", d / "plan.mp4").stdout)
+ self.assertTrue(any("planned trim lengths count each pending input as 0 s" in n for n in doc["notes"]), doc["notes"])
+ self.assertFalse((d / "plan.mp4").exists())
+
def test_join_dry_run_plans_on_pending_segments(self):
"""Under --dry-run a segment that does not exist yet is an earlier step's output. Its
probe is the dry-run stub, whose (0x0) video stream used to decide the mode: one pending