commit 64c089e7c0f6c567ac2d004ec5121d3164e61333
parent 16662aad15661ded6e916cbb3fb5595c537cf9af
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 17 Oct 2026 17:32:07 -0400
umtool: a montage counts each clip by its own montage.n of montage.of (the phrase seed writes both), else its place — a take of part of the cut still says #31 of 75, and stutter every-Nth follows the same number; the ramp stays by place. montage tests 38, phraseScan 3
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 28 insertions(+), 10 deletions(-)
diff --git a/common/lib/montage/phraseScan.mjs b/common/lib/montage/phraseScan.mjs
@@ -328,7 +328,7 @@ export function instancesAsClips(instances, { pad = 2.5, idPrefix = "s" } = {})
quote: i.context.slice(0, 240),
onscreen: { title: squash(i.match).toLowerCase(), subtitle: niceDate(i.date) },
...(notes.length ? { note: notes.join("; ") } : {}),
- montage: { n, date: i.date ?? null, platform: i.platform ?? null, match: i.match, speakerCheck: Boolean(i.speakerCheck) },
+ montage: { n, of: instances.length, date: i.date ?? null, platform: i.platform ?? null, match: i.match, speakerCheck: Boolean(i.speakerCheck) },
};
});
}
diff --git a/common/lib/montage/phraseScan.test.ts b/common/lib/montage/phraseScan.test.ts
@@ -96,7 +96,7 @@ test("phraseScan: a twin on the preferred channel wins; a hit it lacks is placed
quote: ">> it must be a slow news week",
onscreen: { title: "slow news week", subtitle: "2 May 2019" },
note: "voice check: a speaker change in the captions",
- montage: { n: 1, date: "20190502", platform: "youtube", match: "slow news week", speakerCheck: true },
+ montage: { n: 1, of: 4, date: "20190502", platform: "youtube", match: "slow news week", speakerCheck: true },
});
assert.match(String(clips[2].note), /placed from yt\/yt2/);
} finally {
diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md
@@ -795,7 +795,9 @@ source), a punch-in (`snap` at the phrase, or a slow `drift`), a `stutter` on
chosen clips, a `ramp` that shortens the clips toward the end, a `wall` of 9, 16
or 25 tiles saying it together, and a `yearStamp` when the year changes. All are
overlays on the footage or the footage itself — never a card. A clip's phrase is
-its `montage.match` (else `onscreen.title`), its date `montage.date`.
+its `montage.match` (else `onscreen.title`), its date `montage.date`, and its
+number `montage.n` of `montage.of` (else its place in the cut) — so a take of
+part of the cut still counts #31 of 75. The ramp is by place in the cut.
Every key, its values and where each is made: [report-to-video
README](../report-to-video/README.md#rendermontage--montage-editing-release-33).
diff --git a/umtool/report-to-video/README.md b/umtool/report-to-video/README.md
@@ -734,7 +734,9 @@ a manifest without `render.montage` (or with `null`) renders byte for byte as
before. Each clip's phrase is its `montage.match` (what
the phrase seed writes), else its `onscreen.title`; its date is
`montage.date` (`YYYYMMDD`), else `date`, else the record's upload date; its
-source is `montage.platform`.
+source is `montage.platform`; the counter's number is `montage.n` of
+`montage.of` (the phrase seed writes both), else its place among the clips —
+stutter's `every` counts the same number; the ramp counts places.
```jsonc
"render": { "montage": {
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -1421,7 +1421,7 @@ async function montageCues(entry, provenance) {
*/
async function montageCut({ entry, M, render, provenance, fetchStart, sil, wantA, wantB, win }) {
const s = M.settings;
- const ctx = M.ctx.get(entry.id) ?? { k: 0, n: 1, cap: null, stutter: false, date: null, year: null, yearChange: false, platform: null, first: false, last: false };
+ const ctx = M.ctx.get(entry.id) ?? { k: 0, n: 1, number: 1, of: 1, cap: null, stutter: false, date: null, year: null, yearChange: false, platform: null, first: false, last: false };
const text = clipPhrase(entry);
const hasCut = Number.isFinite(entry.cutStart) && Number.isFinite(entry.cutEnd);
let found = null;
diff --git a/umtool/report-to-video/montage.mjs b/umtool/report-to-video/montage.mjs
@@ -411,7 +411,10 @@ export const stutters = (stutter, k, id) =>
/**
* The per-clip facts a montage needs from the whole cut, by clip id: k (its
- * place among the clips), n (how many), its cap under the ramp, whether it
+ * place among the clips), n (how many), `number` and `of` (what the counter
+ * says: the clip's own `montage.n` / `montage.of` when it carries them — so a
+ * take of part of the cut still counts #31 of 75 — else k + 1 and n), its cap
+ * under the ramp, whether it
* stutters, its date and year, whether its year differs from the clip
* before's, its source, and whether its segment opens or closes the cut
* (`first`/`last`: a cut style has nothing to cut from or to there; a wall
@@ -430,10 +433,14 @@ export function planMontage(timeline, settings, dateOf = () => null) {
const date = parseClipDate(e.montage?.date) ?? parseClipDate(e.date) ?? parseClipDate(dateOf(e));
const year = date?.y ?? null;
const i = timeline.indexOf(e);
+ const own = Number(e.montage?.n);
+ const number = Number.isInteger(own) && own > 0 ? own : k + 1;
+ const ownOf = Number(e.montage?.of);
out.set(e.id, {
- k, n,
+ k, n, number,
+ of: Number.isInteger(ownOf) && ownOf >= number ? ownOf : n,
cap: rampCap(k, n, settings.ramp),
- stutter: stutters(settings.stutter, k, e.id),
+ stutter: stutters(settings.stutter, number - 1, e.id),
date, year,
yearChange: year != null && year !== prevYear,
platform: e.montage?.platform ?? null,
@@ -742,7 +749,7 @@ export function montageOverlayFilters({ settings, ctx, render, font }) {
const c = settings.counter;
if (c) {
const words = counterText({
- n: ctx.k + 1, of: c.of ? ctx.n : null, date: ctx.date, platform: ctx.platform,
+ n: ctx.number ?? ctx.k + 1, of: c.of ? (ctx.of ?? ctx.n) : null, date: ctx.date, platform: ctx.platform,
showDate: c.showDate, showSource: c.showSource,
});
const at = corner(c.position, m);
@@ -773,7 +780,7 @@ export function montageOverlayFilters({ settings, ctx, render, font }) {
}));
}
} else if (c.style === "tally") {
- const t = tallyMarks(ctx.k + 1, H);
+ const t = tallyMarks(ctx.number ?? ctx.k + 1, H);
const pad = Math.round(H * 0.012);
const small = Math.round(H * 0.03);
const lineH = words.line ? Math.round(small * 1.6) : 0;
diff --git a/umtool/report-to-video/montage.test.mjs b/umtool/report-to-video/montage.test.mjs
@@ -240,6 +240,13 @@ test("planMontage: each clip's place, year change, stutter and edges; cards coun
const atStart = planMontage(timeline.slice(1), resolveMontage({ montage: { wall: { at: "start" } } }));
assert.equal(atStart.get("a").first, false);
assert.equal(atStart.get("d").last, true);
+ assert.deepEqual([...plan.values()].map((p) => [p.number, p.of]), [[1, 4], [2, 4], [3, 4], [4, 4]]);
+ // A take of part of the cut: the clips keep their own numbers, and every-Nth stutter follows them.
+ const part = planMontage(
+ [clip("x", { montage: { n: 31, of: 75 } }), clip("y", { montage: { n: 32, of: 75 } })],
+ resolveMontage({ montage: { stutter: { every: 2, clips: [] } } }),
+ );
+ assert.deepEqual([...part.values()].map((p) => [p.k, p.number, p.of, p.stutter]), [[0, 31, 75, false], [1, 32, 75, true]]);
assert.equal(stutters({ every: 5, clips: [] }, 4, "x"), true);
assert.equal(stutters({ every: 5, clips: [] }, 5, "x"), false);
assert.equal(stutters(null, 4, "x"), false);