commit 85d03e97e94885a686ebab34ca22a5f8679afa09
parent df5fbeb2e322fa478a959cdf17129888f7c5139a
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sun, 18 Oct 2026 18:09:45 -0400
umtool: the wall's length exact on ffmpeg 7.1 — fps before each tile's tpad
On ffmpeg 7.1 (Debian trixie, the umtool image) `trim,setpts,tpad` pads nothing: neither tpad's start
(the tile not yet arrived) nor its clone at the end (the frozen tile), so a single-tile wall came out 23
frames short (montage.test "wall-finale": 420 vs 443; one tile's chain 36 frames for 60). `fps` before tpad
gives it the frame rate it pads by; on 9.x's CFR tiles it changes no frame (md5 of wall-finale and
build-to-wall identical to main's). The grouped wall's tiles had the same chains: there the canvas held the
length, but a tile vanished after its phrase instead of freezing. A test says every tile's tpad is fed by fps.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 21 insertions(+), 4 deletions(-)
diff --git a/umtool/report-to-video/montage.mjs b/umtool/report-to-video/montage.mjs
@@ -1309,9 +1309,9 @@ export function wallComposeArgs({ tiles, plan, render, settings, first, last, en
const again = Math.min(t.seconds, plan.beatLen);
parts.push(
`[${i}:v]split[wv${i}a][wv${i}b]`,
- `[wv${i}a]trim=end=${exprNum(once)},setpts=PTS-STARTPTS,` +
+ `[wv${i}a]trim=end=${exprNum(once)},setpts=PTS-STARTPTS,fps=${fps},` +
`tpad=start_duration=${exprNum(at)}:start_mode=add:color=${bg}:stop_mode=clone:stop_duration=${beat},trim=end_frame=${plan.beatFrames}[wv${i}c]`,
- `[wv${i}b]trim=end=${exprNum(again)},setpts=PTS-STARTPTS,tpad=stop_mode=clone:stop_duration=${exprNum(plan.beatLen)},` +
+ `[wv${i}b]trim=end=${exprNum(again)},setpts=PTS-STARTPTS,fps=${fps},tpad=stop_mode=clone:stop_duration=${exprNum(plan.beatLen)},` +
`trim=end_frame=${plan.frames - plan.beatFrames}[wv${i}d]`,
`[wv${i}c][wv${i}d]concat=n=2:v=1:a=0[wt${i}]`,
);
@@ -1389,8 +1389,8 @@ function groupedWallComposeArgs({ tiles, plan, render, settings, first, last, en
const secondF = plan.frames - plan.restartFrames[i];
parts.push(
`[${i}:v]split[wv${i}a][wv${i}b]`,
- `[wv${i}a]trim=end=${exprNum(once)},setpts=PTS-STARTPTS,tpad=stop_mode=clone:stop_duration=${total},trim=end_frame=${firstF}[wv${i}c]`,
- `[wv${i}b]trim=end=${exprNum(again)},setpts=PTS-STARTPTS,tpad=stop_mode=clone:stop_duration=${total},trim=end_frame=${secondF}[wv${i}d]`,
+ `[wv${i}a]trim=end=${exprNum(once)},setpts=PTS-STARTPTS,fps=${fps},tpad=stop_mode=clone:stop_duration=${total},trim=end_frame=${firstF}[wv${i}c]`,
+ `[wv${i}b]trim=end=${exprNum(again)},setpts=PTS-STARTPTS,fps=${fps},tpad=stop_mode=clone:stop_duration=${total},trim=end_frame=${secondF}[wv${i}d]`,
`[wv${i}c][wv${i}d]concat=n=2:v=1:a=0,setpts=PTS-STARTPTS+${exprNum(at)}/TB[wt${i}]`,
);
const l = plan.layout[i];
diff --git a/umtool/report-to-video/montage.test.mjs b/umtool/report-to-video/montage.test.mjs
@@ -1374,3 +1374,20 @@ test("render: a window whose picture starts late is cut on its own clock", { ski
await rm(root, { recursive: true, force: true });
}
});
+
+test("wall compose: every tile's tpad is fed by fps (ffmpeg 7.1's tpad pads nothing after a trim without it)", () => {
+ // On 7.1 (Debian trixie, the umtool image) `trim,setpts,tpad` pads neither the start nor the clone at
+ // the end, so the single wall came out 23 frames short; `fps` before tpad gives it a frame rate to pad
+ // by, and on CFR input changes no frame on 9.x.
+ const tiles = Array.from({ length: 9 }, (_, i) => ({ file: `/t/${i}.mp4`, seconds: 1.2 }));
+ const render = { width: 320, height: 180, fps: 30, palette: PALETTE };
+ const graphs = [
+ wallComposeArgs({ tiles, plan: wallPlan({ tiles: 9, build: 3, durations: Array(9).fill(1.2), fps: 30, width: 320, height: 180 }), render, settings: resolveMontage({ montage: { wall: { tiles: 9 } } }), first: false, last: true, encode: [], outPath: "/o" }),
+ wallComposeArgs({ tiles, plan: wallPlan({ tiles: 9, build: 3, durations: Array(9).fill(1.2), fps: 30, width: 320, height: 180, groups: "double", leads: Array(9).fill(0.12) }), render, settings: resolveMontage({ montage: { wall: { tiles: 9, groups: "double" } } }), first: false, last: true, encode: [], outPath: "/o" }),
+ ].map((a) => a[a.indexOf("-filter_complex") + 1]);
+ for (const g of graphs) {
+ const tpads = g.match(/[^,;\]]*,tpad=/g) ?? [];
+ assert.equal(tpads.length, 18, "two per tile");
+ for (const t of tpads) assert.equal(t, "fps=30,tpad=");
+ }
+});