commit bd5dc71e822c9f2b56998ae0b961910b1ca8942b
parent 2041886fe4d644f2874af082c8c2c2dd784b1959
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Fri, 20 Nov 2026 19:23:40 -0500
umtool: the gap mark never stands on the deck's source line; the deck stays lazy beside it (review 1d)
- The deck place reckons the source line in the face the deck sets it in (the
brand's IBM Plex Mono included), with its separators' padding and its
letter-spacing, each glyph rounded up to a whole pixel; and the mark's page
measures a hidden copy of the line in its own faces before it shows the
mark, standing it at its footage place if they would touch.
- A cut record decides the joins: a segment cut before its gaps marks none,
and a chrome-only pass says so; its note on a segment that drew its own
marks is worded by whether the mark is still wanted.
- deckWant keeps the deck's lazy capture beside the gap-cue windows: their
frame keys are composed without drawing (composeChrome keysOnly).
- An untitled clip in a two-line deck: the meta line's row (chrome-deck
untitledRows / sourceLineRow, read by the page and the slice).
- Over the footage the mark keeps off the stats panel and the effects'
screenshots; it ends before the dissolve out, a short one rising only as
the drawtext's does; clip ids with '.' or ':' name their marks.
- Play shows the element for a clip whose segment drew its own marks.
- Tests: gap-cue-slice (+9), onscreen (built branch), gap-cue-build (real
encodes, stub renderer). knobs.md, the Modules section, the changelog.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
13 files changed, 864 insertions(+), 101 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -13,7 +13,16 @@
`gapCue.place=deck`. It is also in the bench's **where** control and the Modules panel.
- With no chrome over the picture (the plain cut, `--no-chrome`, a bare vertical cut, `--desktop`, `--short`) the
mark is still drawn into the clip's segment. The two are never drawn on one frame.
- - A take whose segments already drew marks under a deck changes those segments' keys once.
+ - A take whose segments already drew marks under a deck changes those segments' keys once. A `--chrome-only` pass
+ over such a segment says so, worded by whether the mark is still wanted.
+ - The deck place never covers the source line. The line is measured in the face the deck sets it in (the brand's
+ IBM Plex Mono included), and the mark's page measures it again in its own faces before it shows the mark; if
+ they would touch, the mark goes over the footage.
+ - The deck's lazy capture stays on with gap marks in the cut: a retrofit draws the deck only for the chunks the
+ marks are in.
+ - A segment cut before its clip had gaps gets no mark at a join its picture does not have, and the pass says so.
+ - Over the footage the mark also keeps off the stats panel and the effects' screenshots. A mark ends before the
+ dissolve into the next clip. Clip ids with `.` or `:` work.
- **umtool: the gap mark is set on the clip bench and shows while playing.**
- A click on a gap's band now picks the gap. A row under the waveform shows its seconds, how it shows (skip;
fast-forward is not built yet), its own mark (as the clip's, on or off), what it was cut for, its own words, its
diff --git a/umtool/components/projects/review/playCore.tsx b/umtool/components/projects/review/playCore.tsx
@@ -385,8 +385,11 @@ export function PlayStage({ core, basic = false, plainClassName }: { core: PlayC
[item, cueEntry],
);
const gapMark = gapMarks.length ? gapMarkAt(gapMarks, t) : null;
- // (Only without a deck: under one, the gap-cue module's page draws it, ModuleLayers.)
- const gapCorner = gapMarkCorner(gapMark?.corner ?? cueEntry?.gapCue?.corner, { deck: false });
+ // Under a deck the gap-cue module's page draws it (ModuleLayers) -- except for a clip whose segment drew its marks
+ // INTO its picture (the schedule's gapCue.inSegment: built with no chrome drawing them): the render shows those,
+ // and Play's footage is the source, so the chip stands in for them at the deck's corner.
+ const gapInSegment = !!item && !!doc && ((doc.schedule as { gapCue?: { inSegment?: string[] } }).gapCue?.inSegment ?? []).includes(item.id);
+ const gapCorner = gapMarkCorner(gapMark?.corner ?? cueEntry?.gapCue?.corner, { deck: gapInSegment });
const sideNow = item && sideEntry ? <SidePostOverlay project={project} take={take} clipId={item.id} side={sideEntry} s={Math.max(0, t - item.start)} published={asPublished} /> : null;
const postPlayer = (box2: { width: number; height: number }) =>
postNow ? (
@@ -509,7 +512,11 @@ export function PlayStage({ core, basic = false, plainClassName }: { core: PlayC
{introCard}
{placeholderCard}
{sideNow && rect && <div className="pointer-events-none absolute" style={{ left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) }}>{sideNow}</div>}
- {/* The gap mark under a deck is the gap-cue module's own page (a play layer, below): its live preview. */}
+ {/* The gap mark under a deck is the gap-cue module's own page (a play layer, below): its live preview -- but
+ a clip whose segment drew its own (gapInSegment) has none there, so the chip shows what the render does. */}
+ {gapInSegment && gapMarks.length > 0 && rect && (
+ <GapMarkChip mark={gapMark} corner={gapCorner} box={{ left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) }} testId="play-gap-mark" />
+ )}
{/* Over a full-frame item (full-frame.mjs) a layer that keeps no time of its own is not drawn (layerOff):
kept mounted, transparent, so its page is ready and seeked when the item after it comes up. The feed
follows the deck (followsDeck), as the deck's own page does: off over a video entry or an analysis item. */}
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -303,7 +303,9 @@ seconds (`report-to-video/gaps.mjs` is the rule and both clocks).
safe area's top right (full bleed, desktop), and a twocrop clip's crop one top right -- every vertical mark inside
the safe area, whatever corner is asked; a hidden region up while the mark is, or a code, under that corner moves
it to the next free one -- and under a deck so do the other modules over the footage while each is up: a stamp,
- the popup posts' column, the chat column, a chapter's cover (not an effect's shot box). A mark too wide for its box (a long label with a long reason on a 1080-wide frame) is
+ the popup posts' column, the chat column, a chapter's cover, the stats panel, and the effects' screenshots (the
+ receipts' fan, a column on their side; a zoom's card, centred -- each reckoned at its largest, since the page sizes
+ it to its shot). A mark too wide for its box (a long label with a long reason on a 1080-wide frame) is
drawn smaller, down to 75 % of its size, then cut to fit, ending `…`: never off its box. Its text is drawn as
written (`expansion=none`): a `%` or a `\` in a label or a reason is words; a tab or any other control character
is refused there. A clip cut from its pieces marks the join between two pieces too (the recording's seconds left
@@ -337,17 +339,33 @@ seconds (`report-to-video/gaps.mjs` is the rule and both clocks).
left out (between a clip's pieces too) -- which the schedule already reads. A record written before this slice
has them, so **an old take gets its marks from a chrome-only re-render, no re-cut**: `umtool look <p>
gapCue='{"mark":true}'`, then a `--chrome-only` take. The marks are on the schedule (`schedule.json`'s `gapCue`:
- each mark's cut seconds, text, place, corner, rect).
+ each mark's cut seconds, text, place, corner, rect). **The record decides**: a segment cut before its clip had
+ gaps (no `gaps` in its record) plays them, so it has no join to mark -- a `--chrome-only` pass draws none there and
+ says `<id>: its segment was cut before its gaps — the footage plays them and no gap mark is drawn for them; rebuild
+ it …`. Only with no record at all (Play's preview before any build) do the clip's play window and its gaps stand in.
+ - **Around a dissolve**: a mark is gone before the dissolve into the next segment begins (its picture is the next
+ clip's by then) -- one that would run on into it ends there, faded out by then, and one left shorter than 0.2 s is
+ not drawn; a mark cut short rises only as far as its ramps meet (as the drawtext's alpha does), never a flash to
+ full. A mark at a join inside the first dissolve of a clip that follows a full-frame item (a teaser, the intro, a
+ card the deck hides over) is not drawn until that item's dissolve out ends, as every layer that keeps no time of
+ its own (full-frame.mjs).
- **`place`** (`render.gapCue.place`, a clip's `gapCue.place`; `umtool look <p> gapCue='{"place":"deck"}'`, `umtool
set <p> <clip> gapCue.place=deck`, the bench's **where**, the Modules panel): `footage` (default) over the footage
box at its corner; `deck` in the deck's band, right-aligned at the end of the source line's row (22 px short of
the text column's end: left of the QR's plate and of a tally beside it), centred on the row, a size under the
- source line (90 % of its text). The deck's own page is not touched -- the source line keeps every word, the
- source status at its end included -- so the mark stands there only when the line at its longest (its status's
- long form too, reckoned at the deck face's advance) and the mark both fit the row with air between; otherwise
- (a long source title, a tally narrowing the column) it is drawn over the footage instead, as `footage` draws it
- (the schedule's mark says `fell: "row"`). Likewise in the stacked vertical deck (its band is laid otherwise:
- `fell: "stacked"`), over a segment that hides the deck (`fell: "hidden"`), and in a cut with no deck.
+ source line (90 % of its text; an untitled clip's on its promoted row, in a two-line deck on the meta line). The
+ deck's own page is not touched -- the source line keeps every word, the source status at its end included -- so
+ the mark stands there only when the line at its longest (its status's long form too) and the mark both fit the
+ row with air between (24 px); otherwise (a long source title, a tally narrowing the column) it is drawn over the
+ footage instead, as `footage` draws it (the schedule's mark says `fell: "row"`). The line is reckoned in the face
+ the deck sets it in -- the brand's IBM Plex Mono when `render.brand` is set, else the wider of a sans's advances
+ and a mono's -- with the separators' padding (0.42 em either side of each dot) and the letter-spacing, each glyph
+ rounded up to a whole pixel (Plex Mono at 26 px: reckoned 544 px, drawn 543.7). **And the page never trusts the
+ reckoning alone**: it lays a hidden copy of the source line (the deck's markup, faces and size) on its row and,
+ once its faces are in, if the line's end and the air after it reach the mark, it stands the mark at its footage
+ place instead (`data-fell="line"` on the element). Likewise in the stacked vertical deck (its band is laid
+ otherwise: `fell: "stacked"`) and in a cut with no deck. (A segment that hides the deck, `fell: "hidden"`, is a
+ guard: a clip never hides it.) The live preview measures the line as the manifest has it, not a line typed in Play.
- **What re-renders**, under a deck (chunks: the hard-cut chunked encode's, keyed on the frames they read):
- the mark on for a take: no clip segment; one small page per mark and the chunks over its seconds (`--chrome-only`
does it);
@@ -355,14 +373,20 @@ seconds (`report-to-video/gaps.mjs` is the rule and both clocks).
their chunks -- never a segment, never the deck's own page;
- `min`, or the mark off on a clip or a gap: those pages gone or added, and their chunks;
- with no deck (the drawtext path), as slice 1: the clip's segment, then the chunks over it.
- With a gap-cue page in the cut the deck is no longer its one overlay layer, so the deck's lazy capture (only the
- frames the chunks to encode read) is off for that build, as with any other window module.
+ The deck's lazy capture (only the frames the chunks to encode read) stays on beside the gap-cue pages: their frame
+ keys are composed without drawing a frame (compose-chrome `keysOnly`, build-video `deckWant`), so the chunks over
+ a mark's seconds are known before any layer is captured. Measured on a two-chunk test cut, the retrofit asks for
+ the 31 deck frames of the one chunk the mark is in and draws 8 (the rest keyed the same), where without it all 60
+ were asked for and 37 drawn (with any OTHER window module on, every deck frame is asked for, as before).
- **A take that drew marks into its segments under a deck** (possible since the first slice's merge with the mark on
-- it is off by default): its next build changes those segments' keys ONCE, back to the plain segment's (a
rebuild, or the plain one reused from the cache when it is there), and the chrome draws the marks from then on.
A `--chrome-only` pass over such a segment leaves the chrome's marks out for it (never twice) and says so, one note
- per clip (`<id>: its gap marks are drawn into its segment … build without --chrome-only (or --only <id>) to have
- the chrome draw them`).
+ per clip: while the mark is wanted, `<id>: its gap marks are drawn in its segment (built with no chrome drawing
+ them) — --chrome-only leaves the chrome's out for it; rebuild it (a build without --chrome-only, or --only <id>) to
+ let the chrome draw them`; once it is off, `<id>: its segment still shows gap marks that are no longer wanted —
+ --chrome-only cannot take them out; rebuild it …`. Play shows such a clip's marks with the element over its
+ footage at the deck's corner (Play plays the source, not the segment that carries them).
- **Play the cut and the bench**: under a deck, **Play shows the module's own page** (a play layer, seeked on the
cut's clock: the build's pixels, at the build's place and corner, hopped as the build hops it) -- no second drawing.
With no deck, Play and the bench draw an element over the raw picture at the same seconds with the same text and
@@ -3255,7 +3279,7 @@ The full reference is [Gaps inside a clip](#gaps-inside-a-clip) (the mark at the
|---|---|---|
| `render.gapCue.mark` | `true` · `false` · default `false` (off: every cut renders as it did) | `umtool look <p> gapCue='{"mark":true}'` · a take: `--set render.gapCue.mark=true` |
| `render.gapCue.min` | 0.5–60 s · default 2 (a shorter gap draws nothing) | `umtool look <p> gapCue='{"min":4}'` |
-| `render.gapCue.place` | `footage` (over the footage, at its corner) · `deck` (in the deck's band, at the end of the source line, left of the QR -- over the footage where the row has no room, the deck is hidden or stacked, and in a cut with no deck) · default `footage` | `umtool look <p> gapCue='{"place":"deck"}'` |
+| `render.gapCue.place` | `footage` (over the footage, at its corner) · `deck` (in the deck's band, at the end of the source line, left of the QR -- over the footage where the row has no room, in the stacked vertical deck and in a cut with no deck; the page measures the line in its own faces and never stands the mark on it) · default `footage` | `umtool look <p> gapCue='{"place":"deck"}'` |
| `render.gapCue.corner` | `auto` (the layout's free corner) · `tl` · `tr` · `bl` · `br` · default `auto` | `umtool look <p> gapCue='{"corner":"br"}'` |
| `render.gapCue.label` | text holding `{s}` (the time skipped: `27 s`, from a minute `1:12`) and maybe `{why}` (the gap's reason); a part in `[ ]` is drawn only when the gap has one; at most 40 characters · default `» {s}[ · {why}]` (`» 27 s`, `» 26 s · dead air`) | `umtool look <p> gapCue='{"label":"{s} later"}'` |
| a clip's `gapCue` | the same keys, over the project's | `umtool set <p> <clip> gapCue.mark=false gapCue.corner=tr gapCue.place=deck` (`gapCue=` clears them) |
diff --git a/umtool/lib/report/onscreen.test.mjs b/umtool/lib/report/onscreen.test.mjs
@@ -504,3 +504,36 @@ test("composeStampPreview: compose-chrome's stamp region, into stamp-preview, re
/not \/proj\/out\/sourced\/chrome\/stamp-preview/,
);
});
+
+test("the gap marks over a matching build's schedule come from its cut records (review 1d, 10): the record's start and gaps, not the play window's; a record with no gaps marks nothing", async () => {
+ const dir = await mkdtemp(path.join(tmpdir(), "onscreen-gapcue-"));
+ try {
+ const m = cut();
+ m.render = { ...m.render, gapCue: { mark: true } };
+ m.timeline[2] = { ...m.timeline[2], gaps: [{ from: 33, to: 37 }] };
+ const seg = path.join(dir, "out", "sourced", "segments");
+ await mkdir(seg, { recursive: true });
+ await writeFile(path.join(dir, "out", "sourced", "schedule.json"), JSON.stringify(built()));
+ // Cut from 30.6 (snapped): the join 2.4 s into the segment -- the play window would put it at 3.
+ const rec = { version: 1, id: "c02", video: "v2", start: 30.6, end: 41, gaps: [{ from: 33, to: 37 }] };
+ await writeFile(path.join(seg, "c02.cut.json"), JSON.stringify(rec));
+ const { schedule } = await scheduleForPreview({ dir }, m, "sourced", new Map(), {}, { resolver: { find: async () => null } });
+ assert.equal(schedule.estimated, false, "the build's schedule");
+ assert.equal(schedule.gapCue.marks.length, 1);
+ assert.ok(Math.abs(schedule.gapCue.marks[0].at - (13.9 + 2.4)) < 1e-3, `at ${schedule.gapCue.marks[0].at}: the built segment's start + the record's join`);
+ assert.equal(schedule.gapCue.marks[0].text, "» 4 s");
+ // The segment cut before its gaps: the record decides, no mark.
+ const { gaps: _g, ...noGaps } = rec;
+ await writeFile(path.join(seg, "c02.cut.json"), JSON.stringify(noGaps));
+ const again = await scheduleForPreview({ dir }, m, "sourced", new Map(), {}, { resolver: { find: async () => null } });
+ assert.equal("gapCue" in again.schedule, false);
+ // Mark off: the key absent, the schedule the preview drew before.
+ const offM = { ...m, render: { ...m.render, gapCue: { mark: false } } };
+ const off = await scheduleForPreview({ dir }, offM, "sourced", new Map(), {}, { resolver: { find: async () => null } });
+ const plain = await scheduleForPreview({ dir }, { ...m, render: { ...cut().render } }, "sourced", new Map(), {}, { resolver: { find: async () => null } });
+ assert.equal("gapCue" in off.schedule, false);
+ assert.equal(JSON.stringify(off.schedule), JSON.stringify(plain.schedule));
+ } finally {
+ await rm(dir, { recursive: true, force: true });
+ }
+});
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -5911,29 +5911,77 @@ export async function planChunks({ segments, render, chrome = null, joins = null
}
/**
+ * What a chrome-only pass (`what`: --chrome-only / --chrome-preview) says of one clip's segment and its gaps, or
+ * null: a segment whose marks were drawn INTO it while the mark is still wanted (the chrome leaves its marks out;
+ * rebuild it to let the chrome draw them), or no longer wanted (the segment still shows them until it is rebuilt);
+ * a segment cut before its clip had the gaps it now has (the footage plays them; no mark is drawn for them).
+ */
+export function segmentGapNote({ entry, record, render, what }) {
+ if (entry?.type !== "clip" || !record) return null;
+ if (Array.isArray(record.gapMarks) && record.gapMarks.length) {
+ return gapCueWanted(render, entry)
+ ? `${entry.id}: its gap marks are drawn in its segment (built with no chrome drawing them) — ${what} leaves the chrome's out for it; rebuild it (a build without ${what}, or --only ${entry.id}) to let the chrome draw them`
+ : `${entry.id}: its segment still shows gap marks that are no longer wanted — ${what} cannot take them out; rebuild it (a build without ${what}, or --only ${entry.id})`;
+ }
+ const a = Number(record.start);
+ const b = Number(record.end);
+ if (!Array.isArray(record.gaps) && renderGaps(entry, render).some((g) => !(Number.isFinite(a) && Number.isFinite(b)) || (g.to > a && g.from < b))) {
+ return `${entry.id}: its segment was cut before its gaps — the footage plays them and no gap mark is drawn for them; rebuild it (a build without ${what}, or --only ${entry.id}) to cut them`;
+ }
+ return null;
+}
+
+/**
* The deck's `want` (compose-chrome): draw only the frames the chunked
* encode will read -- a fix `--from` a take whose frames were pruned captures
* the touched post's frames, not the whole cut's (mid-6: 11,996 captures,
- * 90 s). Only when the deck's shell is the cut's one overlay layer (another
- * layer's frames are in the same chunks' keys, and are captured beside it),
- * and the encode is chunked. `UMTOOL_CHROME_LAZY=0` draws every frame.
- */
-export function deckWant({ schedule, render, outDir, segments, joins = null, hardCut, env = process.env }) {
+ * 90 s). When the deck's shell is the cut's one overlay layer -- or the others
+ * are only LAZY_BESIDE's (the gap marks' windows), whose frame keys are
+ * composed here without drawing a frame (compose-chrome `keysOnly`), so the
+ * chunks' keys are known before any layer is captured -- and the encode is
+ * chunked. Any other layer's frames are in the same chunks' keys and are
+ * captured beside the deck's, so its keys are not known yet: every deck frame
+ * is drawn, as before. `UMTOOL_CHROME_LAZY=0` draws every frame.
+ */
+export function deckWant({ schedule, render, outDir, segments, joins = null, hardCut, env = process.env, manifestPath = null, variant = "sourced" }) {
if (env.UMTOOL_CHROME_LAZY === "0" || !chunkedEncodeOn(render, env)) return null;
const on = deckOverlays().filter((m) => m.on(schedule, render));
- if (on.length !== 1 || on[0].region !== "deck" || on[0].kind !== "overlay-whole") return null;
- const regions = on[0].regions(schedule, { render, outDir });
+ const shell = on.filter((m) => m.region === "deck");
+ const beside = on.filter((m) => m.region !== "deck");
+ if (shell.length !== 1 || shell[0].kind !== "overlay-whole") return null;
+ if (beside.length && (!manifestPath || beside.some((m) => !LAZY_BESIDE.has(m.region) || m.kind !== "overlay-window"))) return null;
+ const regions = shell[0].regions(schedule, { render, outDir });
const framesDir = regions[0].frames;
- return (fk) => framesNeeded({ framesDir, fk, segments, render, chrome: { regions, outLabel: "[hfout]" }, joins, workDir: outDir, hardCut });
+ // The layers in the order the build lays them (renderDeck: z order, each window its own), and what they leave out.
+ const windows = beside.flatMap((m) => m.regions(schedule, { render, outDir }));
+ const blackouts = chromeBlackouts(schedule);
+ const chrome = { regions: [...regions, ...windows.map(({ window: _w, ...r }) => r)], outLabel: "[hfout]", ...(blackouts.length ? { blackouts } : {}) };
+ const own = verticalOn(render) ? { render } : {};
+ return async (fk) => {
+ const keys = new Map([[framesDir, fk]]);
+ for (const pr of windows) {
+ const { composeChrome } = await import("./compose-chrome.mjs");
+ const k = await composeChrome({ manifestPath, outDir, variant, region: pr.name, window: pr.window, keysOnly: true, fps: render.fps, ...own });
+ // A page the model cannot key: its frames' bytes are not known before they are drawn -- every deck frame.
+ if (!k.fk || k.target !== pr.frames) return null;
+ keys.set(pr.frames, k.fk);
+ }
+ return framesNeeded({ framesDir, frameKeys: keys, segments, render, chrome, joins, workDir: outDir, hardCut });
+ };
}
+/** The layers beside the deck's shell whose frame keys deckWant composes without drawing: the gap marks' windows. */
+export const LAZY_BESIDE = new Set(["gap-cue"]);
+
/**
* The frames of chrome sequence `framesDir` the chunks to encode read
* (0-based), when its frame keys are `fk`: what a build asks the capture to
* draw (compose-chrome `want`). Every other frame is in a chunk on disk.
*/
-export async function framesNeeded({ framesDir, fk, ...job }) {
- const { todo, plan } = await planChunks({ ...job, frameKeys: new Map([[framesDir, fk]]), quiet: true });
+export async function framesNeeded({ framesDir, fk = null, frameKeys = null, ...job }) {
+ const keys = frameKeys ?? new Map([[framesDir, fk]]);
+ fk = keys.get(framesDir);
+ const { todo, plan } = await planChunks({ ...job, frameKeys: keys, quiet: true });
const need = new Set();
for (const p of todo) {
for (const inp of p.inputs) {
@@ -7787,10 +7835,11 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
// Under a deck the gap mark is the gap-cue module's (chrome): this pass draws it. A segment built with its
// marks drawn INTO it (`--no-chrome`, or a build before the module drew them) keeps them, and the chrome
// leaves that clip's out (gap-cue-slice.mjs inSegment: never both on one frame) -- said, never silently.
+ // A segment cut before its clip had gaps plays them: the record decides, so no mark is drawn at a join the
+ // picture does not have -- said too.
present.forEach((i, k) => {
- const e = entries[i];
- if (e?.type !== "clip" || !Array.isArray(records[k]?.gapMarks) || !records[k].gapMarks.length) return;
- EMIT("note", { message: `${e.id}: its gap marks are drawn into its segment (built without the chrome drawing them) — ${what} leaves the chrome's out for it; build without ${what} (or --only ${e.id}) to have the chrome draw them` });
+ const note = segmentGapNote({ entry: entries[i], record: records[k], render, what });
+ if (note) EMIT("note", { message: note });
});
}
for (const i of missing) {
@@ -7849,7 +7898,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
}
const plan = await renderDeck({
- manifestPath, render, outDir, variant, schedule, drawOnly: deckWant({ schedule, render, outDir, segments: segs, joins, hardCut: D === 0 }),
+ manifestPath, render, outDir, variant, schedule, drawOnly: deckWant({ schedule, render, outDir, segments: segs, joins, hardCut: D === 0, manifestPath, variant }),
});
EMIT("chrome", { phase: "overlay" });
EMIT("concat", { mode: D === 0 ? "hardcut" : "xfade", n: segs.length });
@@ -8001,7 +8050,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
// the deck's framing and leaves the panel off -- a fast look at the picture.
if (deck && !opts.noChrome) {
// Lazily (deckWant) when the cut's chunked encode is the deck's only reader.
- const want = !railPlan && (D === 0 || chunkedEncodeOn(render)) ? deckWant({ schedule, render, outDir, segments, joins, hardCut: D === 0 }) : null;
+ const want = !railPlan && (D === 0 || chunkedEncodeOn(render)) ? deckWant({ schedule, render, outDir, segments, joins, hardCut: D === 0, manifestPath, variant }) : null;
chromePlan = await renderDeck({ manifestPath, render, outDir, variant, schedule, drawOnly: want });
EMIT("chrome", { phase: "overlay" });
}
diff --git a/umtool/report-to-video/chrome-cues.mjs b/umtool/report-to-video/chrome-cues.mjs
@@ -95,7 +95,12 @@ function fontFaces(fonts) {
* @param {{ id: string, W: number, H: number, fps: number, fonts?: {regular?: string, bold?: string},
* gsapSrc?: string, css: string, body: string, init: object, cues: object[],
* whole?: { total: number, from?: number, duration?: number | null, ids?: string[] },
- * window?: { from: number, dur: number }, primeWindow?: boolean }} p
+ * window?: { from: number, dur: number }, primeWindow?: boolean, fit?: { loads: string[], run: string } }} p
+ *
+ * `fit` (opt-in, the gap mark's): `{ loads, run }` -- once the faces in
+ * `loads` (FontFace load strings, "26px DeckSans") are in, `run` (script) runs
+ * before the page says it is fitted: what a page measures in its own faces.
+ * Without it the page is what it always was.
*
* `primeWindow` (opt-in, the measure extras'): a WINDOW of a whole page is
* rendered once at its end and back at its start before anything seeks it. A
@@ -184,7 +189,12 @@ export function cuePageHtml(p) {
window.__timelines = window.__timelines || {};
window.__timelines["${id}"] = tl;
- const ready = document.fonts.ready.catch(() => {}).then(() => { document.documentElement.dataset.fit = "1"; });
+ const ready = ${p.fit
+ ? `Promise.all([${p.fit.loads.map((f) => `document.fonts.load(${JSON.stringify(f)})`).join(", ")}]).catch(() => {}).then(() => {
+ ${p.fit.run.replace(/\n/g, "\n ")}
+ document.documentElement.dataset.fit = "1";
+ });`
+ : `document.fonts.ready.catch(() => {}).then(() => { document.documentElement.dataset.fit = "1"; });`}
const params = new URLSearchParams(location.search);
const still = params.get("still");
if (still !== null) {
diff --git a/umtool/report-to-video/chrome-deck.mjs b/umtool/report-to-video/chrome-deck.mjs
@@ -737,6 +737,40 @@ ${calls.map(([sel, mode, name]) => ` const ${name} = (root) => (root || doc
}
/**
+ * The untitled arrangement's rows (deckLayout's text `t`): the source line promoted into the title's band a size
+ * up (`uSub*`), and in a two-line deck the head over the meta line, centred on the same block (`u2*`; `u2Y` 0 in a
+ * one-line deck). The page's CSS and the gap mark's deck place (gap-cue-slice.mjs) both read these.
+ */
+export function untitledRows(t) {
+ const uSubSize = Math.round(t.subtitleSize * 1.35);
+ const uSubBox = Math.round(uSubSize * 1.3);
+ const uSubY = Math.round(t.titleY + (t.subtitleY + t.subtitleBox - t.titleY - uSubBox - 14) / 2);
+ const u2HeadBox = Math.round(uSubSize * 1.25);
+ const u2Block = u2HeadBox + t.subtitleBox;
+ const u2Y = t.lines === 2 ? Math.round(t.titleY + (t.subtitleY + (t.headBox ?? 0) + t.subtitleBox - t.titleY - u2Block - 14) / 2) : 0;
+ return { uSubSize, uSubBox, uSubY, u2HeadBox, u2Block, u2Y };
+}
+
+/**
+ * The row a segment's SOURCE LINE stands on in the deck's band (band px, deckLayout's text `t`) and what it says --
+ * the rules the page's CSS lays it by: titled, under the title (in a two-line deck the meta line, under the head);
+ * untitled, promoted into the title's band (a size up when it is one line). Two lines only where the schedule gave
+ * the segment two (an entry's own one-line subtitle stays one line in a two-line deck).
+ *
+ * @returns {{ y: number, size: number, box: number, text: string, parts: unknown, two: boolean }}
+ */
+export function sourceLineRow(t, s) {
+ const two = t.lines === 2 && Array.isArray(s?.subtitleLines) && s.subtitleLines.length === 2;
+ const u = untitledRows(t);
+ const untitled = !s?.title;
+ const lp = two && Array.isArray(s.subtitleLinesParts) && s.subtitleLinesParts.length === 2 ? s.subtitleLinesParts[1] : null;
+ const said = two ? { text: String(s.subtitleLines[1] ?? ""), parts: lp } : { text: String(s?.subtitle ?? ""), parts: s?.subtitleParts ?? null };
+ if (untitled && two) return { y: u.u2Y + u.u2HeadBox, size: t.subtitleSize, box: t.subtitleBox, two, ...said };
+ if (untitled) return { y: u.uSubY, size: u.uSubSize, box: u.uSubBox, two, ...said };
+ return { y: t.subtitleY + (two ? t.headBox ?? 0 : 0), size: t.subtitleSize, box: t.subtitleBox, two, ...said };
+}
+
+/**
* The deck composition's HTML.
*
* `fonts` = `{ regular, bold }` asset-relative paths (DeckSans / DeckSansBold),
@@ -780,9 +814,7 @@ export function deckHtml(schedule, render, opts = {}) {
const top = panel ? mix(pal.bg, pal.fg, 0.095) : pal.bg;
const bottom = panel ? mix(pal.bg, pal.fg, 0.04) : pal.bg;
// The untitled arrangement, centred on the same block.
- const uSubSize = Math.round(t.subtitleSize * 1.35);
- const uSubBox = Math.round(uSubSize * 1.3);
- const uSubY = Math.round(t.titleY + (t.subtitleY + t.subtitleBox - t.titleY - uSubBox - 14) / 2);
+ const { uSubSize, uSubBox, uSubY, u2HeadBox, u2Block, u2Y } = untitledRows(t);
const uRuleY = uSubY + uSubBox + 6;
// A two-line subtitle (`subtitle.lines: 2`, deckLayout's `lines`): the head
// line (the source's title) a size up and brighter over the source line.
@@ -791,9 +823,6 @@ export function deckHtml(schedule, render, opts = {}) {
const two = t.lines === 2;
// A line carries the source status: only then does the page add its rule and its fit.
const hs = scheduleHasStatus(schedule);
- const u2HeadBox = Math.round(uSubSize * 1.25);
- const u2Block = u2HeadBox + t.subtitleBox;
- const u2Y = two ? Math.round(t.titleY + (t.subtitleY + (t.headBox ?? 0) + t.subtitleBox - t.titleY - u2Block - 14) / 2) : 0;
const plateX = qr ? qr.x - 46 : W;
const ink = panel ? mix(pal.bg, pal.fg, 0.085) : pal.bg; // what the marker's ring cuts back to
// In sections (`pip.color: "section"`): each section's colour fitted to the
diff --git a/umtool/report-to-video/chrome-gap-cue.mjs b/umtool/report-to-video/chrome-gap-cue.mjs
@@ -14,10 +14,16 @@
// PURE: a schedule and a render in, the page's HTML out.
import { GAP_CUE_MOTION, gapCueCss } from "yt-dlp-transcript-common/lib/report/gapCue.mjs";
import { compileCues, cuePageHtml, esc, r4 } from "./chrome-cues.mjs";
+import { subtitleMarkup } from "./chrome-deck.mjs";
import { GAP_CUE_DECK_LINE } from "./gap-cue-slice.mjs";
-/** A mark's id (`<clip>.g<k>`): what its window, its project and its frames are named by. */
-export const GAP_CUE_ID_RE = /^[A-Za-z0-9_-]+\.g\d+$/;
+/**
+ * A mark's id (`<clip>.g<k>`): what its window, its project and its frames are named by. A clip id takes what the
+ * chapter's segment ids take (`.` and `:` too); never a `/`, `\`, NUL or space, and always after the `gap-cue-`
+ * prefix, so it names one directory entry. Play's route is stricter than this (serve.mjs layerPreviewOf): it also
+ * refuses `.` and `..`, and the `<clip>` must be one of the cut's entries.
+ */
+export const GAP_CUE_ID_RE = /^[A-Za-z0-9_.:-]+\.g\d+$/;
/** The schedule's marks, each a window `{ segment: <its id>, from, to, mark }` on the cut's clock. */
export function gapCueWindows(schedule) {
@@ -26,11 +32,31 @@ export function gapCueWindows(schedule) {
.map((m) => ({ segment: m.id, from: m.at, to: m.until, mark: m }));
}
+/** Where a placed mark stands, as CSS (`left`/`right`, `top`/`bottom`: the edges it is placed against). */
+function placeAt(m, W, H) {
+ const right = m.place === "deck" || String(m.corner ?? "").endsWith("r");
+ const bottom = m.place !== "deck" && String(m.corner ?? "").startsWith("b");
+ const r = m.rect;
+ return [
+ right ? `left: auto; right: ${W - (r.x + r.w)}px;` : `left: ${r.x}px; right: auto;`,
+ bottom ? `top: auto; bottom: ${H - (r.y + r.h)}px;` : `top: ${r.y}px; bottom: auto;`,
+ `max-width: ${Math.max(Number(m.room) || r.w, 1)}px;`,
+ ].join(" ");
+}
+
+/** A script string's literal (no `</script>` can close the page's script early). */
+const lit = (v) => JSON.stringify(v).replace(/</g, "\\u003c");
+
/**
* One mark's page: the whole frame, transparent, the mark at its rect -- its right edge kept at the rect's when it
* stands at a right corner or in the deck, its bottom at the rect's at a bottom corner (the face's real width is the
* text's own, so the mark hugs the edges it is placed against) -- never wider than its `room` (cut "…" past it).
*
+ * IN THE DECK the page never trusts the slice's reckoning alone: it lays a copy of the source line (the deck's own
+ * markup, faces, size and letter-spacing; never shown) on the line's row, and once its faces are in, if the line's
+ * end and the air after it reach the mark's left edge, the mark stands at its `alt` place over the footage instead
+ * (`data-fell="line"`) -- so a mark is never drawn on the line's words, whatever face the brand gives it.
+ *
* @param {Record<string, any>} schedule
* @param {Record<string, any>} render
* @param {{ segment: string, from: number, to: number }} window the snapped window
@@ -50,23 +76,50 @@ export function gapCueHtml(schedule, render, window, opts = {}) {
// On the window's clock: the mark's own seconds inside the snapped window.
const a = r4(m.at);
const b = r4(m.until);
+ // A mark shorter than its ramps (cut short before a dissolve) rises only as far as the drawtext's alpha does
+ // (common gapCueAlpha): to where its in and out ramps meet, never a flash to the peak.
const len = Math.max(0, b - a);
- const inDur = Math.min(M.in, len / 2);
- const outDur = Math.min(M.out, len / 2);
+ const short = len < M.in + M.out;
+ const inDur = short ? r4((len * M.in) / (M.in + M.out)) : M.in;
+ const outDur = short ? r4(len - inDur) : M.out;
+ const peak = short ? r4((M.peak * len) / (M.in + M.out)) : M.peak;
const { init, cues } = compileCues({ gm: { autoAlpha: 0 } }, [
- { k: "gm", at: a, dur: inDur, to: { autoAlpha: M.peak }, ease: "none" },
- { k: "gm", at: b - outDur, dur: outDur, to: { autoAlpha: 0 }, ease: "none" },
+ { k: "gm", at: a, dur: inDur, to: { autoAlpha: peak }, ease: "none" },
+ { k: "gm", at: r4(b - outDur), dur: outDur, to: { autoAlpha: 0 }, ease: "none" },
]);
- const right = m.place === "deck" || String(m.corner ?? "").endsWith("r");
- const bottom = m.place !== "deck" && String(m.corner ?? "").startsWith("b");
- const r = m.rect;
- const at = [
- right ? `right: ${W - (r.x + r.w)}px;` : `left: ${r.x}px;`,
- bottom ? `bottom: ${H - (r.y + r.h)}px;` : `top: ${r.y}px;`,
- ].join(" ");
+ const look = opts.look ? { look: opts.look } : {};
const line = m.place === "deck" ? GAP_CUE_DECK_LINE : 1.2;
- const css = `${gapCueCss(".gm", { font: m.font, stroke: m.stroke, lineHeight: line, ...(opts.look ? { look: opts.look } : {}) })}
- .gm { visibility: hidden; opacity: 0; ${at} max-width: ${Math.max(Number(m.room) || r.w, 1)}px; }`;
- const body = `<div class="gm" data-k="gm" data-gm="${esc(m.text)}" data-place="${esc(m.place)}">${esc(m.text)}</div>`;
- return cuePageHtml({ id: "gap-cue", W, H, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css, body, init, cues, window: { from, dur } });
+ const guard = m.place === "deck" && m.line && m.alt ? m : null;
+ let css = `${gapCueCss(".gm", { font: m.font, stroke: m.stroke, lineHeight: line, ...look })}
+ .gm { visibility: hidden; opacity: 0; ${placeAt(m, W, H)} }`;
+ let body = `<div class="gm" data-k="gm" data-gm="${esc(m.text)}" data-place="${esc(m.place)}">${esc(m.text)}</div>`;
+ let fit;
+ if (guard) {
+ const L = guard.line;
+ // The fallback: the mark's own place over the footage, its look at that size (it overrides every edge).
+ css += `
+ ${gapCueCss(".gm.fell", { font: guard.alt.font, stroke: guard.alt.stroke, lineHeight: 1.2, ...look })}
+ .gm.fell { ${placeAt(guard.alt, W, H)} }
+ /* The source line as the deck draws it (chrome-deck.mjs .deck-sub), never shown: what the mark keeps clear of. */
+ .gm-line { position: absolute; left: ${L.x}px; top: ${L.y}px; display: flex; white-space: nowrap; visibility: hidden;
+ font-size: ${L.size}px; letter-spacing: 0.005em; }
+ .gm-line .part, .gm-line .sep { flex: none; }
+ .gm-line .sep { padding: 0 0.42em; font-family: 'DeckSansBold', sans-serif; }`;
+ body += `\n <div class="gm-line" aria-hidden="true">${subtitleMarkup(L.text, L.parts)}</div>`;
+ fit = {
+ loads: [`${L.size}px DeckSans`, `${L.size}px DeckSansBold`, `${m.font}px DeckSansBold`],
+ run: `// The mark never touches the source line: measured in the faces the deck draws it in.
+(function () {
+ const gm = document.querySelector(".gm");
+ const ln = document.querySelector(".gm-line");
+ if (!gm || !ln || ln.getBoundingClientRect().right + ${Number(L.air) || 0} <= gm.getBoundingClientRect().left) return;
+ gm.classList.add("fell");
+ gm.textContent = ${lit(guard.alt.text)};
+ gm.dataset.gm = ${lit(guard.alt.text)};
+ gm.dataset.place = "footage";
+ gm.dataset.fell = "line";
+})();`,
+ };
+ }
+ return cuePageHtml({ id: "gap-cue", W, H, fps, fonts: opts.fonts, gsapSrc: opts.gsap, css, body, init, cues, window: { from, dur }, ...(fit ? { fit } : {}) });
}
diff --git a/umtool/report-to-video/compose-chrome.mjs b/umtool/report-to-video/compose-chrome.mjs
@@ -994,7 +994,7 @@ export async function composeChrome({
schedule = null, preview = false, doRender = false,
fps = null, workers = null, quality = "high", format = "png-sequence",
still = null, png = null, from = 0, duration = null, window = null, segment = null, transition = null,
- lease = null, want = null, render: renderOverride = null, context = null,
+ lease = null, want = null, render: renderOverride = null, context = null, keysOnly = false,
}) {
// The variant's view, and its own out directory. Handed the whole manifest
// the band would draw claims this cut never makes, and the deck would name
@@ -1053,7 +1053,9 @@ export async function composeChrome({
const names = mod.names
? mod.names({ preview, window: win, entry: teaser, suffix })
: { project: wholeCut && preview ? `${region}-preview` : `${region}${suffix}`, stem: `${region}${suffix}` };
- const projDir = path.join(base, "chrome", names.project);
+ // `keysOnly` (build-video.mjs deckWant): the page composed in a scratch project of its own -- never the one its
+ // render may be drawing in at the same moment -- for its frame keys alone, then removed.
+ const projDir = path.join(base, "chrome", keysOnly ? `${names.project}.keys` : names.project);
const assetsDir = path.join(projDir, "assets");
// The deck's assets are rebuilt every time: a QR from a clip that has since
// left the cut must not sit in the directory the cache key hashes.
@@ -1086,6 +1088,20 @@ export async function composeChrome({
}
const result = { projDir, frames: null, still: null, cached: false, key, frameCount: frames, ...(win ? { window: win } : {}) };
+ // Its frame keys and where its frames go, nothing drawn (the same model as a render's, below).
+ if (keysOnly) {
+ let fk = null;
+ if (keyed && (wholeCut || mod.kind === "overlay-window" || mod.kind === "segment") && mod.frameKeys) {
+ try {
+ fk = frameKeys({ html, region, assets, fps: rate, frames, version: hf.version, items: pageItems });
+ } catch {
+ fk = null;
+ }
+ }
+ await rm(projDir, { recursive: true, force: true });
+ return { ...result, projDir: null, fk, target: path.join(base, "chrome", `${names.stem}-frames`) };
+ }
+
// The review still: seek and screenshot, no HyperFrames, ~2 s. It is the SAME
// seek the renderer performs for every frame, which is why a still that is
// right is evidence about the frames and not just about the markup. The
diff --git a/umtool/report-to-video/gap-cue-build.test.mjs b/umtool/report-to-video/gap-cue-build.test.mjs
@@ -0,0 +1,245 @@
+// The gap mark under a deck, built for real (lane gap-cue, slice 1d, review 1d): tiny encodes, the deck's renderer a
+// stub that writes transparent frames and logs how many each render drew. What a chrome-only pass does with the mark:
+//
+// - off (unset or `mark: false`): the schedule the build writes is the same bytes, no `gapCue` key;
+// - on, over an old take: the marks on the schedule from the cut records, no segment rebuilt, and the deck still
+// drawn ONLY where a chunk to encode reads it (deckWant keys the gap-cue windows without drawing them);
+// - a segment that drew its marks itself (`--no-chrome`): the chrome leaves its marks out, and says why, wanted or not;
+// - a segment cut before its clip had gaps: no mark at a join its picture does not have, and a note;
+// - `--clip-preview`: the module's marks, nothing drawn into the segment;
+// - a clip that is not first, after a real crossfade: its mark at that segment's start plus its join.
+//
+// Skipped without ffmpeg/ffprobe. Run with: pnpm test:scripts
+import assert from "node:assert/strict";
+import { spawnSync } from "node:child_process";
+import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, rmSync, writeFileSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import test from "node:test";
+
+// The corpus the build reads metadata and cues from: set before build-video (cues.mjs) is loaded.
+const CORPUS = mkdtempSync(path.join(tmpdir(), "rtv-gapcue-corpus-"));
+process.env.CHANNELS_DIR = CORPUS;
+const { buildVideo, measureChromeSchedule, setProgressMode } = await import("./build-video.mjs");
+const { MONO_BOLD_FONT_FILE, MONO_FONT_FILE } = await import("./brand.mjs");
+const { offsetIn } = await import("./gaps.mjs");
+test.after(() => rmSync(CORPUS, { recursive: true, force: true }));
+
+const have = ["ffmpeg", "ffprobe"].every((b) => spawnSync(b, ["-version"]).status === 0);
+const FPS = 10;
+const PALETTE = { bg: "#12101a", fg: "#f4f1ea", muted: "#9a93ad", accent: "#a97bff", amber: "#ffc860" };
+const RENDER = {
+ width: 640, height: 360, fps: FPS, audioRate: 48000, audioChannels: 2, preset: "ultrafast", transition: 0,
+ headerHeight: 0, footerHeight: 0, qr: false, palette: PALETTE, fontRegular: MONO_FONT_FILE, fontBold: MONO_BOLD_FONT_FILE,
+ fetchPad: 0, snapWindow: 0.05, silenceMinDur: 0.1,
+ chrome: { engine: "hyperframes", layout: "deck", deck: { qr: { show: false }, footageScale: 0.6 } },
+};
+{
+ const dir = path.join(CORPUS, "synth", "data", "vid1");
+ mkdirSync(dir, { recursive: true });
+ writeFileSync(path.join(CORPUS, "synth", "config.json"), JSON.stringify({ name: "Synth" }));
+ writeFileSync(path.join(dir, "transcript.cues.json"), JSON.stringify({ id: "vid1", title: "Synthetic", duration: 12, uploadDate: "20240102", cues: [{ start: 0.2, end: 11.8, text: "words" }] }));
+ writeFileSync(path.join(dir, "metadata.info.json"), JSON.stringify({ id: "vid1", title: "Synthetic", duration: 12, channel: "Synth", upload_date: "20240102" }));
+}
+
+const STUB = `#!/usr/bin/env node
+import { spawnSync } from "node:child_process";
+import { appendFileSync, copyFileSync, mkdirSync, readFileSync } from "node:fs";
+const a = process.argv.slice(2);
+const out = a[a.indexOf("--output") + 1];
+const fps = Number(a[a.indexOf("--fps") + 1]);
+const html = readFileSync(a.at(-1) + "/index.html", "utf8");
+const dur = Number(/data-composition-id="[^"]*"[^>]*data-duration="([\\d.]+)"/.exec(html)[1]);
+const id = /data-composition-id="([^"]*)"/.exec(html)[1];
+const w = Number((/data-width="(\\d+)"/.exec(html) ?? [0, 640])[1]);
+const h = Number((/data-height="(\\d+)"/.exec(html) ?? [0, 360])[1]);
+mkdirSync(out, { recursive: true });
+const one = out + "/.one.png";
+spawnSync("ffmpeg", ["-nostdin", "-v", "error", "-y", "-f", "lavfi", "-i", "color=c=black@0.0:size=" + w + "x" + h + ",format=rgba", "-frames:v", "1", one]);
+const n = Math.round(dur * fps);
+for (let i = 1; i <= n; i += 1) copyFileSync(one, out + "/frame_" + String(i).padStart(6, "0") + ".png");
+appendFileSync(process.env.HF_LOG, id + " " + n + "\\n");
+`;
+
+/** A project: c1 1–4 s and c2 5–11 s of one 12 s window (noise in bursts, never periodic); c2 may carry gaps. */
+function project(t, { c2 = {}, render = {} } = {}) {
+ const root = mkdtempSync(path.join(tmpdir(), "rtv-gapcue-"));
+ const env = { bin: process.env.HYPERFRAMES_BIN, log: process.env.HF_LOG };
+ t.after(() => {
+ for (const [k, v] of [["HYPERFRAMES_BIN", env.bin], ["HF_LOG", env.log]]) {
+ if (v === undefined) delete process.env[k];
+ else process.env[k] = v;
+ }
+ setProgressMode(() => {});
+ rmSync(root, { recursive: true, force: true });
+ });
+ const stub = path.join(root, "hf-stub.mjs");
+ writeFileSync(stub, STUB);
+ chmodSync(stub, 0o755);
+ process.env.HYPERFRAMES_BIN = stub;
+ const log = path.join(root, "renders.log");
+ process.env.HF_LOG = log;
+ mkdirSync(path.join(root, "out", "clips-raw"), { recursive: true });
+ const raw = path.join(root, "out", "clips-raw", "vid1_0.00-12.00.mp4");
+ const r = spawnSync("ffmpeg", [
+ "-v", "error", "-y", "-f", "lavfi", "-i", `testsrc2=s=640x360:r=${FPS}:d=12`,
+ "-f", "lavfi", "-i", "aevalsrc='0.2*(random(0)*2-1)*(0.25+0.75*gt(sin(2*PI*1.3*t+3*sin(2*PI*0.37*t)),0.2))':s=48000:d=12",
+ "-map", "0:v", "-map", "1:a", "-c:v", "libx264", "-preset", "ultrafast", "-c:a", "aac", "-shortest", raw,
+ ]);
+ assert.equal(r.status, 0, String(r.stderr));
+ const manifestPath = path.join(root, "video.manifest.json");
+ const manifest = {
+ slug: "gapcue", title: "Gap cue", provenance: { channelSlug: "synth", channelsDir: CORPUS },
+ render: { ...RENDER, ...render },
+ timeline: [
+ { type: "clip", id: "c1", channel: "synth", video: "vid1", start: 1, end: 4, cite: 1, quote: "q", onscreen: { title: "First" } },
+ { type: "clip", id: "c2", channel: "synth", video: "vid1", start: 5, end: 11, cite: 5, quote: "q", onscreen: { title: "Second" }, ...c2 },
+ ],
+ };
+ const v = path.join(root, "out", "sourced");
+ const notes = [];
+ const events = [];
+ setProgressMode((e) => {
+ events.push(e);
+ if (e.ev === "note") notes.push(e.message);
+ });
+ const p = {
+ root, v, manifestPath, notes, events,
+ write: (fn = null) => {
+ if (fn) fn(manifest);
+ writeFileSync(manifestPath, JSON.stringify(manifest));
+ },
+ build: async (opts = {}) => {
+ notes.length = 0;
+ events.length = 0;
+ const { only = null, ...o } = opts;
+ const res = await buildVideo({ manifestPath, ...(only ? { only } : {}), opts: { noNetwork: true, ...o } });
+ assert.equal(res.failures.length, 0, JSON.stringify(res.failures));
+ return res;
+ },
+ schedule: () => readFileSync(path.join(v, "schedule.json"), "utf8"),
+ record: (id) => JSON.parse(readFileSync(path.join(v, "segments", `${id}.cut.json`), "utf8")),
+ md5: (id) => spawnSync("md5sum", [path.join(v, "segments", `${id}.mp4`)]).stdout.toString().split(" ")[0],
+ drawn: () => (existsSync(log) ? readFileSync(log, "utf8").trim().split("\n").filter(Boolean).map((l) => ({ id: l.split(" ")[0], n: Number(l.split(" ")[1]) })) : []),
+ };
+ p.write();
+ return p;
+}
+const GAP = [{ from: 6.5, to: 9.5 }];
+
+test("--chrome-only, the mark off then on over an old take: the same schedule off; on, the marks from the records, no segment rebuilt, the deck drawn only where a chunk to encode reads it", { skip: !have && "needs ffmpeg" }, async (t) => {
+ const p = project(t, { c2: { gaps: GAP } });
+ await p.build();
+ const off = p.schedule();
+ assert.equal("gapCue" in JSON.parse(off), false, "off: no slice");
+ const seg0 = { c1: p.md5("c1"), c2: p.md5("c2") };
+ // Off said otherwise (`mark: false`): the very bytes, nothing drawn, nothing encoded.
+ p.write((m) => { m.render.gapCue = { mark: false }; });
+ const before = p.drawn().length;
+ await p.build({ chromeOnly: true });
+ assert.equal(p.schedule(), off, "mark false: the schedule the build wrote before, byte for byte");
+ assert.ok(p.notes.some((m) => /^final encode: (\d+)\/\1 chunk\(s\) unchanged/.test(m)), p.notes.join("\n"));
+ assert.equal(p.drawn().length, before, "nothing drawn");
+ // ON, by the switch alone: the retrofit.
+ p.write((m) => { m.render.gapCue = { mark: true }; });
+ await p.build({ chromeOnly: true });
+ const sched = JSON.parse(p.schedule());
+ const rec = p.record("c2");
+ assert.equal(rec.gapMarks, undefined, "the segment draws none");
+ assert.deepEqual({ c1: p.md5("c1"), c2: p.md5("c2") }, seg0, "no segment rebuilt");
+ assert.equal(sched.gapCue.marks.length, 1);
+ const k = sched.gapCue.marks[0];
+ const s2 = sched.segments[1];
+ assert.equal(k.segment, "c2");
+ assert.ok(Math.abs(k.at - (s2.start + offsetIn(6.5, rec.start, rec.gaps))) < 1e-3, `at ${k.at}: c2's start ${s2.start} + its join`);
+ assert.equal(k.text, "» 3 s");
+ // Lazy still (review 1d, 3): the deck's frames drawn only for the chunks the mark's window touches.
+ const read = p.notes.find((m) => /chunk\(s\) to encode read \d+ of \d+ deck-frames frames/.test(m));
+ assert.ok(read, p.notes.join("\n"));
+ const [, todo, chunks, need, frames] = /(\d+) of (\d+) chunk\(s\) to encode read (\d+) of (\d+) deck-frames/.exec(read).map(Number);
+ assert.ok(todo < chunks && need < frames, `only the mark's chunks: ${read}`);
+ const deckDrawn = p.drawn().slice(before).filter((d) => d.id === "deck");
+ assert.ok(deckDrawn.every((d) => d.n <= need), `the deck drew ${deckDrawn.map((d) => d.n)} of ${frames}`);
+ assert.ok(p.drawn().slice(before).some((d) => d.id === "gap-cue"), "the mark's page was drawn");
+ assert.ok(!readdirSync(path.join(p.v, "chrome")).some((f) => f.endsWith(".keys")), "the keys' scratch projects are gone");
+ t.diagnostic(`retrofit cost: ${read}; deck frames drawn ${deckDrawn.map((d) => d.n).join("+") || 0}`);
+ // Again: nothing to encode, and no deck frame drawn (the keys composed without drawing are the ones drawn). The
+ // mark's own few frames were pruned after the mux, as every window module's are: those are captured again.
+ const runs = p.drawn().length;
+ await p.build({ chromeOnly: true });
+ assert.ok(p.notes.some((m) => /^final encode: (\d+)\/\1 chunk\(s\) unchanged/.test(m)), p.notes.join("\n"));
+ assert.ok(p.notes.some((m) => /0 of \d+ chunk\(s\) to encode read 0 of \d+ deck-frames frames/.test(m)), p.notes.join("\n"));
+ assert.deepEqual(p.drawn().slice(runs).filter((d) => d.id === "deck"), [], "no deck frame drawn");
+ // What it cost before (the deck lazy only when it is the one layer): a label change re-encodes the same one chunk,
+ // but every deck frame is drawn.
+ const { LAZY_BESIDE } = await import("./build-video.mjs");
+ LAZY_BESIDE.delete("gap-cue");
+ try {
+ p.write((m) => { m.render.gapCue = { mark: true, label: "{s} later" }; });
+ const at = p.drawn().length;
+ await p.build({ chromeOnly: true });
+ // Every frame asked for (no "only those are drawn" note); the capture still skips frames it can key as the same.
+ assert.ok(!p.notes.some((m) => /deck-frames frames — only those are drawn/.test(m)), p.notes.join("\n"));
+ const all = p.drawn().slice(at).filter((d) => d.id === "deck").reduce((n, d) => n + d.n, 0);
+ const lazy = deckDrawn.reduce((n, d) => n + d.n, 0);
+ assert.ok(all > lazy, `not lazy: ${all} deck frames drawn, lazily ${lazy}`);
+ t.diagnostic(`without the gap-cue keys: all ${frames} deck frames asked for, ${all} drawn (lazily: ${need} asked for, ${lazy} drawn)`);
+ } finally {
+ LAZY_BESIDE.add("gap-cue");
+ }
+});
+
+test("--chrome-only over a segment that drew its own marks (--no-chrome): the chrome leaves its marks out and says so, wanted or not", { skip: !have && "needs ffmpeg" }, async (t) => {
+ const p = project(t, { c2: { gaps: GAP }, render: { gapCue: { mark: true } } });
+ await p.build({ noChrome: true });
+ assert.equal(p.record("c2").gapMarks?.length, 1, "--no-chrome drew it into the segment");
+ await p.build({ chromeOnly: true });
+ assert.deepEqual(JSON.parse(p.schedule()).gapCue, { marks: [], inSegment: ["c2"] });
+ assert.ok(p.notes.includes("c2: its gap marks are drawn in its segment (built with no chrome drawing them) — --chrome-only leaves the chrome's out for it; rebuild it (a build without --chrome-only, or --only c2) to let the chrome draw them"), p.notes.join("\n"));
+ assert.ok(!p.events.some((e) => e.ev === "chrome" && e.region === "gap-cue"), "no gap-cue page");
+ p.write((m) => { m.render.gapCue = { mark: false }; });
+ await p.build({ chromeOnly: true });
+ assert.ok(p.notes.includes("c2: its segment still shows gap marks that are no longer wanted — --chrome-only cannot take them out; rebuild it (a build without --chrome-only, or --only c2)"), p.notes.join("\n"));
+ assert.equal("gapCue" in JSON.parse(p.schedule()), false);
+});
+
+test("--chrome-only over a segment cut before its clip had gaps: no mark at a join the picture does not have, and a note", { skip: !have && "needs ffmpeg" }, async (t) => {
+ const p = project(t);
+ await p.build();
+ assert.equal(p.record("c2").gaps, undefined);
+ p.write((m) => {
+ m.timeline[1].gaps = GAP;
+ m.render.gapCue = { mark: true };
+ });
+ await p.build({ chromeOnly: true });
+ assert.equal("gapCue" in JSON.parse(p.schedule()), false, "no mark");
+ assert.ok(p.notes.includes("c2: its segment was cut before its gaps — the footage plays them and no gap mark is drawn for them; rebuild it (a build without --chrome-only, or --only c2) to cut them"), p.notes.join("\n"));
+});
+
+test("--clip-preview lays the deck over its clip: the module's mark, nothing drawn into the segment", { skip: !have && "needs ffmpeg" }, async (t) => {
+ const p = project(t, { c2: { gaps: GAP }, render: { gapCue: { mark: true } } });
+ await p.build({ clipPreview: "c2" });
+ assert.equal(p.record("c2").gapMarks, undefined);
+ const pv = JSON.parse(readFileSync(path.join(p.v, "clip-preview", "schedule.json"), "utf8"));
+ assert.equal(pv.gapCue.marks.length, 1);
+ assert.equal(pv.gapCue.marks[0].segment, "c2");
+ assert.ok(p.events.some((e) => e.ev === "chrome" && e.region === "gap-cue" && e.phase !== "compose"), "its page drawn");
+});
+
+test("a clip that is not first, after a real crossfade: measureChromeSchedule puts its mark at its segment's start plus its join", { skip: !have && "needs ffmpeg" }, async (t) => {
+ const p = project(t, { c2: { gaps: GAP }, render: { transition: 0.4, gapCue: { mark: true } } });
+ for (const id of ["c1", "c2"]) await p.build({ only: id });
+ const m = JSON.parse(readFileSync(p.manifestPath, "utf8"));
+ const segments = ["c1", "c2"].map((id) => path.join(p.v, "segments", `${id}.mp4`));
+ const sched = await measureChromeSchedule({ manifest: m, entries: m.timeline, segments, D: 0.4 });
+ const [s1, s2] = sched.segments;
+ assert.ok(Math.abs(s2.start - (s1.duration - 0.4)) < 1e-3, `c2 starts in c1's dissolve (${s2.start} vs ${s1.duration} - 0.4)`);
+ const rec = p.record("c2");
+ const k = sched.gapCue.marks[0];
+ assert.ok(Math.abs(k.at - (s2.start + offsetIn(6.5, rec.start, rec.gaps))) < 1e-3, `at ${k.at}`);
+ // The same with the mark off: no key; every other byte of the schedule the same.
+ const off = await measureChromeSchedule({ manifest: { ...m, render: { ...m.render, gapCue: { mark: false } } }, entries: m.timeline, segments, D: 0.4 });
+ const { gapCue: _g, ...rest } = sched;
+ assert.equal("gapCue" in off, false);
+ assert.equal(JSON.stringify(off), JSON.stringify(rest));
+});
diff --git a/umtool/report-to-video/gap-cue-slice.mjs b/umtool/report-to-video/gap-cue-slice.mjs
@@ -9,11 +9,13 @@
// (`start`, `end`, `gaps` -- the recording's seconds, between a clip's pieces
// too), the record the schedule already reads for its gaps. A record written
// before this slice carries all three, so an old take gets its marks from a
-// chrome-only pass: no re-cut. With no record (a preview before any build) the
-// clip's play window and its own gaps stand in. The marks themselves -- the
-// threshold, the merge inside a life, the text -- are gap-mark-place.mjs
-// recordGapMarks, the drawtext path's own rule, then on the cut's clock:
-// `segment.start + at`.
+// chrome-only pass: no re-cut. The record DECIDES: one written with no `gaps`
+// (a segment cut before its clip had them) plays them, so it has no join to
+// mark (the chrome-only pass says so, build-video.mjs segmentGapNote). Only
+// with no record at all (a preview before any build) do the clip's play window
+// and its own gaps stand in. The marks themselves -- the threshold, the merge
+// inside a life, the text -- are gap-mark-place.mjs recordGapMarks, the
+// drawtext path's own rule, then on the cut's clock: `segment.start + at`.
//
// A clip whose record carries `gapMarks` was built with its marks drawn INTO
// its segment (the drawtext path: `--no-chrome`, or a build before this slice):
@@ -25,27 +27,33 @@
// inside the stacked deck's safe area), at its corner -- `auto` the
// deck's bottom left (twocrop: top right) -- hopping to the next free
// corner off a hidden region, a stamp, the posts' column, the chat
-// column and a chapter's cover while one is up (none free: the asked
-// corner).
+// column, a chapter's cover, the stats panel and the effects'
+// screenshots while one is up (none free: the asked corner).
// deck in the band, right-aligned at the end of the source line's row
// (left of the QR's plate and a tally beside it), centred on the row,
// a size under the source line's text. The deck's own page is not
// touched: the source line keeps its words, the status part at its
-// end included. When the line (status and all, at its longest) and the
+// end included. When the line (status and all, at its longest,
+// reckoned in the face the deck sets it in: deckLineWidth) and the
// mark do not both fit the row, the mark is drawn over the footage
// instead (`fell: "row"`); so it is in the stacked vertical deck (its
// band is laid otherwise: `fell: "stacked"`) and over a segment that
-// hides the deck (`fell: "hidden"`).
+// hides the deck (`fell: "hidden"`). The PAGE checks again in its own
+// faces (chrome-gap-cue.mjs: `line`, `alt`), so a reckoning that is
+// short can never put the mark on the line's words.
//
// PURE: a schedule and a render in, the slice out. Byte for byte: no clip
// wanting a mark, no slice (the key absent).
import { GAP_CUE_LOOK, clipGapCueOf, gapCueWanted } from "yt-dlp-transcript-common/lib/report/gapCue.mjs";
+import { sourceLineRow, subtitleTokens } from "./chrome-deck.mjs";
import { censorRegionsOf } from "./clip-censor.mjs";
import { chatGeometry } from "./chrome-chat.mjs";
import { chapterCover, chapterWindows } from "./chrome-story.mjs";
-import { deckGeometry, deckLayout, deckOn, deckScale, overlayBox, playWindow, postsGeometry, stampGeometry } from "./deck.mjs";
+import { deckGeometry, deckLayout, deckOn, deckScale, fxGeometry, overlayBox, playWindow, postsGeometry, stampGeometry, statsGeometry } from "./deck.mjs";
+import { FX_RECEIPTS_MAX } from "./fx.mjs";
import { tallyOf } from "./factcheck.mjs";
import { censorAvoidRects, gapMarkAsked, gapMarkPlaces, gapMarkSize, monoWidth, recordGapMarks, sansWidth, twoCropMarkBox } from "./gap-mark-place.mjs";
+import { recordGaps } from "./gaps.mjs";
import { clipTwoCrop, stackedGeometry, stackedOn } from "./vertical-deck.mjs";
const r4 = (v) => Math.round(v * 10000) / 10000;
@@ -59,17 +67,28 @@ const fin = (v) => typeof v === "number" && Number.isFinite(v);
*/
export const deckFaceWidth = (text, fontSize) => Math.max(sansWidth(text, fontSize), monoWidth(text, fontSize));
+/** The shortest a mark is drawn for, seconds (its join too near the dissolve out of its segment: none). */
+export const GAP_CUE_MIN_UP = 0.2;
+
/** The deck place's text against the source line's: a size under it (its box then sits inside the row and the air round it). */
export const GAP_CUE_DECK_FONT = 0.9;
/** The deck place's line box, in ems: the row is short, so the box is the text's own height. */
export const GAP_CUE_DECK_LINE = 1;
/**
- * The basis a clip's marks are taken from: its cut record when it has one (`start`, `end`, `gaps`), else its
- * play window and its own gaps inside it (an estimate, as a preview's segments are).
+ * The basis a clip's marks are taken from. Its cut record DECIDES when it has one: the seconds it starts and ends at
+ * and the gaps it really left out (`gaps` absent = none: a segment cut before its gaps plays them, so it has no
+ * joins to mark -- null when the record cannot say where the segment starts). Only with no record at all (a
+ * preview before any build) do its play window and its own gaps inside it stand in, an estimate as a preview's
+ * segments are.
+ *
+ * @returns {{ start: number, end: number, gaps: Array<{ from: number, to: number }> } | null}
*/
-function basisOf(entry, render, rec) {
- if (rec && fin(Number(rec.start)) && fin(Number(rec.end)) && Array.isArray(rec.gaps)) return rec;
+export function basisOf(entry, render, rec) {
+ if (rec) {
+ if (!fin(Number(rec.start)) || !fin(Number(rec.end))) return null;
+ return { ...rec, gaps: recordGaps(rec) };
+ }
const pw = playWindow(entry, render);
const gaps = (Array.isArray(entry.gaps) ? entry.gaps : [])
.filter((g) => fin(g?.from) && fin(g?.to) && g.to > pw.from && g.from < pw.to)
@@ -78,11 +97,38 @@ function basisOf(entry, render, rec) {
return { start: pw.from, end: pw.to, gaps };
}
+/** The air a deck-placed mark keeps after the source line's end, band px at 1080 (deckScale). */
+export const GAP_CUE_DECK_AIR = 24;
+
+/** Is the deck's regular face the brand's IBM Plex Mono (brand.mjs resolveBrandRender)? Read by its file's name. */
+const monoDeck = (render) => /IBMPlexMono-Regular\.[ot]tf$/i.test(String(render?.fontRegular ?? ""));
+
+/**
+ * How wide a source line draws, px, reckoned WIDE: its parts in the face the page sets them in (the brand's Plex
+ * Mono when `render.fontRegular` is it; else the wider of a sans's advances and a mono's, whatever face it is),
+ * each separator its bold dot and the 0.42 em of padding either side of it (chrome-deck.mjs `.deck-sub .sep`), and
+ * the line's 0.005 em letter-spacing on every character, each glyph's advance rounded up to a whole pixel. The page measures the line itself too, once its faces
+ * are in (chrome-gap-cue.mjs): this only decides where the mark is laid, never alone that it is clear of the text.
+ */
+export function deckLineWidth({ text, parts = null, size, render }) {
+ const said = subtitleTokens(text, parts)?.map((p) => p[1]) ?? String(text ?? "").split(" · ");
+ const mono = monoDeck(render);
+ // Per glyph, rounded up: the render browser lays a hinted face's advances on whole pixels (Plex Mono at 26 px
+ // draws 16 px a glyph, not 15.6).
+ const glyph = (ch) => (mono ? monoWidth(ch, size) : Math.max(sansWidth(ch, size), monoWidth(ch, size)));
+ const face = (v) => [...v].reduce((n, ch) => n + glyph(ch), 0);
+ const seps = Math.max(0, said.length - 1);
+ const chars = said.reduce((n, v) => n + [...v].length, 0) + seps;
+ return Math.ceil(said.reduce((n, v) => n + face(v), 0) + seps * (monoWidth("·", size) + 0.84 * size) + 0.005 * size * chars);
+}
+
/**
* The deck place's rect for one mark's text, frame px, or why it cannot stand there (`fell`): right-aligned at the
- * source line row's end, centred on the row.
+ * source line row's end, centred on the row (chrome-deck.mjs sourceLineRow: the rows the page lays the line on).
+ * `line` is what the page measures before it shows the mark: the line's row, its words and its size.
*
- * @returns {{ rect: { x: number, y: number, w: number, h: number }, font: number, stroke: number, room: number } | { fell: string }}
+ * @returns {{ rect: { x: number, y: number, w: number, h: number }, font: number, stroke: number, room: number,
+ * line: { x: number, y: number, size: number, air: number, text: string, parts: unknown } } | { fell: string }}
*/
export function gapCueDeckRect({ render, schedule, segment, text }) {
if (stackedOn(render)) return { fell: "stacked" };
@@ -92,37 +138,33 @@ export function gapCueDeckRect({ render, schedule, segment, text }) {
const t = lay.text;
const k = deckScale(render);
const z = (v) => (k === 1 ? v : Math.round(v * k));
- const untitled = !segment.title;
- const two = t.lines === 2;
- // The source line's row: under the title (its meta line in two lines); untitled, promoted into the title's band
- // a size up (chrome-deck.mjs's untitled arrangement).
- const uSize = Math.round(t.subtitleSize * 1.35);
- const uBox = Math.round(uSize * 1.3);
- const rowSize = untitled && !two ? uSize : t.subtitleSize;
- const rowBox = untitled && !two ? uBox : t.subtitleBox;
- const rowY = untitled && !two
- ? Math.round(t.titleY + (t.subtitleY + t.subtitleBox - t.titleY - uBox - 14) / 2)
- : t.subtitleY + (two ? t.headBox ?? 0 : 0);
- const font = Math.max(12, Math.round(rowSize * GAP_CUE_DECK_FONT));
+ const row = sourceLineRow(t, segment);
+ const font = Math.max(12, Math.round(row.size * GAP_CUE_DECK_FONT));
const stroke = Math.max(GAP_CUE_LOOK.strokeMin, Math.round(Math.min(render.width ?? 1920, render.height ?? 1080) * GAP_CUE_LOOK.stroke));
const edge = Math.round(font * GAP_CUE_LOOK.pad) + stroke;
const w = deckFaceWidth(text, font) + 2 * edge;
const h = Math.ceil(font * GAP_CUE_DECK_LINE) + 2 * edge;
const right = t.x + t.width - z(22);
+ const air = z(GAP_CUE_DECK_AIR);
// The source line as it would draw at its longest (its status at its longest too), and air before the mark.
- const lineText = two && Array.isArray(segment.subtitleLines) ? String(segment.subtitleLines.at(-1) ?? "") : String(segment.subtitle ?? "");
- const lineW = sansWidth(lineText, rowSize);
- if (t.x + lineW + z(24) > right - w) return { fell: "row" };
- // Its room: from the line's end (and the air after it) to the row's.
- return { rect: { x: band.x + right - w, y: band.y + rowY + Math.round((rowBox - h) / 2), w, h }, font, stroke, room: right - (t.x + lineW + z(24)) };
+ const lineW = deckLineWidth({ text: row.text, parts: row.parts, size: row.size, render });
+ if (t.x + lineW + air > right - w) return { fell: "row" };
+ return {
+ rect: { x: band.x + right - w, y: band.y + row.y + Math.round((row.box - h) / 2), w, h },
+ font, stroke,
+ // Its room: from the line's end (and the air after it) to the row's.
+ room: right - (t.x + lineW + air),
+ line: { x: band.x + t.x, y: band.y + row.y, size: row.size, air, text: row.text, parts: row.parts ?? null },
+ };
}
/**
* What stands over the footage that a mark keeps off, frame px, each over its cut seconds (`from`–`to`): the
* stamps while each is up, the posts' column while a clip's cards are, the chat column while a clip shows chat,
- * a chapter's cover while its bumper is up.
+ * a chapter's cover while its bumper is up, the stats panel while a clip shows its stats, the effects' screenshots
+ * (the receipts, the zoom) while each is up.
*/
-function moduleAvoids(schedule, render) {
+export function moduleAvoids(schedule, render) {
const feed = schedule.layout === "feed";
const out = [];
const stamps = schedule.factcheck?.stamps ?? [];
@@ -141,6 +183,39 @@ function moduleAvoids(schedule, render) {
const g = rectOf(chapterCover(render, { feed }));
for (const w of chapterWindows(schedule, render)) out.push({ ...g, from: w.from, to: w.to });
}
+ // The stats panel while a clip that declares stats shows it.
+ if ((schedule.stats?.clips ?? []).length) {
+ const g = rectOf(statsGeometry(render, { feed }));
+ for (const c of schedule.stats.clips) if (fin(c.in) && fin(c.out)) out.push({ ...g, from: c.in, to: c.out });
+ }
+ out.push(...fxShotAvoids(schedule, render, feed));
+ return out;
+}
+
+/**
+ * Where the effects' screenshots stand while each is up (chrome-fx.mjs fxPlan), reckoned at their largest -- the
+ * page sizes a card to its shot, which the schedule does not know: the receipts' fan, a column on their side of the
+ * footage box as wide as `receipts.width` plus the fan's spread and inset, the whole box tall; the zoom's card, centred,
+ * `zoom.width` of the box wide and 84 % of it tall.
+ */
+function fxShotAvoids(schedule, render, feed) {
+ const fx = schedule.fx;
+ if (!fx) return [];
+ const geo = rectOf(fxGeometry(render, { feed }));
+ const px = (v) => Math.max(1, Math.round(v * (geo.w / 1574)));
+ const out = [];
+ if (fx.receipts?.clips?.length) {
+ const right = fx.receipts.position !== "left";
+ const w = Math.min(geo.w, Math.ceil((fx.receipts.width ?? 0.36) * geo.w) + px(48) + (FX_RECEIPTS_MAX - 1) * px(22) + px(8));
+ const rect = { x: right ? geo.x + geo.w - w : geo.x, y: geo.y, w, h: geo.h };
+ for (const r of fx.receipts.clips) if (fin(r.in) && fin(r.out)) out.push({ ...rect, from: r.in, to: r.out });
+ }
+ if (fx.zoom?.clips?.length) {
+ const w = Math.min(geo.w, Math.ceil((fx.zoom.width ?? 0.6) * geo.w) + 2 * px(8));
+ const h = Math.min(geo.h, Math.ceil(geo.h * 0.84) + px(36) + 2 * px(8));
+ const rect = { x: geo.x + Math.floor((geo.w - w) / 2), y: geo.y + Math.floor((geo.h - h) / 2), w, h };
+ for (const z of fx.zoom.clips) if (fin(z.in) && fin(z.out)) out.push({ ...rect, from: z.in, to: z.out });
+ }
return out;
}
@@ -158,6 +233,8 @@ export function gapCueSlice(schedule, { entries, render, records = null, provena
const wanted = entries.filter((e) => e?.type === "clip" && Array.isArray(e.gaps) && e.gaps.length && gapCueWanted(render, e));
if (!wanted.length) return null;
const segs = new Map((schedule.segments ?? []).map((s) => [s.id, s]));
+ const lastSeg = (schedule.segments ?? []).at(-1) ?? null;
+ const D = Number(schedule.transition) > 0 ? Number(schedule.transition) : 0;
const W = render.width ?? 1920;
const H = render.height ?? 1080;
const size = gapMarkSize(W, H);
@@ -174,6 +251,7 @@ export function gapCueSlice(schedule, { entries, render, records = null, provena
continue;
}
const basis = basisOf(e, render, rec);
+ if (!basis) continue;
const own = recordGapMarks({ render, entry: e, record: basis });
if (!own.length) continue;
const cue = clipGapCueOf(render, e);
@@ -188,7 +266,14 @@ export function gapCueSlice(schedule, { entries, render, records = null, provena
: censorAvoidRects(censorRegionsOf(e, render, provenance), {
sw: 1, sh: 1, dest: base, from: Number(basis.start), gaps: basis.gaps, seconds: segSeconds,
}).map((a) => ({ ...a, from: a.from == null ? null : seg.start + a.from, to: a.to == null ? null : seg.start + a.to }));
- const onCut = own.map((m) => ({ ...m, at: r4(seg.start + m.at), until: r4(seg.start + m.until) }));
+ // On the cut's clock, and gone before the dissolve into the next segment begins (its picture is the next
+ // clip's by then): a mark that would run on into it ends there, fading out by then. One left shorter than
+ // GAP_CUE_MIN_UP is not drawn.
+ const outAt = segs.size && seg !== lastSeg ? seg.end - D : seg.end;
+ const onCut = own
+ .map((m) => ({ ...m, at: r4(seg.start + m.at), until: r4(Math.min(seg.start + m.until, outAt)) }))
+ .filter((m) => m.until - m.at >= GAP_CUE_MIN_UP);
+ if (!onCut.length) continue;
const places = gapMarkPlaces({ marks: onCut, box: base, want: cue.corner, prefer: fb.prefer, size, avoid: [...censor, ...avoids], measure: deckFaceWidth });
// Over the footage, a mark's room is its box less the insets.
const room = base.w - 2 * size.inset;
@@ -197,18 +282,20 @@ export function gapCueSlice(schedule, { entries, render, records = null, provena
const common = {
id: `${e.id}.g${k}`, segment: e.id, at: m.at, until: m.until, seconds: m.seconds, ...(m.count > 1 ? { count: m.count } : {}),
};
+ const p = places[k];
+ const footage = { text: p.text, place: "footage", corner: p.corner, ...(asked ? { asked } : {}), rect: p.rect, room, font: p.size.fontSize, stroke: p.size.stroke };
if (cue.place === "deck") {
const d = gapCueDeckRect({ render, schedule, segment: seg, text: m.text });
if ("rect" in d) {
- marks.push({ ...common, text: m.text, place: "deck", rect: d.rect, room: d.room, font: d.font, stroke: d.stroke });
+ // `line`: what the page measures in its own faces before it shows the mark; `alt`: where it stands
+ // instead when the line and the mark would touch (chrome-gap-cue.mjs) -- never on the text.
+ marks.push({ ...common, text: m.text, place: "deck", rect: d.rect, room: d.room, font: d.font, stroke: d.stroke, line: d.line, alt: footage });
return;
}
- const p = places[k];
- marks.push({ ...common, text: p.text, place: "footage", fell: d.fell, corner: p.corner, ...(asked ? { asked } : {}), rect: p.rect, room, font: p.size.fontSize, stroke: p.size.stroke });
+ marks.push({ ...common, ...footage, fell: d.fell });
return;
}
- const p = places[k];
- marks.push({ ...common, text: p.text, place: "footage", corner: p.corner, ...(asked ? { asked } : {}), rect: p.rect, room, font: p.size.fontSize, stroke: p.size.stroke });
+ marks.push({ ...common, ...footage });
});
}
if (!marks.length && !inSegment.length) return null;
diff --git a/umtool/report-to-video/gap-cue-slice.test.mjs b/umtool/report-to-video/gap-cue-slice.test.mjs
@@ -306,3 +306,204 @@ appendFileSync(${JSON.stringify(path.join(dir, "runs.log"))}, a.join(" ") + "\\n
rmSync(dir, { recursive: true, force: true });
}
});
+
+// ---- review 1d ---------------------------------------------------------------------------------------------------
+
+const { resolveBrandRender } = await import("./brand.mjs");
+const { sourceLineRow, untitledRows } = await import("./chrome-deck.mjs");
+const { deckLineWidth, basisOf, moduleAvoids, GAP_CUE_DECK_AIR, GAP_CUE_MIN_UP } = await import("./gap-cue-slice.mjs");
+const { sansWidth } = await import("./gap-mark-place.mjs");
+const STATUS_STAMP = { refreshedAt: "2031-03-02T00:00:00.000Z", sources: { "synth-channel/synthvid001": { now: "members_only", since: null, asOf: "2031-03-01T20:00:00Z", first: "public", firstAt: "2031-03-01T10:05:00Z", firstWhen: "live", from: "corpus", evidence: [] } } };
+const branded = (extra = {}) => resolveBrandRender({ width: 1920, height: 1080, fps: 30, transition: 0.5, brand: "archilyzer-media", chrome: { engine: "hyperframes", layout: "deck", deck: { subtitle: { status: "end" } } }, gapCue: { mark: true, place: "deck" }, ...extra });
+
+test("review 1d, 1: a source line is reckoned in the face the deck sets it in (the brand's Plex Mono), its separators' padding and letter-spacing -- never under what the browser draws", () => {
+ const line = "Synth Channel · Mar 1, 2031 · 12:34";
+ // Measured in the render browser (Chromium, the deck's .deck-sub CSS) at 26 px: Plex Mono 543.7 px; Plex Sans 448.7, Fira Sans 411.7.
+ const mono = deckLineWidth({ text: line, size: 26, render: branded() });
+ assert.ok(mono >= 543.7 && mono <= 546, `branded: ${mono}`);
+ assert.ok(sansWidth(line, 26) < 543.7, "the bold-sans table alone was short of it (the defect)");
+ const other = deckLineWidth({ text: line, size: 26, render: { fontRegular: "/fonts/Some-Sans.ttf" } });
+ assert.ok(other >= 543.7, `any other face: at least the mono's (${other})`);
+ const long = "Synth Channel · Synthetic stream 1: a long title · Mar 1, 2031 · 1:02:34 · now members-only (public when streamed)";
+ const longMono = deckLineWidth({ text: long, size: 26, render: branded() });
+ assert.ok(longMono >= 1797.1 && longMono <= 1800, `branded long line: ${longMono} (Chromium 1797.1)`);
+});
+
+test("review 1d, 1: on a BRANDED deck a long source line with its status sends the mark over the footage, where the old reckoning stood it on the line", () => {
+ const render = branded();
+ const tl = [clip("c01", "synthvid001", 600, { onscreen: { title: "The first moment" }, gaps: [{ from: 605, to: 617 }] }), clip("c02", "synthvid002", 1200)];
+ const m = { title: "T", provenance: { channelSlug: "synth-channel", channel: "Synth Channel", siteOrigin: "https://archive.example.test" }, sourceStatus: STATUS_STAMP, render, timeline: tl };
+ const metasOf = (n) => [{ ...META(1), title: `Synthetic stream: ${"x".repeat(n)}` }, META(2)];
+ for (const [n, want] of [[10, "deck"], [20, "footage"]]) {
+ const sch = estimateSchedule(m, { metas: metasOf(n) });
+ const seg = sch.segments[0];
+ assert.match(seg.subtitle, /members-only \(public when streamed\)$/, "the status at its longest ends the line");
+ const lay = deckLayout(render, { tally: tallyOf(sch, render), schedule: sch });
+ const row = sourceLineRow(lay.text, seg);
+ const k = gapCueSlice(sch, { entries: tl, render, records: new Map([["c01", OLD_RECORD]]), provenance: m.provenance }).marks[0];
+ assert.equal(k.place, want, `${n}: ${k.place} (${k.fell ?? ""})`);
+ const { deck: band } = deckGeometry(render);
+ const lineEnd = band.x + lay.text.x + deckLineWidth({ text: row.text, parts: row.parts, size: row.size, render });
+ if (want === "deck") {
+ assert.ok(k.rect.x >= lineEnd + GAP_CUE_DECK_AIR, `clear of the line (${k.rect.x} vs ${lineEnd})`);
+ // What the page measures before it shows it, and where it goes if it must.
+ assert.equal(k.line.text, row.text);
+ assert.equal(k.line.x, band.x + lay.text.x);
+ assert.equal(k.alt.place, "footage");
+ assert.equal(k.alt.corner, "bl");
+ } else {
+ assert.equal(k.fell, "row");
+ // The bold-sans table alone would have stood it in the deck, on the line's end.
+ assert.ok(lay.text.x + sansWidth(row.text, row.size) + GAP_CUE_DECK_AIR < lay.text.x + lay.text.width - 22 - k.rect.w, "the old reckoning had room");
+ }
+ }
+});
+
+test("review 1d, 1: the deck mark's page measures the source line in its own faces and stands over the footage when they would touch", () => {
+ const render = branded();
+ const tl = [clip("c01", "synthvid001", 600, { onscreen: { title: "The first moment" }, gaps: [{ from: 605, to: 617 }] }), clip("c02", "synthvid002", 1200)];
+ const m = { title: "T", provenance: { channelSlug: "synth-channel", channel: "Synth Channel", siteOrigin: "https://archive.example.test" }, sourceStatus: STATUS_STAMP, render, timeline: tl };
+ const sched = withGapCue(estimateSchedule(m, { metas: METAS }), { entries: tl, render, records: new Map([["c01", OLD_RECORD]]), provenance: m.provenance });
+ const [w] = gapCueWindows(sched);
+ assert.equal(w.mark.place, "deck");
+ const html = gapCueHtml(sched, render, w, { fonts: FONTS });
+ // The line as the deck draws it: its parts, its separators, its size, on its row; never shown.
+ assert.match(html, /<div class="gm-line" aria-hidden="true"><span class="part" data-p="[a-z]+">/);
+ assert.match(html, /\.gm-line \{ position: absolute; left: \d+px; top: \d+px; display: flex; white-space: nowrap; visibility: hidden;/);
+ assert.match(html, /\.gm-line \.sep \{ padding: 0 0\.42em; font-family: 'DeckSansBold'/);
+ assert.match(html, new RegExp(`font-size: ${w.mark.line.size}px; letter-spacing: 0\\.005em;`));
+ // Measured once its faces are in, before the page says it is fitted; the fallback is the footage place.
+ assert.match(html, /Promise\.all\(\[document\.fonts\.load\("\d+px DeckSans"\)/);
+ assert.match(html, /gm\.classList\.add\("fell"\)[\s\S]*gm\.dataset\.fell = "line";[\s\S]*document\.documentElement\.dataset\.fit = "1";/);
+ assert.match(html, /\.gm\.fell \{ left: \d+px; right: auto; top: auto; bottom: \d+px;/);
+ // A footage mark carries no measure (its page is what it was).
+ const foot = withGapCue(scheduleOf(manifest({ gapCue: { mark: true } })), { entries: manifest().timeline, render: manifest({ gapCue: { mark: true } }).render, records: new Map([["c01", OLD_RECORD]]) });
+ const fh = gapCueHtml(foot, manifest().render, gapCueWindows(foot)[0], { fonts: FONTS });
+ assert.ok(!fh.includes("gm-line") && !fh.includes("fonts.load"), "no line, no measure");
+});
+
+test("review 1d, 2: a cut record DECIDES -- one with no gaps (a segment cut before its gaps) has no joins to mark; only with no record the play window stands in", () => {
+ const m = manifest({ gapCue: { mark: true } });
+ const { gaps: _g, ...noGaps } = OLD_RECORD;
+ assert.equal(sliceOf(m, new Map([["c01", noGaps]])), null, "no mark where the picture has no join");
+ assert.deepEqual(basisOf(m.timeline[0], m.render, noGaps).gaps, []);
+ assert.equal(basisOf(m.timeline[0], m.render, { version: 1, id: "c01" }), null, "a record that cannot say where it starts: none");
+ assert.equal(sliceOf(m, null).marks.length, 1, "no record at all: the play window's gaps");
+});
+
+test("review 1d, 4: an untitled clip in a two-line deck: the mark on the META line's row, as the page lays it", () => {
+ const m = manifest({ gapCue: { mark: true, place: "deck" }, deck: { subtitle: { lines: 2 } } });
+ m.timeline[0] = { ...m.timeline[0], onscreen: undefined };
+ const sch = scheduleOf(m);
+ const seg = sch.segments[0];
+ assert.equal(seg.title, "", "untitled");
+ assert.equal(seg.subtitleLines?.length, 2, "two lines");
+ const lay = deckLayout(m.render, { tally: tallyOf(sch, m.render), schedule: sch });
+ const u = untitledRows(lay.text);
+ const html = deckHtml(sch, m.render, { fonts: FONTS });
+ const top = Number(/\.seg\.untitled\.two \.sc \{ top: (\d+)px; height: (\d+)px; \}/.exec(html)[1]);
+ assert.equal(top, u.u2Y, "the page's row is untitledRows'");
+ const row = sourceLineRow(lay.text, seg);
+ assert.equal(row.y, u.u2Y + u.u2HeadBox, "the meta line, under the promoted head");
+ assert.equal(row.size, lay.text.subtitleSize);
+ const k = sliceOf(m).marks[0];
+ assert.equal(k.place, "deck");
+ const { deck: band } = deckGeometry(m.render);
+ assert.ok(Math.abs(k.rect.y + k.rect.h / 2 - (band.y + row.y + row.box / 2)) <= 1, `centred on the meta row (${k.rect.y})`);
+ assert.notEqual(row.y, lay.text.subtitleY + lay.text.headBox, "not the titled two-line row (the defect)");
+ // Titled, one line in a two-line deck (an entry's own one-line subtitle): its own row, not the meta's.
+ const one = sourceLineRow(lay.text, { ...seg, title: "A title", subtitleLines: null });
+ assert.equal(one.y, lay.text.subtitleY);
+});
+
+test("review 1d, 5: over the footage the mark keeps off the stats panel and the effects' screenshots while each is up", async () => {
+ const { statsGeometry, fxGeometry } = await import("./deck.mjs");
+ const m = manifest({ gapCue: { mark: true }, chrome: { stats: { position: "bottom-left" } } });
+ const base = scheduleOf(m);
+ const k0 = sliceOf(m).marks[0];
+ assert.equal(k0.corner, "bl");
+ const overlaps = (r, g) => r.x < g.x + g.width && g.x < r.x + r.w && r.y < g.y + g.height && g.y < r.y + r.h;
+ const run = (sched) => gapCueSlice(sched, { entries: m.timeline, render: m.render, records: new Map([["c01", OLD_RECORD]]) }).marks[0];
+ // The stats panel up over the join, bottom left: the mark hops off it.
+ const withStats = { ...base, stats: { clips: [{ segment: "c01", in: k0.at - 1, out: k0.until + 1, name: null, states: [] }] } };
+ const ks = run(withStats);
+ assert.notEqual(ks.corner, "bl");
+ assert.ok(!overlaps(ks.rect, statsGeometry(m.render)), "not over the stats panel");
+ // Up only after the mark is gone: it stays.
+ assert.equal(run({ ...base, stats: { clips: [{ segment: "c01", in: k0.until + 1, out: k0.until + 4 }] } }).corner, "bl");
+ // A zoom's card (centred, up to 84 % of the box tall) and the receipts' fan (their side's column).
+ const box = fxGeometry(m.render);
+ const right = run({ ...base, fx: { receipts: { position: "left", width: 0.36, clips: [{ segment: "c01", in: k0.at - 1, out: k0.until + 1 }] } } });
+ assert.notEqual(right.corner, "bl", "off the receipts' column on the left");
+ assert.ok(right.rect.x > box.x + box.width / 2, "to the right");
+ // The zoom's card at its largest, centred, over its seconds (a corner it covers is hopped off like any other).
+ const zs = { ...base, fx: { zoom: { width: 0.56, clips: [{ segment: "c01", in: 3, out: 9 }] } } };
+ const [z] = moduleAvoids(zs, m.render);
+ assert.deepEqual([z.from, z.to], [3, 9]);
+ assert.ok(z.w >= Math.ceil(0.56 * box.width) && z.h >= Math.ceil(0.84 * box.height), `at its largest (${JSON.stringify(z)})`);
+ assert.ok(Math.abs(z.x + z.w / 2 - (box.x + box.width / 2)) <= 1 && Math.abs(z.y + z.h / 2 - (box.y + box.height / 2)) <= 1, "centred on the box");
+ assert.equal(run(zs).corner, "bl", "a 56 % card leaves the corners free");
+});
+
+test("review 1d, 6: a clip id with '.' or ':' names its marks, its window and its frames", () => {
+ const m = manifest({ gapCue: { mark: true }, timeline: [clip("c.01:a", "synthvid001", 600, { gaps: [{ from: 605, to: 617 }] }), clip("c02", "synthvid002", 1200)] });
+ const sched = withGapCue(scheduleOf(m), { entries: m.timeline, render: m.render, records: new Map([["c.01:a", { ...OLD_RECORD, id: "c.01:a" }]]) });
+ const [w] = gapCueWindows(sched);
+ assert.equal(w.segment, "c.01:a.g0");
+ const snapped = gapCueModule.window(sched, { segment: "c.01:a.g0", fps: 30, total: sched.total });
+ assert.equal(snapped.segment, "c.01:a.g0");
+ assert.equal(gapCueModule.names({ preview: false, window: snapped }).stem, "gap-cue-c.01:a.g0");
+ for (const bad of ["a/b.g0", "a\\b.g0", "a b.g0", "x"]) {
+ assert.throws(() => gapCueModule.window(sched, { window: { segment: bad, from: w.from, to: w.to }, fps: 30, total: sched.total }), /is not a mark id/, bad);
+ }
+});
+
+test("review 1d, 8: a mark is gone before the dissolve into the next segment; a short one rises only as the drawtext's does", () => {
+ // The join 0.5 s before c01's dissolve out begins: its life cut there, its ramps meeting under the peak.
+ const sch0 = scheduleOf(manifest({ gapCue: { mark: true } }));
+ const seg = sch0.segments[0];
+ const D = sch0.transition;
+ const outAt = seg.end - D;
+ const join = outAt - 0.5 - seg.start; // segment seconds
+ const rec = { ...OLD_RECORD, start: 600, end: 600 + seg.duration + 3, gaps: [{ from: 600 + join, to: 600 + join + 3 }] };
+ const m = manifest({ gapCue: { mark: true }, timeline: [clip("c01", "synthvid001", 600, { end: 600 + seg.duration + 3, gaps: [{ from: 600 + join, to: 600 + join + 3 }] }), clip("c02", "synthvid002", 1200)] });
+ const sch = scheduleOf(m);
+ const k = gapCueSlice(sch, { entries: m.timeline, render: m.render, records: new Map([["c01", rec]]) }).marks[0];
+ const end = sch.segments[0].end - sch.transition;
+ assert.ok(k.until <= end + 1e-4, `until ${k.until} <= the dissolve's start ${end}`);
+ assert.ok(k.until - k.at < 1.1 && k.until - k.at >= GAP_CUE_MIN_UP);
+ const sched = withGapCue(sch, { entries: m.timeline, render: m.render, records: new Map([["c01", rec]]) });
+ const data = JSON.parse(/<script id="gap-cue-data" type="application\/json">(.*?)<\/script>/s.exec(gapCueHtml(sched, m.render, gapCueWindows(sched)[0], { fonts: FONTS }))[1]);
+ const len = k.until - k.at;
+ assert.ok(Math.abs(data.cues[0].to.autoAlpha - (0.9 * len) / 0.5) < 1e-3, `peak ${data.cues[0].to.autoAlpha} for a ${len} s mark`);
+ assert.ok(Math.abs(data.cues[1].at + data.cues[1].dur - k.until) < 1e-3, "faded out by its end");
+ // A join inside the last GAP_CUE_MIN_UP before the dissolve: none.
+ const late = outAt - 0.1 - seg.start;
+ const rec2 = { ...rec, gaps: [{ from: 600 + late, to: 600 + late + 3 }] };
+ const m2 = manifest({ gapCue: { mark: true }, timeline: [clip("c01", "synthvid001", 600, { end: 600 + seg.duration + 3, gaps: [{ from: 600 + late, to: 600 + late + 3 }] }), clip("c02", "synthvid002", 1200)] });
+ assert.equal(gapCueSlice(scheduleOf(m2), { entries: m2.timeline, render: m2.render, records: new Map([["c01", rec2]]) }), null);
+ // The LAST segment has no dissolve out: its own end.
+ const lastOnly = manifest({ gapCue: { mark: true }, timeline: [clip("c02", "synthvid002", 1200), clip("c01", "synthvid001", 600, { gaps: [{ from: 605, to: 617 }] })] });
+ const kl = gapCueSlice(scheduleOf(lastOnly), { entries: lastOnly.timeline, render: lastOnly.render, records: new Map([["c01", OLD_RECORD]]) }).marks[0];
+ assert.ok(Math.abs(kl.until - kl.at - 1.1) < 1e-3, "a whole life");
+});
+
+test("review 1d, 10: a windowed take (its timeline the window's entries) and a preview window: the marks on that cut's clock, only the windows it covers", async () => {
+ const { windowEntries } = await import("../lib/report/takeMaker.mjs");
+ const m = manifest({ gapCue: { mark: true }, timeline: [clip("c00", "synthvid002", 1200), clip("c01", "synthvid001", 600, { gaps: [{ from: 605, to: 617 }] }), clip("c02", "synthvid002", 1300)] });
+ const whole = scheduleOf(m, [META(2), META(1), META(2)]);
+ const ids = windowEntries(m.timeline, { at: whole.segments[1].start + 1, dur: 2 }, { render: m.render }).ids;
+ assert.deepEqual(ids, ["c01"]);
+ const take = { ...m, timeline: m.timeline.filter((e) => ids.includes(e.id)) };
+ const ts = scheduleOf(take, [META(1)]);
+ const k = gapCueSlice(ts, { entries: take.timeline, render: take.render, records: new Map([["c01", OLD_RECORD]]) }).marks[0];
+ assert.ok(Math.abs(k.at - (ts.segments[0].start + 5.2)) < 1e-3, "on the take's own clock: its first segment's start");
+ // A preview window of the whole cut: the windows it touches, shifted into its clock.
+ const sched = withGapCue(whole, { entries: m.timeline, render: m.render, records: new Map([["c01", OLD_RECORD]]) });
+ const w = gapCueWindows(sched)[0];
+ const at = w.from - 0.5;
+ const hit = gapCueModule.regions(sched, { render: m.render, outDir: "/o", shift: at, clip: { at, dur: 2 } });
+ assert.equal(hit.length, 1);
+ assert.ok(Math.abs(hit[0].offset - 0.5) < 0.05, `offset ${hit[0].offset} into the window`);
+ assert.deepEqual(gapCueModule.regions(sched, { render: m.render, outDir: "/o", shift: 0, clip: { at: 0, dur: 1 } }), [], "a window before it: none");
+});
diff --git a/umtool/report-to-video/modules/gap-cue.mjs b/umtool/report-to-video/modules/gap-cue.mjs
@@ -44,7 +44,7 @@ export default defineModule({
rows: [
["`render.gapCue.mark`", "`true` · `false` · default `false` (off: every cut renders as it did)", "`umtool look <p> gapCue='{\"mark\":true}'` · a take: `--set render.gapCue.mark=true`"],
["`render.gapCue.min`", `${GAP_CUE_MIN.min}–${GAP_CUE_MIN.max} s · default ${GAP_CUE_DEFAULTS.min} (a shorter gap draws nothing)`, "`umtool look <p> gapCue='{\"min\":4}'`"],
- ["`render.gapCue.place`", "`footage` (over the footage, at its corner) · `deck` (in the deck's band, at the end of the source line, left of the QR -- over the footage where the row has no room, the deck is hidden or stacked, and in a cut with no deck) · default `footage`", "`umtool look <p> gapCue='{\"place\":\"deck\"}'`"],
+ ["`render.gapCue.place`", "`footage` (over the footage, at its corner) · `deck` (in the deck's band, at the end of the source line, left of the QR -- over the footage where the row has no room, in the stacked vertical deck and in a cut with no deck; the page measures the line in its own faces and never stands the mark on it) · default `footage`", "`umtool look <p> gapCue='{\"place\":\"deck\"}'`"],
["`render.gapCue.corner`", "`auto` (the layout's free corner) · `tl` · `tr` · `bl` · `br` · default `auto`", "`umtool look <p> gapCue='{\"corner\":\"br\"}'`"],
["`render.gapCue.label`", `text holding \`{s}\` (the time skipped: \`27 s\`, from a minute \`1:12\`) and maybe \`{why}\` (the gap's reason); a part in \`[ ]\` is drawn only when the gap has one; at most ${GAP_CUE_LABEL_MAX} characters · default \`${GAP_CUE_DEFAULTS.label}\` (\`» 27 s\`, \`» 26 s · dead air\`)`, "`umtool look <p> gapCue='{\"label\":\"{s} later\"}'`"],
["a clip's `gapCue`", "the same keys, over the project's", "`umtool set <p> <clip> gapCue.mark=false gapCue.corner=tr gapCue.place=deck` (`gapCue=` clears them)"],