commit 8ac41ca13e231d1f4bb878fcc514e226a58cc180
parent a9f8006b98cc7bac5a793024d985d4a8378c14d7
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Mon, 26 Oct 2026 22:02:03 -0400
umtool check: window-overlap is judged on what plays -- a crossfade seam and two non-overlapping cuts are not overlaps
21 of the shelf's 25 window-overlap cards were back-to-back clips of one
recording, the second starting exactly one transition before the first ends
(make-videos.py's unoverlap(): the fade lays the same seconds over themselves
and plays as one take). One more was two extents that overlap while their
cutStart/cutEnd pairs, which are what the build plays, do not.
The check now compares each clip's cut when it has the pair (else its extent),
and skips an overlap no longer than render.transition (0 under a montage,
which joins hard) when the later clip is the next entry in the timeline.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
2 files changed, 132 insertions(+), 3 deletions(-)
diff --git a/umtool/lib/projects/report.mjs b/umtool/lib/projects/report.mjs
@@ -38,6 +38,7 @@ const segmentDirs = (outDir) => [
];
import { adjudicationGaps, ledgerTotals, unadjudicatedOf } from "umtool-report-to-video/ledger-totals";
import { widen } from "umtool-report-to-video/resolve-windows";
+import { montageOn } from "umtool-report-to-video/montage";
import { fileSig, pathCache } from "../pathCache.mjs";
// widen() and the cache's window naming are IMPORTED, never reimplemented. The
@@ -1182,15 +1183,34 @@ export async function reportDecisions(ctx, summary) {
// Two clips from one source that overlap play as the same footage twice.
// resolve-windows de-overlaps them -- unless the earlier one has lockEnd,
// where it warns and refuses. That refusal is the decision.
- const sorted = [...list].sort((a, b) => a.start - b.start);
+ //
+ // Judged on what PLAYS: a clip's cut when it has the pair (the build
+ // honours the pair or neither), else its extent. Two extents that overlap
+ // while their cuts do not repeat nothing (quartering-slow-news s51/s52).
+ //
+ // And not a crossfade SEAM: the next clip in the timeline starting no more
+ // than one transition before this one ends is the fade laying the same
+ // seconds over themselves, which plays as one take -- the overlap is what
+ // makes it continuous (make-videos.py's unoverlap() writes exactly that;
+ // 21 of 25 overlaps on the shelf were these). A montage joins hard cuts.
+ const D = montageOn(m.render ?? {}) ? 0 : Number(m.render?.transition ?? 0.5) || 0;
+ const timelineIndex = new Map((m.timeline ?? []).map((t, i) => [t, i]));
+ const played = (e) =>
+ Number.isFinite(Number(e.cutStart)) && Number.isFinite(Number(e.cutEnd))
+ ? { from: Number(e.cutStart), to: Number(e.cutEnd) }
+ : { from: e.start, to: e.end };
+ const sorted = [...list].sort((a, b) => played(a).from - played(b).from);
for (let i = 0; i < sorted.length - 1; i += 1) {
const a = sorted[i];
const b = sorted[i + 1];
- if (a.end <= b.start) continue;
+ const overlap = played(a).to - played(b).from;
+ if (overlap <= 0) continue;
+ const seam = timelineIndex.get(b) === timelineIndex.get(a) + 1 && overlap <= D + 0.01;
+ if (seam) continue;
add(
"window-overlap",
a.id,
- `overlaps ${b.id} by ${(a.end - b.start).toFixed(1)}s` +
+ `overlaps ${b.id} by ${overlap.toFixed(1)}s` +
(a.lockEnd ? " and has lockEnd, so nothing will trim it" : ""),
a.lockEnd ? "open" : "info",
{ href: clipHref(a.id) },
diff --git a/umtool/lib/report/window-overlap.test.mjs b/umtool/lib/report/window-overlap.test.mjs
@@ -0,0 +1,109 @@
+// `window-overlap` is about footage that PLAYS twice. Two shapes on the shelf
+// overlapped on paper and repeated nothing, and made 22 of its 25 cards:
+//
+// - a crossfade seam: the next clip in the timeline starts one transition
+// before this one ends, so the fade lays the same seconds over themselves
+// (make-videos.py's unoverlap(), every hasan-leads polemic);
+// - two extents that overlap while the cuts that play do not
+// (quartering-slow-news s51/s52).
+//
+// Run with: pnpm test:scripts
+import assert from "node:assert/strict";
+import { mkdir, mkdtemp, rm, writeFile } from "node:fs/promises";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+
+import { decisionsFor } from "../projects/core.mjs";
+import { walkProjects } from "../projects/walk.mjs";
+
+async function overlapsOf(timeline, render = {}) {
+ const root = await mkdtemp(path.join(tmpdir(), "window-overlap-"));
+ try {
+ const channelsDir = path.join(root, "channels");
+ const reportsRoot = path.join(root, "reports");
+ const vdir = path.join(channelsDir, "chan", "data", "vid");
+ await mkdir(vdir, { recursive: true });
+ // Punctuated cues covering everything, every one closing a sentence, so the
+ // only decisions about these clips are the overlaps.
+ const cues = Array.from({ length: 200 }, (_, i) => ({ start: i, end: i + 1, text: `Line ${i}.` }));
+ await writeFile(path.join(vdir, "transcript.cues.json"), JSON.stringify({ cues }));
+ const dir = path.join(reportsRoot, "cut");
+ await mkdir(dir, { recursive: true });
+ await writeFile(path.join(dir, "video.manifest.json"), JSON.stringify({
+ schemaVersion: 1, slug: "cut", title: "Cut",
+ provenance: { channelSlug: "chan", channelsDir: path.relative(dir, channelsDir), siteOrigin: "https://example.test" },
+ render: { width: 1920, height: 1080, fps: 30, ...render },
+ timeline: timeline.map((e) => ({ type: "clip", video: "vid", cite: Math.floor(e.start), lock: true, ...e })),
+ }, null, 2));
+ const [ref] = (await walkProjects(reportsRoot)).filter((p) => p.id === "cut");
+ return (await decisionsFor(ref, reportsRoot))
+ .filter((d) => d.kind === "window-overlap")
+ .map((d) => `${d.target}: ${d.why}`);
+ } finally {
+ await rm(root, { recursive: true, force: true });
+ }
+}
+
+test("a crossfade seam between back-to-back clips is not an overlap", async () => {
+ // b starts exactly one transition (0.5 s) before a ends, and follows it.
+ assert.deepEqual(
+ await overlapsOf([{ id: "a", start: 10, end: 20 }, { id: "b", start: 19.5, end: 30 }], { transition: 0.5 }),
+ [],
+ );
+ // The default transition is the build's: 0.5.
+ assert.deepEqual(await overlapsOf([{ id: "a", start: 10, end: 20 }, { id: "b", start: 19.5, end: 30 }]), []);
+});
+
+test("more than a transition, a clip not next in the timeline, a hard cut, a montage: still overlaps", async () => {
+ assert.deepEqual(
+ await overlapsOf([{ id: "a", start: 10, end: 20 }, { id: "b", start: 18, end: 30 }], { transition: 0.5 }),
+ ["a: overlaps b by 2.0s"],
+ );
+ assert.deepEqual(
+ await overlapsOf(
+ [{ id: "a", start: 10, end: 20 }, { id: "x", start: 50, end: 60 }, { id: "b", start: 19.5, end: 30 }],
+ { transition: 0.5 },
+ ),
+ ["a: overlaps b by 0.5s"],
+ );
+ // b plays BEFORE a: the fade into a is not the seam with b.
+ assert.deepEqual(
+ await overlapsOf([{ id: "b", start: 19.5, end: 30 }, { id: "a", start: 10, end: 20 }], { transition: 0.5 }),
+ ["a: overlaps b by 0.5s"],
+ );
+ assert.deepEqual(
+ await overlapsOf([{ id: "a", start: 10, end: 20 }, { id: "b", start: 19.5, end: 30 }], { transition: 0 }),
+ ["a: overlaps b by 0.5s"],
+ );
+ // A montage joins its segments hard, whatever `transition` says.
+ assert.deepEqual(
+ await overlapsOf([{ id: "a", start: 10, end: 20 }, { id: "b", start: 19.5, end: 30 }], { transition: 0.5, montage: {} }),
+ ["a: overlaps b by 0.5s"],
+ );
+});
+
+test("judged on the cuts that play when a clip has the pair", async () => {
+ // Extents overlap by 1.8 s; the cuts are 3 s apart (quartering-slow-news s51/s52).
+ assert.deepEqual(
+ await overlapsOf(
+ [
+ { id: "s51", start: 89.18, end: 99.14, cutStart: 91.68, cutEnd: 96.64 },
+ { id: "s52", start: 97.34, end: 107.82, cutStart: 99.84, cutEnd: 105.32 },
+ ],
+ { transition: 0 },
+ ),
+ [],
+ );
+ // Half a pair renders the whole extent, so the extent is what is judged.
+ assert.deepEqual(
+ await overlapsOf(
+ [
+ { id: "s51", start: 89.18, end: 99.14, cutStart: 91.68 },
+ { id: "s52", start: 97.34, end: 107.82 },
+ ],
+ { transition: 0 },
+ ),
+ ["s51: overlaps s52 by 1.8s"],
+ );
+});