Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit d114b976f321d5eebc3d217191259c374236e67a
parent 78e92f2ad8da7b9f2506ae3faf93fb6dec3fd589
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Fri, 20 Nov 2026 13:55:16 -0500

umtool: a small mark where a clip skips time (gap cue, slice 1)

- With render.gapCue.mark on, each join a clip's gap leaves shows "» 27 s"
  (from a minute "» 1:12") near a corner of the footage for 1.1 s, fading
  in and out. There is no sound. A gap under min (2 s) draws nothing, and
  joins less than a mark's life apart are one mark that sums their seconds.
- The rule lives in one place, common lib/report/gapCue.mjs: the settings
  (project render.gapCue < a clip's gapCue < a gap's own mark), the label
  ({s}, a knob), the timing and the opacity. It is pure, so umtool's pages
  can draw the same mark. render.gapCue is a look key, so a preset, a style
  or a take patch carries it.
- report-to-video/gap-mark.mjs places the mark and builds its drawtext
  (drawtext alpha fades the box too: measured). It is drawn into the clip's
  segment after its hidden regions and blur, in the deck, plain, vertical
  and twocrop paths, at the layout's free corner. It moves off a hidden
  region or a code that is up under it. The cut record names each mark
  (gapMarks). The gap-cue module (kind input) carries its docs and ui rows.
- A gap may carry mark and why (dead-air | other), kept by every gap list
  and writer. Edit them with `umtool set … gap.mark=<s>:off
  gap.why=<s>:dead-air`, or gapEdit on the window route. The clip's own
  settings are `umtool set … gapCue.*`; the project's are
  `umtool look <p> gapCue=…`.
- Off, unset or under min, every segment's key and bytes are as before.
  This is tested: the segment is reused with the same key. When it is on,
  only segments of clips with a marked gap re-render.
- takeMaker estimatedSeconds counts a clip's cut less its gaps. A
  `take --at` window timed by the estimates landed early by the gaps' total
  and rendered the gapped clip instead of the one after it.
- Tests: common gapCue.test.ts; gap-mark.test.mjs; gaps.test (own keys);
  gaps-render (mark off reuses the segment, mark on draws and records it,
  off again is the plain bytes); gaps-writer (set/look/gapEdit);
  takeMaker (window after a gapped clip). Docs: knobs.md gaps section and
  set row, the Modules section and cli.md regenerated. Changelog in
  editor/CHANGELOG.md.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
Acommon/lib/report/gapCue.d.mts | 30++++++++++++++++++++++++++++++
Acommon/lib/report/gapCue.mjs | 238+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Acommon/lib/report/gapCue.test.ts | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mcommon/lib/report/look.d.mts | 2+-
Mcommon/lib/report/look.mjs | 13+++++++++++--
Mcommon/lib/report/videoAssistOps.test.ts | 2+-
Mcommon/package.json | 1+
Meditor/CHANGELOG.md | 17+++++++++++++++++
Mumtool/app/api/report/window/route.ts | 5+++++
Mumtool/docs/cli.md | 4++--
Mumtool/docs/knobs.md | 34+++++++++++++++++++++++++++++++++-
Mumtool/lib/cli/groups.mjs | 4++--
Mumtool/lib/report/gaps-writer.test.mjs | 37+++++++++++++++++++++++++++++++++++++
Mumtool/lib/report/knobsCli.mjs | 50++++++++++++++++++++++++++++++++++++++++++++++----
Mumtool/lib/report/look.test.mjs | 2+-
Mumtool/lib/report/manifest.mjs | 36+++++++++++++++++++++++++++++++-----
Mumtool/lib/report/takeMaker.mjs | 9+++++++--
Mumtool/lib/report/takeMaker.test.mjs | 5+++++
Mumtool/report-to-video/build-video.mjs | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----
Aumtool/report-to-video/gap-mark.mjs | 192+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aumtool/report-to-video/gap-mark.test.mjs | 76++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/gaps-render.test.mjs | 79+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/gaps.mjs | 43++++++++++++++++++++++++++++++++++++++-----
Mumtool/report-to-video/gaps.test.mjs | 17+++++++++++++++++
Aumtool/report-to-video/modules/gap-cue.mjs | 40++++++++++++++++++++++++++++++++++++++++
Mumtool/report-to-video/modules/index.mjs | 3++-
26 files changed, 1081 insertions(+), 31 deletions(-)

diff --git a/common/lib/report/gapCue.d.mts b/common/lib/report/gapCue.d.mts @@ -0,0 +1,30 @@ +// Types for ./gapCue.mjs (lane gap-cue): the gap cue's settings, label and timing. + +type Render = Record<string, unknown> | null | undefined; +type Entry = Record<string, unknown> | null | undefined; + +export type GapCueCorner = "auto" | "tl" | "tr" | "bl" | "br"; +export type GapCue = { mark: boolean; min: number; corner: GapCueCorner; label: string }; +export type GapCueMark = { at: number; until: number; seconds: number; count: number }; +export type GapJoin = { at: number; seconds: number; mark: boolean; play?: number }; + +export const GAP_CUE_DEFAULTS: Readonly<GapCue>; +export const GAP_CUE_KEYS: readonly ("mark" | "min" | "corner" | "label")[]; +export const GAP_CUE_CORNERS: readonly GapCueCorner[]; +export const GAP_CUE_MIN: Readonly<{ min: number; max: number }>; +export const GAP_CUE_LABEL_MAX: number; +export const GAP_WHY: readonly ("dead-air" | "other")[]; +export const GAP_CUE_MOTION: Readonly<{ in: number; hold: number; out: number; peak: number }>; +export const GAP_CUE_LIFE: number; + +export function gapCueErrors(v: unknown, where?: string): string[]; +export function validateGapCue(manifest: unknown): string[]; +export function gapCueOf(render: Render): GapCue; +export function clipGapCueOf(render: Render, entry: Entry): GapCue; +export function gapMarkOn(cue: { mark: boolean }, gap: { mark?: unknown } | null | undefined): boolean; +export function gapCueWanted(render: Render, entry: Entry): boolean; +export function gapCueLength(seconds: number): string; +export function gapCueText(seconds: number, label?: string): string; +export function gapCues(joins: GapJoin[], opts?: { min?: number; seconds?: number; life?: number }): GapCueMark[]; +export function gapCueAlpha(t: number, cue: { at: number; until: number }): number; +export function patchGapCue(current: unknown, patch: unknown): Record<string, unknown> | null; diff --git a/common/lib/report/gapCue.mjs b/common/lib/report/gapCue.mjs @@ -0,0 +1,238 @@ +// THE GAP CUE (lane gap-cue, slice 1): a small mark at the join a clip's gap +// leaves -- "» 27 s" -- so a viewer can tell that time was skipped, and +// roughly how much, without the mark pulling the eye from the footage. +// +// This module is the RULE, once, for every reader: the build draws the mark +// into the clip's segment (umtool report-to-video gap-mark.mjs), and umtool's +// pages (Play the cut, the clip bench) draw the same mark at the same seconds +// from the same functions. It holds the settings and their precedence, the +// label, and the timing; nothing here knows about ffmpeg or the DOM. +// +// THE SETTINGS, most specific wins: +// +// render.gapCue { mark?, min?, corner?, label? } the project's (a look key: a preset, a style or +// a take patch carries it like any other) +// clip.gapCue { mark?, min?, corner?, label? } one clip's, over the project's +// a gap's `mark` true | false one gap's, over both +// +// mark draw the mark at a join (default false: OFF, so a cut that says nothing renders as it always did) +// min a gap shorter than this draws nothing (seconds, default 2: a breath taken out is not worth a mark) +// corner auto | tl | tr | bl | br (default auto: the layout's own free corner) +// label the text, `{s}` the length skipped (default "» {s}": "» 27 s", from a minute "» 1:12") +// +// A gap may also carry `why` ("dead-air" | "other"): what it was cut for. It +// draws nothing in slice 1; a fast-forward default (slice 3) will reach only +// the gaps marked dead air, so a gap cut to HIDE what is in it never plays. +// +// THE TIMING, on the segment's clock (seconds from its first frame): the mark +// comes up over GAP_CUE_MOTION.in at the join, holds, and goes over +// GAP_CUE_MOTION.out -- GAP_CUE_LIFE in all. Joins closer together than that +// are ONE mark: it comes up at the first, says the seconds of all of them, and +// goes a life after the last. It never outlives the segment. +// +// PURE and dependency-free: the client bundle takes it as it is. + +const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); +const fin = (v) => typeof v === "number" && Number.isFinite(v); +const EPS = 1e-6; + +/** The settings a cut that says nothing has: the mark off. */ +export const GAP_CUE_DEFAULTS = Object.freeze({ mark: false, min: 2, corner: "auto", label: "» {s}" }); +/** The keys `render.gapCue` and a clip's `gapCue` take. */ +export const GAP_CUE_KEYS = Object.freeze(["mark", "min", "corner", "label"]); +/** Where the mark may stand: the layout's choice, or a corner of its box. */ +export const GAP_CUE_CORNERS = Object.freeze(["auto", "tl", "tr", "bl", "br"]); +/** `min`'s range, in seconds. */ +export const GAP_CUE_MIN = Object.freeze({ min: 0.5, max: 60 }); +/** A label's longest, in characters. */ +export const GAP_CUE_LABEL_MAX = 40; +/** What a gap was cut for (`why`). */ +export const GAP_WHY = Object.freeze(["dead-air", "other"]); +/** The mark's motion (seconds) and its opacity at full. */ +export const GAP_CUE_MOTION = Object.freeze({ in: 0.15, hold: 0.6, out: 0.35, peak: 0.9 }); +/** How long one mark is up: in, hold and out. */ +export const GAP_CUE_LIFE = GAP_CUE_MOTION.in + GAP_CUE_MOTION.hold + GAP_CUE_MOTION.out; + +const q = (v) => JSON.stringify(v); + +/** + * Every reason a `gapCue` block cannot be built ([] when it can; absent is fine). + * + * @param {unknown} v + * @param {string} [where] + * @returns {string[]} + */ +export function gapCueErrors(v, where = "render.gapCue") { + if (v === undefined || v === null) return []; + if (!isObj(v)) return [`${where} must be { mark?, min?, corner?, label? }`]; + const errors = []; + for (const k of Object.keys(v)) if (!GAP_CUE_KEYS.includes(k)) errors.push(`${where}.${k} is not a key (${GAP_CUE_KEYS.join(", ")})`); + if (v.mark !== undefined && typeof v.mark !== "boolean") errors.push(`${where}.mark is true (draw the mark at a join) or false, not ${q(v.mark)}`); + if (v.min !== undefined && !(fin(v.min) && v.min >= GAP_CUE_MIN.min && v.min <= GAP_CUE_MIN.max)) { + errors.push(`${where}.min is seconds from ${GAP_CUE_MIN.min} to ${GAP_CUE_MIN.max} (a shorter gap draws nothing), not ${q(v.min)}`); + } + if (v.corner !== undefined && !GAP_CUE_CORNERS.includes(/** @type {string} */ (v.corner))) errors.push(`${where}.corner is one of ${GAP_CUE_CORNERS.join(", ")}, not ${q(v.corner)}`); + if (v.label !== undefined) { + if (typeof v.label !== "string" || !v.label.includes("{s}")) errors.push(`${where}.label is text holding {s} (the seconds skipped), e.g. "» {s}" or "{s} later"`); + else if (v.label.length > GAP_CUE_LABEL_MAX || /[\n\r]/.test(v.label)) errors.push(`${where}.label is one line of at most ${GAP_CUE_LABEL_MAX} characters`); + } + return errors; +} + +/** + * Every reason a manifest's gap cue settings cannot be built: `render.gapCue` + * and each clip's `gapCue` (a gap's own `mark` and `why` are gaps.mjs's). + * + * @param {{ render?: unknown, timeline?: unknown }} manifest + * @returns {string[]} + */ +export function validateGapCue(manifest) { + const render = isObj(manifest?.render) ? manifest.render : {}; + const errors = gapCueErrors(render.gapCue, "render.gapCue"); + const timeline = Array.isArray(manifest?.timeline) ? manifest.timeline : []; + timeline.forEach((e, i) => { + if (!isObj(e) || e.gapCue === undefined) return; + const where = `timeline[${i}] (${e.id ?? "?"}).gapCue`; + if (e.type !== "clip") errors.push(`${where}: only a clip has gaps to mark`); + else errors.push(...gapCueErrors(e.gapCue, where)); + }); + return errors; +} + +/** The well-formed keys of a `gapCue` block (anything else dropped). */ +function own(v) { + if (!isObj(v)) return {}; + const out = {}; + if (typeof v.mark === "boolean") out.mark = v.mark; + if (fin(v.min) && v.min >= GAP_CUE_MIN.min && v.min <= GAP_CUE_MIN.max) out.min = v.min; + if (GAP_CUE_CORNERS.includes(v.corner)) out.corner = v.corner; + if (typeof v.label === "string" && v.label.includes("{s}") && v.label.length <= GAP_CUE_LABEL_MAX) out.label = v.label; + return out; +} + +/** + * The project's settings, the defaults filled in. + * + * @param {Record<string, any> | null | undefined} render + * @returns {{ mark: boolean, min: number, corner: string, label: string }} + */ +export const gapCueOf = (render) => ({ ...GAP_CUE_DEFAULTS, ...own(render?.gapCue) }); + +/** + * One clip's settings: its own `gapCue` over the project's. + * + * @param {Record<string, any> | null | undefined} render + * @param {Record<string, any> | null | undefined} entry + */ +export const clipGapCueOf = (render, entry) => ({ ...gapCueOf(render), ...own(entry?.gapCue) }); + +/** + * Is one gap marked: its own `mark` when it says, else its clip's (`cue`, clipGapCueOf). + * + * @param {{ mark: boolean }} cue + * @param {{ mark?: unknown } | null | undefined} gap + */ +export const gapMarkOn = (cue, gap) => (typeof gap?.mark === "boolean" ? gap.mark : cue.mark); + +/** Is the mark on anywhere in this clip: for the clip, or for one of its gaps? */ +export function gapCueWanted(render, entry) { + const cue = clipGapCueOf(render, entry); + const gaps = Array.isArray(entry?.gaps) ? entry.gaps : []; + return gaps.some((g) => gapMarkOn(cue, g)); +} + +/** + * The length skipped, as the mark says it: whole seconds under a minute + * ("27 s"), then m:ss ("1:12"), then h:mm:ss ("1:02:03"). + * + * @param {number} seconds + */ +export function gapCueLength(seconds) { + const r = Math.max(0, Math.round(Number(seconds) || 0)); + if (r < 60) return `${r} s`; + const p2 = (n) => String(n).padStart(2, "0"); + const h = Math.floor(r / 3600); + const m = Math.floor((r % 3600) / 60); + const s = r % 60; + return h ? `${h}:${p2(m)}:${p2(s)}` : `${m}:${p2(s)}`; +} + +/** + * The mark's text: `label` with `{s}` the length skipped. + * + * @param {number} seconds + * @param {string} [label] + */ +export const gapCueText = (seconds, label = GAP_CUE_DEFAULTS.label) => String(label).split("{s}").join(gapCueLength(seconds)); + +/** + * The marks a segment draws, from its joins. + * + * `joins`: each `{ at, seconds, mark, play? }` -- `at` the join on the + * segment's clock, `seconds` the source seconds the gap left out, `mark` + * whether this gap is marked (gapMarkOn), `play` the seconds the gap itself + * plays (0, a skip; slice 3's fast-forward). A gap unmarked, or under `min`, + * draws nothing and joins no mark. Marked joins less than `life` apart are + * one mark, the seconds of each in it. A mark never outlives the segment + * (`seconds`), and one with under a fifth of a second left is not drawn. + * + * @param {Array<{ at: number, seconds: number, mark: boolean, play?: number }>} joins + * @param {{ min?: number, seconds?: number, life?: number }} [opts] + * @returns {Array<{ at: number, until: number, seconds: number, count: number }>} + */ +export function gapCues(joins, { min = GAP_CUE_DEFAULTS.min, seconds = Infinity, life = GAP_CUE_LIFE } = {}) { + const marked = (joins ?? []) + .filter((j) => j && j.mark === true && fin(j.at) && fin(j.seconds) && j.seconds >= min - EPS) + .sort((a, b) => a.at - b.at); + const out = []; + let open = null; + for (const j of marked) { + const end = j.at + (fin(j.play) && j.play > 0 ? j.play : 0) + life; + if (open && j.at < open.until - EPS) { + open.until = Math.max(open.until, end); + open.seconds += j.seconds; + open.count += 1; + continue; + } + open = { at: j.at, until: end, seconds: j.seconds, count: 1 }; + out.push(open); + } + const r4 = (v) => Math.round(v * 10000) / 10000; + return out + .map((c) => ({ at: r4(Math.max(0, c.at)), until: r4(Math.min(seconds, c.until)), seconds: r4(c.seconds), count: c.count })) + .filter((c) => c.until - c.at >= 0.2 - EPS); +} + +/** + * The mark's opacity at `t` (the segment's clock): up over `in`, down over + * `out`, GAP_CUE_MOTION.peak between; 0 outside it. The build's alpha + * expression is this, written for ffmpeg (gap-mark.mjs). + * + * @param {number} t + * @param {{ at: number, until: number }} cue + */ +export function gapCueAlpha(t, cue) { + if (!(t >= cue.at && t <= cue.until)) return 0; + const k = Math.min((t - cue.at) / GAP_CUE_MOTION.in, (cue.until - t) / GAP_CUE_MOTION.out); + return GAP_CUE_MOTION.peak * Math.max(0, Math.min(1, k)); +} + +/** + * A patch of a `gapCue` block applied (the look's writer and a clip's): each + * key merged over what it holds, a key null drops it, nothing left is no + * block (null). `patch` null drops the whole block. + * + * @param {unknown} current + * @param {unknown} patch + * @returns {Record<string, unknown> | null} + */ +export function patchGapCue(current, patch) { + if (patch === null) return null; + if (!isObj(patch)) return /** @type {any} */ (patch); + const next = { ...(isObj(current) ? current : {}) }; + for (const [k, v] of Object.entries(patch)) { + if (v === null) delete next[k]; + else next[k] = v; + } + return Object.keys(next).length ? next : null; +} diff --git a/common/lib/report/gapCue.test.ts b/common/lib/report/gapCue.test.ts @@ -0,0 +1,94 @@ +// gapCue.mjs (lane gap-cue): the settings and their precedence (project < +// clip < gap), the label, the timing of the marks, and the look's writer. + +import { test } from "node:test"; +import assert from "node:assert/strict"; +import { + GAP_CUE_DEFAULTS, + GAP_CUE_LIFE, + clipGapCueOf, + gapCueAlpha, + gapCueLength, + gapCueOf, + gapCueText, + gapCueWanted, + gapCues, + gapMarkOn, + validateGapCue, +} from "./gapCue.mjs"; +import { applyLookPatch, lookErrors } from "./look.mjs"; + +test("the defaults: the mark OFF, 2 s, the layout's corner, '» {s}'", () => { + assert.deepEqual(gapCueOf(undefined), { mark: false, min: 2, corner: "auto", label: "» {s}" }); + assert.deepEqual(gapCueOf({}), GAP_CUE_DEFAULTS); + assert.equal(gapCueWanted({}, { type: "clip", gaps: [{ from: 1, to: 9 }] }), false, "a cut that says nothing marks nothing"); +}); + +test("precedence: a gap's mark over its clip's over the project's", () => { + const render = { gapCue: { mark: true, min: 3 } }; + const clip = { type: "clip", gapCue: { mark: false, corner: "tr" }, gaps: [{ from: 1, to: 9 }, { from: 12, to: 20, mark: true }] }; + const cue = clipGapCueOf(render, clip); + assert.deepEqual(cue, { mark: false, min: 3, corner: "tr", label: "» {s}" }); + assert.equal(gapMarkOn(cue, clip.gaps[0]), false, "the clip's off"); + assert.equal(gapMarkOn(cue, clip.gaps[1]), true, "the gap's own on"); + assert.equal(gapCueWanted(render, clip), true); + assert.equal(gapMarkOn(gapCueOf(render), { from: 1, to: 2, mark: false }), false, "a gap's off beats the project's on"); +}); + +test("the label: whole seconds, then m:ss, then h:mm:ss; {s} is the length", () => { + assert.equal(gapCueLength(27.4), "27 s"); + assert.equal(gapCueLength(59.4), "59 s"); + assert.equal(gapCueLength(59.6), "1:00"); + assert.equal(gapCueLength(72), "1:12"); + assert.equal(gapCueLength(3723), "1:02:03"); + assert.equal(gapCueText(27), "» 27 s"); + assert.equal(gapCueText(72, "{s} later"), "1:12 later"); +}); + +test("the marks: under min nothing, marked only, joins within a life are one mark summing their seconds", () => { + assert.deepEqual(gapCues([{ at: 2, seconds: 1.5, mark: true }]), [], "a breath taken out draws nothing"); + assert.deepEqual(gapCues([{ at: 2, seconds: 27, mark: false }]), [], "unmarked"); + assert.deepEqual(gapCues([{ at: 2, seconds: 27, mark: true }], { seconds: 10 }), [{ at: 2, until: 2 + GAP_CUE_LIFE, seconds: 27, count: 1 }]); + const two = gapCues([{ at: 5, seconds: 10, mark: true }, { at: 2, seconds: 27, mark: true }, { at: 2.6, seconds: 4, mark: true }], { seconds: 20 }); + assert.deepEqual(two, [ + { at: 2, until: 2.6 + GAP_CUE_LIFE, seconds: 31, count: 2 }, + { at: 5, until: 5 + GAP_CUE_LIFE, seconds: 10, count: 1 }, + ]); + // Never past the segment; nothing with under 0.2 s left. + assert.deepEqual(gapCues([{ at: 3, seconds: 9, mark: true }], { seconds: 3.5 }), [{ at: 3, until: 3.5, seconds: 9, count: 1 }]); + assert.deepEqual(gapCues([{ at: 3.4, seconds: 9, mark: true }], { seconds: 3.5 }), []); + // A fast-forward's play seconds (slice 3) keep it up that much longer. + assert.equal(gapCues([{ at: 1, seconds: 30, mark: true, play: 0.8 }])[0]!.until, Number((1 + 0.8 + GAP_CUE_LIFE).toFixed(4))); +}); + +test("the opacity: up over 0.15 s, 0.9 at full, down over 0.35 s", () => { + const c = { at: 2, until: 2 + GAP_CUE_LIFE }; + assert.equal(gapCueAlpha(1.9, c), 0); + assert.equal(gapCueAlpha(2, c), 0); + assert.ok(Math.abs(gapCueAlpha(2.075, c) - 0.45) < 1e-9); + assert.equal(gapCueAlpha(2.5, c), 0.9); + assert.equal(gapCueAlpha(c.until, c), 0); +}); + +test("validation: the project's block and each clip's, in the build's words", () => { + assert.deepEqual(validateGapCue({ render: {}, timeline: [] }), []); + assert.deepEqual(validateGapCue({ render: { gapCue: { mark: true, min: 4, corner: "bl", label: "{s} later" } } }), []); + const errs = validateGapCue({ + render: { gapCue: { mark: "yes", min: 0.1, corner: "middle", label: "skipped", size: 3 } }, + timeline: [{ type: "clip", id: "c1", gapCue: { mark: 1 } }, { type: "card", id: "k1", gapCue: {} }], + }); + assert.equal(errs.length, 7, errs.join("\n")); + assert.match(errs.join("\n"), /render\.gapCue\.size is not a key/); + assert.match(errs.join("\n"), /label is text holding \{s\}/); + assert.match(errs.join("\n"), /\(c1\)\.gapCue\.mark is true/); + assert.match(errs.join("\n"), /\(k1\)\.gapCue: only a clip has gaps to mark/); +}); + +test("the look's writer: gapCue merged over what it holds, a key null drops it, null drops the block", () => { + const m = { render: { gapCue: { mark: true, min: 3 } }, timeline: [] }; + assert.deepEqual(applyLookPatch(m, { gapCue: { corner: "tl" } }).render.gapCue, { mark: true, min: 3, corner: "tl" }); + assert.deepEqual(applyLookPatch(m, { gapCue: { min: null } }).render.gapCue, { mark: true }); + assert.equal(applyLookPatch(m, { gapCue: null }).render.gapCue, undefined); + assert.match(applyLookPatch(m, { gapCue: { min: 99 } }).errors.join("\n"), /render\.gapCue\.min is seconds from 0\.5 to 60/); + assert.deepEqual(lookErrors({ render: { gapCue: { mark: true } } }), []); +}); diff --git a/common/lib/report/look.d.mts b/common/lib/report/look.d.mts @@ -4,7 +4,7 @@ type Manifest = { render?: Record<string, unknown> | null; timeline?: unknown[] } & Record<string, unknown>; type Render = Record<string, unknown> | null | undefined; -export type LookKey = "headerHeight" | "footerHeight" | "qr" | "transition" | "transitionStyle" | "loudness" | "captions" | "room" | "slide" | "blur" | "intro" | "format" | "vertical" | "mode" | "basic" | "tallWindows" | "desktop" | "promo" | "zooms" | "censor"; +export type LookKey = "headerHeight" | "footerHeight" | "qr" | "transition" | "transitionStyle" | "loudness" | "captions" | "room" | "slide" | "blur" | "intro" | "format" | "vertical" | "mode" | "basic" | "tallWindows" | "desktop" | "promo" | "zooms" | "censor" | "gapCue"; export const LOOK_KEYS: readonly LookKey[]; export const QR_CORNERS: readonly ["br", "bl", "tr", "tl"]; export const QR_LINK_VALUES: readonly ["cite", "moment", "channel"]; diff --git a/common/lib/report/look.mjs b/common/lib/report/look.mjs @@ -19,6 +19,8 @@ import { introPatchValue, validateIntro } from "./intro.mjs"; // `format` and `vertical` (lane vertical): the cut rendered 9:16, and a clip's side post (./vertical.mjs). import { CLIP_OWN_LAYOUTS, validateVerticalFormat } from "./vertical.mjs"; +// `gapCue` (lane gap-cue): the mark at a clip gap's join (./gapCue.mjs). +import { patchGapCue, validateGapCue } from "./gapCue.mjs"; const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v); const num = (v) => typeof v === "number" && Number.isFinite(v); @@ -29,7 +31,7 @@ const round2 = (n) => Number(Number(n).toFixed(2)); /** The corner code's corners and links (lane clip-kit; umtool report-to-video clip-kit.mjs draws them). */ export const QR_CORNERS = Object.freeze(["br", "bl", "tr", "tl"]); export const QR_LINK_VALUES = Object.freeze(["cite", "moment", "channel"]); -export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical", "mode", "basic", "tallWindows", "desktop", "promo", "zooms", "censor"]); +export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical", "mode", "basic", "tallWindows", "desktop", "promo", "zooms", "censor", "gapCue"]); /** `headerHeight` / `footerHeight`: whole pixels, 0 (off) to this. */ export const BAND_MAX = 240; @@ -384,7 +386,7 @@ export function validateLook(manifest) { // render.blur (the uncensored variant's switch) is part of the look too. return [ ...validateCaptions(manifest), ...validateLoudness(manifest), ...validateVertical(manifest), ...validateRoom(manifest), ...validateRenderBlur(manifest), ...validateIntro(manifest), - ...validateVerticalFormat(manifest), ...validateRenderMode(manifest), + ...validateVerticalFormat(manifest), ...validateRenderMode(manifest), ...validateGapCue(manifest), ]; } @@ -486,6 +488,13 @@ export function applyLookPatch(manifest, patch) { else if (v === false) delete render.tallWindows; else errors.push("render.tallWindows must be true (windows up to render.maxHeightSource) or false (720, the default)"); break; + case "gapCue": { + // Merged over what it holds (a key null drops it); validateGapCue (lookErrors, below) says what is wrong. + const next = patchGapCue(render.gapCue, v); + if (next === null) delete render.gapCue; + else render.gapCue = next; + break; + } case "format": // "landscape" is the default: written as no key at all. if (v === "landscape") delete render.format; diff --git a/common/lib/report/videoAssistOps.test.ts b/common/lib/report/videoAssistOps.test.ts @@ -26,7 +26,7 @@ test("the look's rules: one patch function — keys refused, null removes, qr on assert.deepEqual(bad.errors, validateTransitionStyle({ render: { slide: { blur: 9 } } })); assert.deepEqual(applyLookPatch(m, { loudness: { target: -40 } }).errors, validateLook({ render: { loudness: { target: -40 } } })); assert.deepEqual(lookErrors(m), []); - assert.equal(LOOK_KEYS.length, 20); + assert.equal(LOOK_KEYS.length, 21); }); test("render.mode and render.basic: deck is the default (no key), basic the footage alone; the fades checked", () => { diff --git a/common/package.json b/common/package.json @@ -62,6 +62,7 @@ "./lib/heavyQueue.mjs": "./lib/heavyQueue.mjs", "./lib/report/drafted.mjs": "./lib/report/drafted.mjs", "./lib/report/look.mjs": "./lib/report/look.mjs", + "./lib/report/gapCue.mjs": "./lib/report/gapCue.mjs", "./lib/report/vertical.mjs": "./lib/report/vertical.mjs", "./lib/report/intro.mjs": "./lib/report/intro.mjs", "./lib/report/fxParams.mjs": "./lib/report/fxParams.mjs", diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -1,6 +1,23 @@ # Changelog ## [Unreleased] +- **umtool: a small mark where a clip skips time.** + - With `render.gapCue.mark` on, each join a clip's gap leaves shows `» 27 s` (from a minute `» 1:12`) near a + corner of the footage for about a second, fading in and out. There is no sound, flash or wipe. Gaps under 2 s + draw nothing, and joins closer together than the mark's life are one mark that adds up their seconds. + - It is drawn after hidden regions and the blur, at a corner the layout leaves free: the deck's footage bottom + left, the plain cut's picture top left, and the safe area's top right in a 9:16 full-bleed clip. When a hidden + region or a code is in that corner while the mark is up, the mark moves to the next free corner. + - The settings layer from broad to narrow: the project's `render.gapCue` (`umtool look <p> gapCue='{"mark":true}'`, + and a preset, style or take patch carries it), then a clip's `gapCue` (`umtool set <p> <clip> gapCue.mark=…`), + then a gap's own `mark` (`gap.mark=<sec>:off`). The label is a setting (`gapCue.label='{s} later'`), as are the + minimum length and the corner. A gap may also record `why` (`dead-air` or `other`). Nothing draws it yet. + - It is off by default, and a cut that sets nothing renders byte for byte as before. Turning it on re-renders + only the segments of clips that have a marked gap. Montages, basic mode and Export one clip draw no mark. +- **umtool: `take --at` lands on the right clip after a clip with gaps.** When the window was timed by the + manifest's estimates, a clip counted at its whole cut span, gaps included. A window aimed at the clip after it + then landed earlier by the gaps' total and rendered the gapped clip instead. The estimate now counts the seconds + that play, as the build and Play the cut do. - **A fetch the platform refused for one video now records why.** - The chat replay pass (`fetch-chat`, the chat backlog, find-clips) and `refresh-metadata` used to drop a refusal such as "Join this channel to get access to members-only content". A stream backfilled "public" while it was diff --git a/umtool/app/api/report/window/route.ts b/umtool/app/api/report/window/route.ts @@ -83,6 +83,11 @@ export async function PUT(request: Request) { "gaps", "gapAdd", "gapRemove", + // One gap's own settings, its seconds as they are (`gapEdit`: {at, mark?, why?}, a key null drops it), + // and the mark at this clip's gaps' joins (`gapCue`: {mark?, min?, corner?, label?}, null clears it; + // common lib/report/gapCue.mjs). + "gapEdit", + "gapCue", // Whether the walk has looked at this clip: "confirmed", "incorrect" (a // fact error, with its correction), "rejected" (with its `reason` and an // optional `rejectNote`), or empty to clear it (lib/report/rejectReasons.mjs). diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md @@ -53,9 +53,9 @@ Inbox cannot disagree about what is wrong with one. | `reads <project> replace <from> <to> [--case] [--word] [--say-only] [--only <id>,…] [--dry-run] [--json]` · `reads <project> undo [--dry-run]` | **Replace**, two scopes, neither synthesizing and neither touching what is shown (operator ruling 3; `lib/report/readsReplace.mjs`): **these reads** rewrites the matched reads' spoken text in ONE undo point (`auto-before-reads-replace`) — a post's script (marked for reading), a screen line's said-as (made when it has none), a card's narration; a parent, the quoted or a linked post is said as shown (only `--say-only` changes it); a recorded read is never replaced; the preview names what a changed post loses (its approval, as a new script takes it), a card's review verdict given on the old words, and what the build would refuse (refused whole). **`--say-only`: everywhere, from now on** — a pronunciation entry (`posts say add`'s writer): every read of a post says it that way; whole words; never a card. `undo` takes back the newest replace -- These reads only while the draft is still exactly what it left (a re-read landing or any edit since: refused, said why), an Everywhere back to the entry it changed (its spoken form and note) or the entry it added removed; `--dry-run` says which, or why not. A flag a subcommand does not take is refused; `--` ends the flags. | | `reads <project> reread [--stale] [--only <id>,…] [--wait [--timeout <s>]] [--dry-run] [--json]` · `reads <project> queue [--stop] [--retry <id>] [--json]` · `reads <project> pick --new|--old [--only <id>,…] [--dry-run] [--json]` | **the re-read queue** (`lib/report/readsQueue.mjs`): the stale reads (or `--only` those) queued on the app's durable queue (`umtool queue ls`), ONE step per item in cut order, none waiting on another — `reads <p> reread --one <item> --only <ids>`, which judges the item again and runs the item's bench command (`readAgainArgv.mjs`: a post's take as the bench asks it, `--bench-slurs`; a thread piece's `--for`/`--tuned … reading:next`; a card's own reading), the tuning a plain press asks (only what the line owned). The editor's `tts-file` jobs, one at a time; render mode holds them. A re-read joins its list UNPICKED. `queue` says each row's state and, in one sentence, why they wait; `--stop` cancels what has not started; `--retry` puts one back. `pick --new` makes every unpicked re-read play, `--old` goes back to what played before (a card: its old words and reading) — one undo point. | | `present <project> [--take <take> \| --cut] [--json] [--public] [--open] [--url <origin>]` | **present mode**: the cut as slides, navigated like a deck (`/projects/<p>/present`) — prints the address and every slide (its kind, id — a post's `<channel>/<id>`, a clip's id, `section-<n>`, `day-<YYYY-MM-DD>` — date, words and censor counts); `--json` the payload (each post's card as Play draws it and its censor data by kind, each clip's spans, the dividers); `--public` the payload a public page would carry (censored, no reveal data); `--open` opens it; `<address>#<slide id>` opens a slide ([knobs.md](knobs.md#present-mode-the-cut-as-slides-navigated-like-a-deck)) | -| `set <project> <clip> key=value …` | a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)); on ANY entry (a post item, a still, a clip) `hideModules=diet,streak`, `shelfNote='…'` and `chapter='…'` (its name in the chapter list, one line of at most 100 characters; `chapter=` none); `--take <t>` writes the entry knobs into that take's patch; `key=` clears one ([knobs.md](knobs.md#marks)) | +| `set <project> <clip> key=value …` | a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)), its **gaps** `gap.add=12.3-15.1` `gap.remove=<sec>` `gaps=…` and a gap's own `gap.mark=<sec>:on|off|default` `gap.why=<sec>:dead-air|other|default`, the **mark at its gaps' joins** `gapCue.mark=true` `gapCue.min` `gapCue.corner` `gapCue.label` over the project's `render.gapCue` (`gapCue=` clears it; [knobs.md](knobs.md#gaps-inside-a-clip)); on ANY entry (a post item, a still, a clip) `hideModules=diet,streak`, `shelfNote='…'` and `chapter='…'` (its name in the chapter list, one line of at most 100 characters; `chapter=` none); `--take <t>` writes the entry knobs into that take's patch; `key=` clears one ([knobs.md](knobs.md#marks)) | | `intro <project> [key=value …] [--off] [--json]` · `intro <project> --take <take> --off\|--on` | **the intro** the cut opens on (`render.intro`): with no key, prints it as written, what the cut opens with (a `title-card`'s words resolved) and each version's on/off; `key=value` writes it through the look writer (`style` `seconds` 3.5–8 `mark` `ground` `sound` (`false` silent) `site` `title` `lines` (`a\|b`, ≤ 3) and the brand's keys; `key=` clears one; a new intro starts as `boot-dark`); `--off` takes it off the cut; `--take <t> --off` that version opens on no intro (its patch's `render.intro: null`), `--on` on the cut's again. **Exit 1** on a value the build refuses ([knobs.md](knobs.md#the-intro-played-and-edited)) | -| `look <project> key=value … [--unset render.<key>]… [--take <t>]` | the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2** | +| `look <project> key=value … [--unset render.<key>]… [--take <t>]` | the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\|label\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades), `gapCue=<json>` (the mark at the joins clips' gaps leave, `{"mark":true}`; [knobs.md](knobs.md#gaps-inside-a-clip)) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2** | | `variants <project> [--take <t>] [--list] [--json]` | **Make variants**: the encode ladder of the build (or of a take's); `--list` what was made and the build's sync report, each clip's lag (past a frame flagged) ([knobs.md](knobs.md)) | | `corrections <project>` | what the report got wrong (the clip bench's sixth field) and the walk's coverage, as markdown for the next pass | | `build <project> [--preset preview\|fast\|final] [--only ID]` | **prints** the chain | diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -40,7 +40,8 @@ that generates it ([notes.md](notes.md)). | `chapter` — the entry's name in the chapter list (`out/…chapters`, `youtube.txt`, `umtool export --format chapters`): one line of at most 100 characters. An authored `chapter` wins over the entry's on-screen title (under the deck) and the line derived from its record; without one the list is as before. Any entry, a post item too | — | `umtool set <p> <entry> chapter='The weigh-in'` (`chapter=` clears it; `--take <t>` writes the take's patch, the project's manifest untouched) | — | | `fx.zoom` — `{shot, focus, at?, hold?}`: a screenshot (a file in the project; a bare name under its `shots/` is written as `shots/<name>`) that comes up over the footage and pushes in on `focus` (`[left, top, right, bottom]`, fractions of the shot) — drawn once `render.chrome.fx.zoom` is on ([Effects](#effects)). **How long it stays**: up 0.2 s into the clip's clean span (rising in over 0.38 s), its focus box drawn 0.55 s later, the push at `at` (seconds into the clip; default as soon as the box has drawn) over 1 s, then a slow drift on the detail; it leaves with a 0.3 s fade 0.3 s before the clip's clean span ends — or, with `hold` (0.5–10 s), that long after the push lands (never past the clip's own leave) | — | `umtool set <p> <clip> fx.zoom='{"shot":"shots/x.png","focus":[0.1,0.2,0.9,0.4],"at":5.9,"hold":4}'` (`fx.zoom=` clears it) | `PUT /api/report/window {project, clip, "fx.zoom": {…} \| null}` | | `fx.receipts`, `fx.punch`, `fx.quote`, `fx.punchIn`, `fx.speakers` — the clip's other effect fields (`[{shot, mark?, at?, hold?, label?}]` 1–4, `at` the source second a receipt flies in at (default: as the clip comes up), `hold` 0.5–10 s it stays once landed (on every one: they leave then, not with the clip), `label` a line of at most 80 characters in a band under the screenshot (when it was taken, what it is); the words to punch; `false`: no line; 1–8 source seconds inside the clip; `[{at, who: 0\|1}]`), each inert until its effect is on; `fx` is all of them at once. Checked by the build's own `validateFxEntries` | — | `fx.punch="the words"` `fx.punchIn='[231.4]'` · `fx='{…}'` sets them all, `fx=` clears every one | `PUT /api/report/window {project, clip, fx}` (or one `"fx.<field>"`) | -| `gaps` — `[{from, to}]`, SOURCE seconds cut out of the clip's middle: it renders as ONE segment of jump cuts (one pip, one card), not two clips with a crossfade ([below](#gaps-inside-a-clip)) | clip bench (Edit this clip), the waveform: **Select a gap** (`g`) or Alt + drag a span, **Cut gap** (`g`), **Hear it**; a click on a gap's band puts it back (`G`: the one at the playhead); **Undo** | `umtool window <p> <clip> --gap 12.3-15.1` (repeatable) · `--gap-remove 12.3` · `--gaps '12.3-15.1,20-20.6'` (`--gaps ''` clears) · `umtool set <p> <clip> gap.add=12.3-15.1 gap.remove=12.3 gaps=` | `PUT /api/report/window {project, clip, token, gapAdd \| gapRemove \| gaps}` | +| `gaps` — `[{from, to}]`, SOURCE seconds cut out of the clip's middle: it renders as ONE segment of jump cuts (one pip, one card), not two clips with a crossfade ([below](#gaps-inside-a-clip)) | clip bench (Edit this clip), the waveform: **Select a gap** (`g`) or Alt + drag a span, **Cut gap** (`g`), **Hear it**; a click on a gap's band puts it back (`G`: the one at the playhead); **Undo** | `umtool window <p> <clip> --gap 12.3-15.1` (repeatable) · `--gap-remove 12.3` · `--gaps '12.3-15.1,20-20.6'` (`--gaps ''` clears) · `umtool set <p> <clip> gap.add=12.3-15.1 gap.remove=12.3 gaps=` · a gap's own: `gap.mark=12.3:off` `gap.why=12.3:dead-air` (`…:default` drops it) | `PUT /api/report/window {project, clip, token, gapAdd \| gapRemove \| gaps \| gapEdit}` | +| `gapCue` — `{mark?, min?, corner?, label?}`: the mark at this clip's gaps' joins, over the project's `render.gapCue` ([below](#gaps-inside-a-clip)) | — | `umtool set <p> <clip> gapCue.mark=true gapCue.corner=tr` (`gapCue=` clears it) | `PUT /api/report/window {project, clip, token, gapCue}` | `key=` (nothing after the `=`) clears a knob; in umtool, **Clear** beside a field (Audio: **Clear all**). A claim's knobs are read from the clip that **stamps** it — the last clip carrying the claim id; the box on any other @@ -213,6 +214,23 @@ seconds (`report-to-video/gaps.mjs` is the rule and both clocks). - **The bench** draws each gap as a hatched band on the waveform (and on the cue rail); every playback there skips them as the cut will. Gap writes go through the one window writer at once (not drafted like the edges), each an undo point (`auto-before-gaps`: `umtool timeline <p> undo`), and **Undo** beside them writes the list back. +- **The mark at the join** (`render.gapCue`, off by default; common `lib/report/gapCue.mjs` is the rule, + `report-to-video/gap-mark.mjs` draws it): with `mark` on, each join a gap of `min` seconds or more (default 2) leaves + shows a small `» 27 s` (`label`, `{s}` the time skipped, from a minute `1:12`) near a corner of the footage for + 1.1 s -- up over 0.15 s, held, down over 0.35 s; IBM Plex Mono Bold, 2.4 % of the frame's short side (26 px at 1080), + the palette's fg on its bg at 55 %; no sound. Joins less than 1.1 s apart are ONE mark saying their seconds + together. It is drawn into the clip's segment after its hidden regions and its blur (chrome over the footage, + never blurred), at the layout's free corner (`corner: auto`): the deck's footage bottom left (its stamp stands top + left, its posts top right), the plain cut's picture top left (never the corner code's corner), a vertical clip's + picture top left (framed, quote), its foot (split) or the safe area's top right (full bleed, desktop); a hidden + region up while the mark is, or a code, under that corner moves it to the next free one. Precedence: a gap's own + `mark` over its clip's `gapCue` over `render.gapCue` (a look key: a preset, a style or a take patch carries it -- + `umtool look <p> gapCue='{"mark":true}'`, `umtool take <p> --id marks --set render.gapCue.mark=true`). A gap may + say `why` (`dead-air` | `other`): nothing draws it yet. Turning it on re-renders only the segments of clips with a + marked gap of `min` or more, and the chunks over them; off, unset or under `min`, every segment is byte for byte + what it was (its key is the same). Not drawn: a montage (it applies no gaps), `render.mode: basic` and **Export + one clip** (the footage alone), Play the cut (not yet); a trailer beat cut across a marked join plays the master's + mark. The record says where each was drawn (`gapMarks` in `segments/<id>.cut.json`). - **Play the cut** plays the clip as one item: its sound one span per kept piece on the cut's clock with the same fades, the picture past the gap at the join, the clock and the scrub bar in cut seconds, a dashed tick on the reel strip at each jump. @@ -2897,6 +2915,7 @@ filter. A knob absent is its default, and a module whose knobs are all absent dr | [Teaser](#teaser) `teaser` | A full-frame card of lines popping in on the beat, inserted as its own segment. (a segment cut into the timeline) | -- | | [Intro](#intro) `intro` | The brand sting the cut opens with, a site's name swapped in on the chime. (a segment cut into the timeline) | `render.intro` | | [Blur](#blur) `blur` | A clip's picture blurred at its encode, a caption on it, the sound as recorded. (a filter on the footage) | `render.blur` | +| [Gap mark](#gap-mark) `gap-cue` | A small mark at each join a clip's gap leaves, saying how much was skipped. (a filter on the footage) | `render.gapCue` | | [Posts feed](#posts-feed) `feed` | The cut's posts in a column beside the footage, each ticking in as its clip starts. (a page over the whole cut) | `render.chrome.deck.posts` | | [Popup posts](#popup-posts) `popup-posts` | A clip's posts as cards over the footage, each window its own short page at its own second. (pages at their own seconds) | `render.chrome.deck.posts` | | [Stamps](#stamps) `stamp` | Each counted mark's word, stamped over the footage as it lands. (a page over the whole cut) | `render.chrome.factcheck.stamp` | @@ -3061,6 +3080,19 @@ The full reference is [A clip's picture, blurred](#a-clips-picture-blurred). | `render.blur` | `on` · `off` (the uncensored variant) · default `on` | `umtool look <p> blur=off` | | a clip's `blur` | `{on, caption?, strength?, from?, to?}` -- caption ≤ 120, strength 2–15 (default 5) | `umtool set <p> <clip> blur.on=true` | +### Gap mark + +The full reference is [Gaps inside a clip](#gaps-inside-a-clip) (the mark at the join). + +| Knob | Range · default | From a terminal | +|---|---|---| +| `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.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`), at most 40 characters · default `» {s}` | `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=` clears them) | +| a gap's `mark`, `why` | `mark` `true` · `false` (over the clip's and the project's); `why` `dead-air` · `other` (draws nothing yet) | `umtool set <p> <clip> gap.mark=12.3:off gap.why=12.3:dead-air` (`…:default` drops it) | + ### Posts feed `deck.posts.layout: "feed"` with posts to draw: a column for the whole cut, each post ticking in as its clip starts; no hold, no footage move. Shares `deck.posts` with the popup posts. diff --git a/umtool/lib/cli/groups.mjs b/umtool/lib/cli/groups.mjs @@ -347,7 +347,7 @@ export const GROUPS = [ ], docs: [ ["`set <project> <clip> key=value …`", - "a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)); on ANY entry (a post item, a still, a clip) `hideModules=diet,streak`, `shelfNote='…'` and `chapter='…'` (its name in the chapter list, one line of at most 100 characters; `chapter=` none); `--take <t>` writes the entry knobs into that take's patch; `key=` clears one ([knobs.md](knobs.md#marks))"], + "a clip's **knobs**: `claim.at` `claim.hold` `claim.stamp` `claim.count` `claim.label` (the first mark's, or `--mark <id>`'s), its **marks** `mark.add=<verdict>[@<sec>]` `mark.remove=<id>` `mark.verdict=<verdict>` `marks=<json>`, `audio.offset` `audio.gain` `audio.fadeIn` `audio.fadeOut`, its picture's **blur** `blur.on=true` `blur.caption=…` `blur.strength` `blur.from` `blur.to` (`blur.on=` clears it; [knobs.md](knobs.md#a-clips-picture-blurred)), its **effects** `fx.zoom=<json>` `fx.receipts=<json>` `fx.punch=…` `fx.quote` `fx.punchIn=<json>` `fx.speakers=<json>` (`fx=<json>` all of them, `fx=` clears them; a shot is a file in the project; [knobs.md](knobs.md#effects)), its **gaps** `gap.add=12.3-15.1` `gap.remove=<sec>` `gaps=…` and a gap's own `gap.mark=<sec>:on|off|default` `gap.why=<sec>:dead-air|other|default`, the **mark at its gaps' joins** `gapCue.mark=true` `gapCue.min` `gapCue.corner` `gapCue.label` over the project's `render.gapCue` (`gapCue=` clears it; [knobs.md](knobs.md#gaps-inside-a-clip)); on ANY entry (a post item, a still, a clip) `hideModules=diet,streak`, `shelfNote='…'` and `chapter='…'` (its name in the chapter list, one line of at most 100 characters; `chapter=` none); `--take <t>` writes the entry knobs into that take's patch; `key=` clears one ([knobs.md](knobs.md#marks))"], ], }, { @@ -372,7 +372,7 @@ export const GROUPS = [ ], docs: [ ["`look <project> key=value … [--unset render.<key>]… [--take <t>]`", - "the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\\|label\\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2**"], + "the cut's **knobs** (`--take <t>`: the `deck.*` keys given are set on that take -- its patch, an undo point of its own, the project's manifest untouched; the other knobs are the project's): `factcheck.stamp.*`, `factcheck.verdicts.<V>.stampLabel\\|label\\|color`, `deck.markers=<json>`, `deck.markerLayout`, `variants=<json>`, and the look's keys — `mode=basic\\|deck` (the footage alone, [knobs.md](knobs.md#basic-output-the-footage-alone)) and `basic=<json>` (its fades), `gapCue=<json>` (the mark at the joins clips' gaps leave, `{\"mark\":true}`; [knobs.md](knobs.md#gaps-inside-a-clip)) among them ([knobs.md](knobs.md)) **The deck on, legacy keys off** (`updateRenderKeys`, one write, an undo point `revisions/…auto-render-keys…` first): `chrome.layout=deck` turns the deck on (render.chrome created when the cut has none: engine hyperframes, an empty deck), `--unset render.<key>` (repeatable) drops a legacy render key -- only `rail` `chromeEngine` `railEngine` `chromeRegions` `claimSchedule` `wordmark` `title` `finale` `cut`; the deck beside the old rail is refused in the build's words unless the same command drops it; deck.* keys in the same command land after the chrome exists. Another key named: **exit 2**"], ], }, { diff --git a/umtool/lib/report/gaps-writer.test.mjs b/umtool/lib/report/gaps-writer.test.mjs @@ -127,6 +127,43 @@ test("splitClip: each half keeps the gaps on its side; a split inside a gap is r assert.deepEqual((await clip(dir, "c01")).gaps, [{ from: 14, to: 15 }, { from: 24, to: 25 }]); }); +test("the mark at the joins: a gap's own mark and why (gap.mark=, gap.why=, gapEdit), the clip's gapCue (gapCue.*), the project's (umtool look gapCue=)", async () => { + const dir = await project(); + const lines = []; + const io = { root: ROOT, out: (s) => lines.push(s), err: (s) => lines.push(`ERR ${s}`) }; + const run = (...args) => setCommand(args, io); + const name = path.basename(dir); + assert.equal(await run(name, "c01", "gap.add=15-17", "gap.add=20-21"), 0); + assert.equal(await run(name, "c01", "gap.mark=16:off", "gap.why=20.5:dead-air"), 0); + assert.deepEqual((await clip(dir, "c01")).gaps, [{ from: 15, to: 17, mark: false }, { from: 20, to: 21, why: "dead-air" }]); + assert.match(lines.at(-1), /c01: gaps 15–17 \(mark off\), 20–21 \(dead-air\)/); + // Another gap added keeps theirs; default drops one; its seconds never move. + assert.equal(await run(name, "c01", "gap.add=24-25", "gap.mark=16:default"), 0); + assert.deepEqual((await clip(dir, "c01")).gaps, [{ from: 15, to: 17 }, { from: 20, to: 21, why: "dead-air" }, { from: 24, to: 25 }]); + assert.equal(await run(name, "c01", "gap.mark=19:on"), 1, "no gap at 19"); + assert.equal(await run(name, "c01", "gap.why=20.5:boring"), 2); + // The clip's own settings, merged; one cleared; all cleared. + assert.equal(await run(name, "c01", "gapCue.mark=true", "gapCue.corner=tr", "gapCue.label={s} later"), 0); + assert.deepEqual((await clip(dir, "c01")).gapCue, { mark: true, corner: "tr", label: "{s} later" }); + assert.equal(await run(name, "c01", "gapCue.corner="), 0); + assert.deepEqual((await clip(dir, "c01")).gapCue, { mark: true, label: "{s} later" }); + assert.equal(await run(name, "c01", "gapCue.min=99"), 1); + assert.match(lines.at(-1), /^ERR gapCue\.min is seconds from 0\.5 to 60/); + assert.equal(await run(name, "c01", "gapCue="), 0); + assert.equal("gapCue" in (await clip(dir, "c01")), false); + // The window route's gapEdit, through the one writer: an undo point, as every gap write. + const r = await updateClip(dir, "c01", { gapEdit: { at: 24.5, mark: true } }); + assert.deepEqual(r.entry.gaps[2], { from: 24, to: 25, mark: true }); + assert.ok(r.snapshot, "an undo point first"); + // The project's: a look key. + const { lookCommand } = await import("./knobsCli.mjs"); + assert.equal(await lookCommand([name, 'gapCue={"mark":true,"min":4}'], io), 0); + assert.deepEqual((await read(dir)).render.gapCue, { mark: true, min: 4 }); + assert.equal(await lookCommand([name, 'gapCue={"min":null}'], io), 0); + assert.deepEqual((await read(dir)).render.gapCue, { mark: true }); + assert.equal(await lookCommand([name, 'gapCue={"corner":"middle"}'], io), 1); +}); + test("umtool set: gap.add=, gap.remove=, gaps= (a list, JSON, or empty); timeline ls shows them", async () => { const dir = await project(); const lines = []; diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs @@ -54,14 +54,16 @@ const REVIEW_KEYS = ["verdict", "reason", "rejectNote", "correction"]; /** The clip's effects (report-to-video fx.mjs): `fx=<json>` whole (`fx=` clears it), `fx.<field>=<json>` one field. */ const FX_KEYS = ["fx", ...FX_ENTRY_FIELDS.map((k) => `fx.${k}`)]; /** Seconds taken out of the clip's middle (gaps.mjs): the whole list, one added, one removed. */ -const GAP_KEYS = ["gaps", "gap.add", "gap.remove"]; +const GAP_KEYS = ["gaps", "gap.add", "gap.remove", "gap.mark", "gap.why"]; +/** The mark at this clip's gaps' joins (common gapCue.mjs): its own settings over the project's render.gapCue. */ +export const GAP_CUE_SET_KEYS = Object.freeze(["gapCue", "gapCue.mark", "gapCue.min", "gapCue.corner", "gapCue.label"]); export const VERTICAL_SET_KEYS = Object.freeze(["vertical", "vertical.crop", "vertical.layout", "vertical.aspect", "vertical.crops"]); export const SIDE_SET_KEYS = Object.freeze(["side", "side.item", "side.post", "side.from", "side.to", "side.place"]); /** The clip kit (lane clip-kit; report-to-video clip-kit.mjs): a clip's code in a per-clip build, its batch file name. */ export const KIT_SET_KEYS = Object.freeze(["qr", "qr.corner", "qr.links", "name", "promo", "promo.lead", "promo.fade", "promo.hold", "zooms", "coldOpen", "coldOpen.from", "coldOpen.to", "censor", "censor.boxes", "censor.style", "censor.strength", "censor.from", "censor.to"]); const SET_KEYS = [ "claim", ...CLAIM_KNOBS.map((k) => `claim.${k}`), ...MARK_KEYS, ...AUDIO_KNOBS.map((k) => `audio.${k}`), ...BLUR_KNOBS.map((k) => `blur.${k}`), "layout", ...REVIEW_KEYS, - ...FX_KEYS, ...GAP_KEYS, "chat", "hideModules", "shelfNote", "chapter", + ...FX_KEYS, ...GAP_KEYS, ...GAP_CUE_SET_KEYS, "chat", "hideModules", "shelfNote", "chapter", // The vertical format (lane vertical): the clip's 9:16 crop and layout, and its side post. ...VERTICAL_SET_KEYS, ...SIDE_SET_KEYS, // The clip kit (lane clip-kit): its code and its name in a batch of shorts. @@ -134,6 +136,10 @@ export const SET_USAGE = [ " gap.add=12.3-15.1 cuts those source seconds out of the clip's middle (one segment of jump cuts; inside", " the cut, ≥ 0.2 s, 0.5 s kept between); gap.remove=<sec> the gap holding it; gaps=12.3-15.1,20-20.6 (or", " a JSON list of {from,to}) the whole list, `gaps=` none. The same as `umtool window --gap/--gap-remove/--gaps`.", + " gap.mark=<sec>:on|off|default marks (or not) the join of the gap holding <sec>, over the clip's and the", + " project's; gap.why=<sec>:dead-air|other|default says what it was cut for (its seconds never move).", + " gapCue.mark=true|false gapCue.min=<s> gapCue.corner=auto|tl|tr|bl|br gapCue.label='» {s}' the mark at this", + " clip's gaps' joins, over the project's (umtool look <p> gapCue='{\"mark\":true}'); `gapCue=` clears them.", ].join("\n"); export const LOOK_USAGE = [ @@ -296,6 +302,7 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso } if (GAP_KEYS.includes(key)) { if (key === "gap.add") (entryPatch.gapAdd ??= []).push(String(value ?? "")); + else if (key === "gap.mark" || key === "gap.why") (entryPatch.gapEdit ??= []).push(gapEditOf(key, value)); else if (key === "gap.remove") entryPatch.gapRemove = Number(value); else if (value === null || (Array.isArray(value) && !value.length)) entryPatch.gaps = []; else if (Array.isArray(value)) entryPatch.gaps = value; @@ -306,6 +313,16 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso } continue; } + if (GAP_CUE_SET_KEYS.includes(key)) { + if (key === "gapCue") { + if (value !== null && !(value && typeof value === "object")) throw new CliError("gapCue= clears the clip's own; gapCue='{\"mark\":true}' sets them"); + entryPatch.gapCue = value; + } else { + const k = key.slice("gapCue.".length); + entryPatch.gapCue = { ...(entryPatch.gapCue && typeof entryPatch.gapCue === "object" ? entryPatch.gapCue : {}), [k]: k === "label" && value !== null ? String(value) : value }; + } + continue; + } if (key === "claim") { // The clip's claim pin, off (owed 6 Nov: there was no way to take one off but a hand edit). Only clearing: // a claim is added as a mark (mark.add=<verdict>[@<s>]), its id and verdict edited in the On-screen table. @@ -378,7 +395,8 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso if (Object.keys(entryPatch).some((k) => k === "censor" || k.startsWith("censor."))) results.censor = result.entry.censor ?? null; if (["coldOpen", "coldOpen.from", "coldOpen.to"].some((k) => k in entryPatch)) results.coldOpen = result.entry.coldOpen ?? null; if (FX_KEYS.some((k) => k in entryPatch)) results.fx = result.entry.fx ?? null; - if ("gaps" in entryPatch || "gapAdd" in entryPatch || "gapRemove" in entryPatch) { + if ("gapCue" in entryPatch) results.gapCue = result.entry.gapCue ?? null; + if ("gaps" in entryPatch || "gapAdd" in entryPatch || "gapRemove" in entryPatch || "gapEdit" in entryPatch) { results.gaps = result.entry.gaps ?? []; } if (REVIEW_KEYS.some((k) => k in entryPatch)) { @@ -420,7 +438,11 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso if ("zooms" in results) out(`${clipId}: zooms ${results.zooms ? results.zooms.map((z) => `${z.at} s ×${z.scale ?? (z.box ? "box" : 1.3)}`).join(", ") : "none"}`); if ("promo" in results) out(`${clipId}: promo ${results.promo === false ? "none (it ends without the card)" : results.promo ? JSON.stringify(results.promo) : "the cut's"}`); if ("name" in results) out(`${clipId}: name ${results.name ? JSON.stringify(results.name) : "its title's slug"}`); - if ("gaps" in results) out(`${clipId}: ${results.gaps.length ? `gaps ${results.gaps.map((g) => `${g.from}–${g.to}`).join(", ")}` : "no gaps (the cut plays whole)"}`); + if ("gaps" in results) { + const own = (g) => [typeof g.mark === "boolean" ? `mark ${g.mark ? "on" : "off"}` : "", g.why ?? ""].filter(Boolean).join(", "); + out(`${clipId}: ${results.gaps.length ? `gaps ${results.gaps.map((g) => `${g.from}–${g.to}${own(g) ? ` (${own(g)})` : ""}`).join(", ")}` : "no gaps (the cut plays whole)"}`); + } + if ("gapCue" in results) out(`${clipId}: gapCue ${results.gapCue ? JSON.stringify(results.gapCue) : "the project's (render.gapCue)"}`); if (results.review) { const r = results.review; out(`${clipId}: ${r.verdict ?? "not reviewed"}${r.reason ? ` (${r.reason}${r.rejectNote ? `: ${r.rejectNote}` : ""})` : ""}${r.correction ? ` — ${r.correction}` : ""}`); @@ -440,6 +462,26 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v); /** + * `gap.mark=<sec>:on|off|default` / `gap.why=<sec>:dead-air|other|default` as a window writer's `gapEdit`. + * + * @param {string} key + * @param {unknown} value + */ +export function gapEditOf(key, value) { + const m = String(value ?? "").trim().match(/^(\d+(?:\.\d+)?)\s*:\s*([a-z-]+)$/i); + const field = key === "gap.mark" ? "mark" : "why"; + const choices = field === "mark" ? "on|off|default" : "dead-air|other|default"; + if (!m) throw new CliError(`${key}=${value ?? ""}: <a source second inside the gap>:${choices}`); + const word = m[2].toLowerCase(); + let v; + if (word === "default") v = null; + else if (field === "mark" && (word === "on" || word === "off")) v = word === "on"; + else if (field === "why" && (word === "dead-air" || word === "other")) v = word; + else throw new CliError(`${key}=${value}: ${word} is not one of ${choices}`); + return { at: Number(m[1]), [field]: v }; +} + +/** * One `blur.*` assignment into the blur patch: a caption is text whatever it * parses as (`blur.caption=2025` is the words "2025"); `blur.on=true` turns it * on; the numbers as given (the writer refuses what the build would). diff --git a/umtool/lib/report/look.test.mjs b/umtool/lib/report/look.test.mjs @@ -46,7 +46,7 @@ const read = async (dir) => JSON.parse(await readFile(path.join(dir, MANIFEST_NA test("updateRender: the look's keys only, null removes one, the build's checks refuse a bad value", async () => { const p = await project({ transition: 0.4, crf: 21 }); try { - assert.deepEqual(LOOK_KEYS, ["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical", "mode", "basic", "tallWindows", "desktop", "promo", "zooms", "censor"]); + assert.deepEqual(LOOK_KEYS, ["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical", "mode", "basic", "tallWindows", "desktop", "promo", "zooms", "censor", "gapCue"]); const token = await manifestToken(p.dir); const r = await updateRender(p.dir, { headerHeight: 0, footerHeight: 0, qr: false, transition: 0.5, transitionStyle: "fadeblack", diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -60,7 +60,8 @@ import { counterOrder } from "umtool-report-to-video/counter"; import { validateFinaleEntries } from "umtool-report-to-video/finale"; import { validateFxEntries } from "umtool-report-to-video/fx"; import { validateClipAudio } from "umtool-report-to-video/clip-audio"; -import { editGaps, parseGapSpec, validateGaps } from "umtool-report-to-video/gaps"; +import { GAP_WHY_VALUES, editGaps, gapOwnKeys, parseGapSpec, validateGaps } from "umtool-report-to-video/gaps"; +import { gapCueErrors, patchGapCue } from "yt-dlp-transcript-common/lib/report/gapCue.mjs"; import { BLUR_CAPTION_DEFAULT, BLUR_STRENGTH, validateClipBlur, validateClipBlurEntries } from "umtool-report-to-video/clip-blur"; import { CLAIM_KNOBS, CLAIM_MARKS_MAX, claimKnobsOf, claimKnobValue, freshMarkId, marksCopyOf, normalizeClaimKnobPatch, rawMarksOf, setMarks, stampingEntryId, @@ -309,7 +310,7 @@ export async function updateClip(dir, clipId, patch, { token = null, edit = "tri } /** The patch keys that edit a clip's gaps (patchClipEntry, "gaps inside the clip"). */ -export const GAP_PATCH_KEYS = Object.freeze(["gaps", "gapAdd", "gapRemove"]); +export const GAP_PATCH_KEYS = Object.freeze(["gaps", "gapAdd", "gapRemove", "gapEdit"]); /** * Set an entry's `hideModules` (deck.mjs parseHideModules: a list, or "diet,streak"); null, "" or [] removes it. @@ -700,7 +701,7 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n // the gap holding a source second. Then the rule (validateGaps, the build's own check) on the // entry AFTER the patch, as for the mute mark: a window, cut or mark save // that leaves a gap outside the cut, or a mark inside a gap, is refused. - if (patch.gaps !== undefined || patch.gapAdd !== undefined || patch.gapRemove !== undefined) { + if (patch.gaps !== undefined || patch.gapAdd !== undefined || patch.gapRemove !== undefined || patch.gapEdit !== undefined) { let list = Array.isArray(entry.gaps) ? entry.gaps : []; if (patch.gaps !== undefined) { const v = patch.gaps; @@ -712,7 +713,10 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n const from = Number(g?.from); const to = Number(g?.to); if (!Number.isFinite(from) || !Number.isFinite(to)) throw new Error(`gaps[${k}] must be { from, to } in source seconds`); - return { from, to }; + // A gap's own mark and why (common gapCue.mjs) ride along, checked as they are. + if (g.mark !== undefined && g.mark !== null && typeof g.mark !== "boolean") throw new Error(`gaps[${k}].mark is true or false`); + if (g.why !== undefined && g.why !== null && !GAP_WHY_VALUES.includes(g.why)) throw new Error(`gaps[${k}].why is one of ${GAP_WHY_VALUES.join(", ")}`); + return { from, to, ...gapOwnKeys(g) }; }), }); } @@ -725,12 +729,19 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n } } if (patch.gapRemove !== undefined) list = editGaps(list, { remove: Number(patch.gapRemove) }); + // `gapEdit: { at, mark?, why? }` (or a list): one gap's own settings, its seconds as they are. + if (patch.gapEdit !== undefined) { + for (const one of Array.isArray(patch.gapEdit) ? patch.gapEdit : [patch.gapEdit]) { + if (!isObj(one)) throw new Error("gapEdit is { at: <a source second inside the gap>, mark?: true|false|null, why?: dead-air|other|null }"); + list = editGaps(list, { edit: one }); + } + } if (list.length) entry.gaps = list; else delete entry.gaps; } if ( entry.gaps !== undefined && - ["start", "end", "cutStart", "cutEnd", "muteFrom", "gaps", "gapAdd", "gapRemove"].some((k) => patch[k] !== undefined) + ["start", "end", "cutStart", "cutEnd", "muteFrom", "gaps", "gapAdd", "gapRemove", "gapEdit"].some((k) => patch[k] !== undefined) ) { const errors = validateGaps(entry, clipId); if (errors.length) throw new Error(errors.join("; ")); @@ -803,6 +814,21 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n if (errors.length) throw new Error(errors.join("; ")); } + // ---- the mark at its gaps' joins (common gapCue.mjs) -------------------- + // + // `gapCue: { mark?, min?, corner?, label? }` -- this clip's, over the + // project's render.gapCue. Merged into what the clip has: a key null drops + // it, `gapCue: null` (or "") drops the block, nothing left is no block. + if (patch.gapCue !== undefined) { + const v = patch.gapCue === "" ? null : patch.gapCue; + if (v !== null && !isObj(v)) throw new Error("gapCue must be { mark?, min?, corner?, label? }, or null to clear it"); + const next = patchGapCue(entry.gapCue, v); + const errors = gapCueErrors(next, "gapCue"); + if (errors.length) throw new Error(errors.join("; ")); + if (next === null) delete entry.gapCue; + else entry.gapCue = next; + } + // ---- how the deck lays this entry out ----------------------------------- // // `layout: "finale"` (the deck's finale layout, render.chrome.deck.finale); diff --git a/umtool/lib/report/takeMaker.mjs b/umtool/lib/report/takeMaker.mjs @@ -50,6 +50,7 @@ import { pathToFileURL } from "node:url"; import { mergePatch } from "umtool-report-to-video/montage-styles"; import { postItemSeconds } from "umtool-report-to-video/post-item"; import { videoSeconds } from "umtool-report-to-video/video-entry"; +import { gappedLength, gapsOf } from "umtool-report-to-video/gaps"; import { cutSlurState } from "umtool-report-to-video/post-slurs"; import { applyMontageRulings, readMontageRulings, rulingsLines } from "umtool-report-to-video/montage-rulings"; import { markKeepFrames } from "umtool-report-to-video/prune-frames"; @@ -245,7 +246,11 @@ export async function loadMontageStyles({ file = montageStylesFile() } = {}) { // The window. // --------------------------------------------------------------------------- -/** An entry's length by the manifest's own numbers: a clip's cut, a post item's rule (post-item.mjs), else `seconds`, else 4 s. */ +/** + * An entry's length by the manifest's own numbers: a clip's cut less its gaps (gaps.mjs: the seconds it plays, as + * the build and Play the cut count it -- not the cut's span, which put a window past a gapped clip that many seconds + * early), a post item's rule (post-item.mjs), else `seconds`, else 4 s. + */ export function estimatedSeconds(e) { if (e?.type === "post") return postItemSeconds(e); // A video entry (video-entry.mjs): its span and its hold (a take's hard cuts: no lead). @@ -253,7 +258,7 @@ export function estimatedSeconds(e) { if (e?.type === "clip") { const a = Number(e.cutStart ?? e.start); const b = Number(e.cutEnd ?? e.end); - if (Number.isFinite(a) && Number.isFinite(b) && b > a) return b - a; + if (Number.isFinite(a) && Number.isFinite(b) && b > a) return gappedLength(a, b, gapsOf(e)); } const s = Number(e?.seconds); return Number.isFinite(s) && s > 0 ? s : 4; diff --git a/umtool/lib/report/takeMaker.test.mjs b/umtool/lib/report/takeMaker.test.mjs @@ -124,6 +124,11 @@ test("windowEntries: by the manifest's own lengths, or by the deck's schedule wh assert.deepEqual(windowEntries(MANIFEST.timeline, { at: 500, dur: 10 }).ids, ["s04"]); // A clip's cut, not its extent, is what plays. assert.deepEqual(windowEntries([clip("a", 0, 100, { cutStart: 10, cutEnd: 12 }), clip("b", 0, 3)], { at: 2.5, dur: 1 }).ids, ["b"]); + // A clip's gaps never play: a window aimed at the clip after a gapped one gets that clip (lane gap-cue: it got the + // gapped one, the window that many seconds early). a is 40 s with 27 s of gaps: it plays 13 s; b 13–16. + const gapped = [clip("a", 0, 40, { gaps: [{ from: 5, to: 30 }, { from: 33, to: 35 }] }), clip("b", 0, 3)]; + assert.deepEqual(windowEntries(gapped, { at: 13.5, dur: 1 }).ids, ["b"]); + assert.equal(windowEntries(gapped, { at: 0, dur: 1 }).total, 16); const schedule = { segments: ["s01", "s02", "s03", "k1", "s04"].map((id, i) => ({ id, start: i * 2, duration: 2 })) }; assert.deepEqual(windowEntries(MANIFEST.timeline, { at: 3, dur: 2 }, schedule), { ids: ["s02", "s03"], basis: "schedule", total: 10, missing: [] }); // A schedule that misses an entry is not trusted -- one built before a clip diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -182,6 +182,9 @@ import { validateFinaleEntries } from "./finale.mjs"; import { fetchPieces, gapFilterParts, gapSeconds, gapsOnSegment, inGap, keptSpans, offsetIn, recordGaps, renderGaps, validateGapEntries, } from "./gaps.mjs"; +// The mark at a gap's join (gap-mark.mjs; the settings and timing: common gapCue.mjs). +import { centredIn, censorAvoidRects, gapMarkFilters, gapMarkPlaces, gapMarkSize, segmentGapJoins, segmentGapMarks } from "./gap-mark.mjs"; +import { clipGapCueOf, gapCueWanted } from "yt-dlp-transcript-common/lib/report/gapCue.mjs"; import { SYNC_FILE, writeSyncReport } from "./sync-report.mjs"; import { validateThreadEntries } from "./threads.mjs"; import { validateFlipEntries } from "./flips.mjs"; @@ -1827,6 +1830,42 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, return { parts, v: "[vcen]" }; }; + // THE GAP MARK (gap-mark.mjs): "» 27 s" at each marked join, drawn over the + // finished picture -- after its hidden regions and its blur: it is chrome, + // not footage. Only when a gap is marked (render.gapCue, the clip's gapCue, + // a gap's own mark: common gapCue.mjs): otherwise none, and every graph and + // record below is the one it always was. + const gapMarks = segGaps.length && gapCueWanted(render, clipE) + ? segmentGapMarks({ + render, entry: clipE, seconds: segSeconds, + joins: segmentGapJoins({ segGaps, clipGaps, segStart: fetchStart + segA, cue: clipGapCueOf(render, clipE), toReal }), + }) + : []; + /** + * The marks' filters for a layout: drawn in `box` (frame px) at its `prefer` + * corner unless the clip's `corner` says, kept off `avoid` (rects over their + * seconds) and the `busy` corners; "" with no marks. Records them. + */ + const markChain = async ({ box, prefer, avoid = [], busy = [] }) => { + if (!gapMarks.length) return ""; + const size = gapMarkSize(width, height); + const places = gapMarkPlaces({ marks: gapMarks, box, want: clipGapCueOf(render, clipE).corner, prefer, size, avoid, busy }); + const files = []; + for (const [k, m] of gapMarks.entries()) { + const file = path.join(outDir, "segments", `${entry.id}.gapmark-${k}.txt`); + await replaceFile(file, m.text); + files.push(file); + } + cutRecord.gapMarks = gapMarks.map((m, k) => ({ at: m.at, until: m.until, seconds: m.seconds, ...(m.count > 1 ? { count: m.count } : {}), text: m.text, corner: places[k].corner })); + return gapMarkFilters({ marks: gapMarks, places, files, size, palette: render.palette }); + }; + /** The picture's hidden regions as rects to keep the mark off: the source `sw` × `sh` (its `region`) shown in `dest`. */ + const censorAvoid = (sw, sh, dest, region = null) => + gapMarks.length && censorRegions.length + ? censorAvoidRects(censorRegions, { sw, sh, region, dest, from: cutRecord.start, gaps: cutRecord.gaps ?? [], seconds: segSeconds }) + : []; + const rectOf = (b) => ({ x: b.x, y: b.y, w: b.w ?? b.width, h: b.h ?? b.height }); + // THE SIDE POST (side-card.mjs): the post a clip carries beside it, up over its `from`-`to`, never read. const sidePost = dirs.sides ? sidePostOf(entry, dirs.sides.timeline) : null; const sideUp = sidePost ? sideSpan(entry.side, segSeconds) : null; @@ -1910,6 +1949,20 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, const qrParts = qrBox ? [`[${qrIdx}:v]scale=${qrBox.size}:${qrBox.size}:flags=neighbor,setsar=1[vqr]`, `[vp0][vqr]overlay=x=${qrBox.x}:y=${qrBox.y}:format=auto[vp]`] : []; + // The gap mark: a framed or quote layout's on its picture (top-left: the hook stands above it), a split's at the + // picture's foot (its tag is at the top), a full-bleed or desktop clip's at the safe area's top right (the tag + // and the hook are at its left); off the code and the hidden regions. + const vbox = rectOf(geo.video); + const vsafe = geo.safe ?? safeArea(render, width, height); + const fullBleed = !["framed", "quote", "split"].includes(geo.layout); + const vpic = geo.video.fill === "fit" + ? { dest: centredIn(vbox, fittedSize(sw, sh, vbox.w, vbox.h)), region: null } + : { dest: vbox, region: pictureRegion(geo, sw, sh, entry.vertical?.crop ?? null).region }; + const mark = await markChain({ + box: fullBleed ? { x: vsafe.x0, y: vsafe.y0, w: vsafe.x1 - vsafe.x0, h: vsafe.y1 - vsafe.y0 } : vbox, + prefer: geo.layout === "split" ? "bl" : fullBleed ? "tr" : "tl", + avoid: [...censorAvoid(sw, sh, vpic.dest, vpic.region), ...(qrBox ? [{ x: qrBox.x, y: qrBox.y, w: qrBox.size, h: qrBox.size }] : [])], + }); // THE CHANNEL PROMO (promo-card.mjs): the last clip of a per-clip build ends on the card -- faded in over the // clip's last seconds, its sound on under it, then held in silence; the captions go on over it, in its band. const promo = promoSpec; @@ -1936,7 +1989,7 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, `${censored(g.v).v}${graph}${qrBox ? "[vp0]" : "[vp]"}`, ...qrParts, ...(promoPart ? promoPart.parts : []), - cap ? `${promoPart ? promoPart.v : "[vp]"}${cap.filter}[v]` : `${promoPart ? promoPart.v : "[vp]"}null[v]`, + `${promoPart ? promoPart.v : "[vp]"}${[cap?.filter, mark].filter(Boolean).join(",") || "null"}[v]`, ].join(";"), "-map", "[v]", "-map", promoPart ? promoPart.a : audioMap, ...encodeArgs(render), @@ -1972,6 +2025,8 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, }) : null; cutRecord.vertical = { layout: "twocrop", crops: twoCrop, width, height, enlarged: grow, ...(cap ? { captions: cap.lines } : {}) }; + // The gap mark at the frame's top right (two crops: their hidden regions are under the crops, not mapped here). + const tmark = await markChain({ box: { x: 0, y: 0, w: width, h: height }, prefer: "tr" }); await encodeClipSegment({ seg, outDir, render, opts, id: entry.id, record: { ...cutRecord, framing: fr }, argv: [ @@ -1982,7 +2037,7 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, ...levelParts(null, g.a), ...censored(g.v).parts, `${censored(g.v).v}${graph}[vp]`, - cap ? `[vp]${cap.filter}[v]` : "[vp]null[v]", + `[vp]${[cap?.filter, tmark].filter(Boolean).join(",") || "null"}[v]`, ].join(";"), "-map", "[v]", "-map", audioMap, ...encodeArgs(render), @@ -2002,7 +2057,13 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, const sideInput = sideGeo ? await sideCard(sideGeo.w, sideGeo.h) : []; const sideIdx = 1 + (pst ? 1 : 0) + (soundInput ? 1 : 0); const cen = pst ? { parts: [], v: "[pic]" } : censored(g.v); - const framed = `${cen.v}${deckFramingFilter(render, { feed: fr.layout === "feed", picture })}`; + // The gap mark at the footage's bottom left as it plays in the box (the stamp stands top left, the posts top + // right, the subtitle and the code in the band below), off its hidden regions. + const fbox = rectOf(fr.box); + const fdims = media.hasVideo && gapMarks.length ? await probeDims(raw) : null; + const fpic = fdims ? centredIn(fbox, fittedSize(fdims[0], fdims[1], fbox.w, fbox.h)) : fbox; + const dmark = await markChain({ box: fpic, prefer: "bl", avoid: fdims ? censorAvoid(fdims[0], fdims[1], fpic) : [] }); + const framed = `${cen.v}${deckFramingFilter(render, { feed: fr.layout === "feed", picture })}${dmark ? `,${dmark}` : ""}`; // The stacked vertical deck's captions (vertical-deck.mjs): under the picture, each word lit, over the frame. const vcap = dirs.vertical?.stacked && dirs.look ? await segmentCaptions({ @@ -2085,9 +2146,19 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes, ? verticalFilters(entry.vertical?.crop ?? null, ...(await probeDims(raw)), { width, height, fps: render.fps }) : null; // The blur on the picture alone (a short's is the whole frame: no header). - const base = shortPicture + const base0 = shortPicture ? [...shortPicture, ...(await blurPicture(width, height))].join(",") : clipBaseFilters({ render, VW, VH, HH, hasHeader, attribPath, channelPath, picture: await blurPicture(VW, VH) }).join(","); + // The gap mark at the picture's top left (the header stands above it, the captions at its foot, the code at a + // bottom corner -- never on the code's corner), off its hidden regions; a short's at its frame's. + const pbox = shortPicture ? { x: 0, y: 0, w: width, h: height } : { x: 0, y: HH, w: VW, h: VH }; + const pdims = media.hasVideo && gapMarks.length && !shortPicture ? await probeDims(raw) : null; + const ppic = pdims ? centredIn(pbox, fittedSize(pdims[0], pdims[1], pbox.w, pbox.h)) : pbox; + const pmark = await markChain({ + box: ppic, prefer: "tl", avoid: pdims ? censorAvoid(pdims[0], pdims[1], ppic) : [], + busy: !render.rail && cornerQrOf(entry, render) ? [cornerQrOf(entry, render).corner] : [], + }); + const base = pmark ? `${base0},${pmark}` : base0; // A manifest with a RAIL draws the code in the rail's foot instead, as one // more strip: bottom-right of the frame, bordered, one per clip. It used to diff --git a/umtool/report-to-video/gap-mark.mjs b/umtool/report-to-video/gap-mark.mjs @@ -0,0 +1,192 @@ +// THE GAP MARK, drawn (lane gap-cue, slice 1): "» 27 s" at the join a clip's +// gap leaves, in the clip's own segment -- after its hidden regions and its +// blur, so the mark is chrome over the footage and never blurred -- by one +// drawtext per mark over its seconds, as a blurred clip's caption is drawn +// (clip-blur.mjs). The settings, the label and the timing are common +// lib/report/gapCue.mjs's, which umtool's pages read too; this file is where +// the mark stands in a frame and the ffmpeg that draws it. +// +// WHERE. In a box the layout names -- the footage as it plays (the deck's +// footage box, the plain cut's picture, a vertical cut's video or safe area) +// -- at a corner `inset` in from its edges: the layout's own free corner +// (`auto`: the deck's stamp stands top-left and its posts top-right, so +// bottom-left; the plain cut's captions sit at its foot and its code at the +// bottom right, so top-left), or the one `corner` says. A hidden region up +// while the mark is, or a code, under that corner moves it to the next free +// one (tl, tr, bl, br); none free, it stays where it was asked. +// +// THE LOOK. IBM Plex Mono Bold (the vendored face: the same mark whatever the +// brand), 2.4 % of the frame's short side (26 px at 1080), the palette's fg on +// its bg at 55 %, faded in and out by `alpha` (GAP_CUE_MOTION), which fades +// the box with the text. No sound. +// +// PURE: no fs, no ffmpeg run. The build writes each mark's text file. +import { GAP_CUE_MOTION, clipGapCueOf, gapCueText, gapCues, gapMarkOn } from "yt-dlp-transcript-common/lib/report/gapCue.mjs"; +import { MONO_BOLD_FONT_FILE } from "./brand.mjs"; +import { offsetIn } from "./gaps.mjs"; + +/** The box behind the text, at full: the palette's bg at this opacity. */ +export const GAP_MARK_BOX_ALPHA = 0.55; +/** Plex Mono's advance, in ems: every glyph the same width. */ +const ADVANCE = 0.6; + +const EPS = 1e-6; +const f3 = (n) => Number(n.toFixed(3)).toString(); + +/** + * The mark's sizes for a `W` × `H` frame: its font size, the box's border + * round the text, and the inset from the box it stands in. + */ +export function gapMarkSize(W, H) { + const s = Math.min(W, H); + const fontSize = Math.max(12, Math.round(s * 0.024)); + return { fontSize, border: Math.round(fontSize * 0.35), inset: Math.max(8, Math.round(s * 0.026)) }; +} + +/** The rect a text of `chars` characters takes with its box, at `size` (gapMarkSize). */ +export function gapMarkRect(chars, size) { + return { w: Math.ceil(chars * ADVANCE * size.fontSize) + 2 * size.border, h: Math.ceil(size.fontSize * 1.2) + 2 * size.border }; +} + +/** + * A segment's JOINS on its own clock, from the gaps it really left out: + * `segGaps` (gaps.mjs gapsOnSegment, seconds from its first frame, before + * the gaps are taken out) and the clip's gaps as the render applies them + * (`clipGaps`, source seconds -- with their own `mark` -- on the clock + * `segStart` is on). `toReal` maps that clock to the recording's (a clip cut + * from its pieces), so the seconds a join says are the recording's. + * + * @param {{ segGaps: Array<{ from: number, to: number }>, clipGaps: Array<{ from: number, to: number, mark?: boolean }>, + * segStart: number, cue: { mark: boolean }, toReal?: (t: number) => number }} o + * @returns {Array<{ at: number, seconds: number, mark: boolean }>} + */ +export function segmentGapJoins({ segGaps, clipGaps, segStart, cue, toReal = (t) => t }) { + let removed = 0; + return (segGaps ?? []).map((g) => { + const a = segStart + g.from; + const b = segStart + g.to; + // The clip's gaps this one is (gapsOnSegment may have joined two that touch on the frame grid). + const own = (clipGaps ?? []).filter((c) => c.to > a - 0.05 && c.from < b + 0.05); + const join = { at: g.from - removed, seconds: toReal(b) - toReal(a), mark: own.length ? own.some((c) => gapMarkOn(cue, c)) : cue.mark }; + removed += g.to - g.from; + return join; + }); +} + +/** + * The marks one segment draws: its joins (segmentGapJoins) under the clip's + * settings (clipGapCueOf: `min`, and `label` for the text). [] when nothing + * is marked -- the segment's graph is then the one it always was. + * + * @param {{ render: any, entry: any, joins: Array<{ at: number, seconds: number, mark: boolean }>, seconds: number }} o + * @returns {Array<{ at: number, until: number, seconds: number, count: number, text: string }>} + */ +export function segmentGapMarks({ render, entry, joins, seconds }) { + const cue = clipGapCueOf(render, entry); + return gapCues(joins, { min: cue.min, seconds }).map((c) => ({ ...c, text: gapCueText(c.seconds, cue.label) })); +} + +const CORNERS = ["tl", "tr", "bl", "br"]; + +/** + * A rect on `box`'s corner `c`, `inset` in. + * + * @param {{ x: number, y: number, w: number, h: number }} box + * @param {string} c + * @param {{ w: number, h: number }} r + * @param {number} inset + */ +function cornerRect(box, c, r, inset) { + const x = c.endsWith("l") ? box.x + inset : box.x + box.w - inset - r.w; + const y = c.startsWith("t") ? box.y + inset : box.y + box.h - inset - r.h; + return { x: Math.round(x), y: Math.round(y), w: r.w, h: r.h }; +} + +const overlaps = (a, b) => a.x < b.x + b.w && b.x < a.x + a.w && a.y < b.y + b.h && b.y < a.y + a.h; + +/** + * The corner each mark stands at: `want` (the clip's `corner`; `auto` is the + * layout's `prefer`), else -- when something to keep clear of (`avoid`: rects + * in the frame, each over `from`–`to` segment seconds, or always) is under + * it while the mark is up -- the next free one in tl, tr, bl, br; none free, + * `want`'s. A corner in `busy` (a code the layout draws there) is never free. + * + * @param {{ marks: Array<{ at: number, until: number, text: string }>, box: { x: number, y: number, w: number, h: number }, + * want: string, prefer: string, size: ReturnType<typeof gapMarkSize>, + * avoid?: Array<{ x: number, y: number, w: number, h: number, from?: number | null, to?: number | null }>, busy?: string[] }} o + * @returns {Array<{ corner: string, rect: { x: number, y: number, w: number, h: number } }>} + */ +export function gapMarkPlaces({ marks, box, want, prefer, size, avoid = [], busy = [] }) { + const first = want === "auto" || !CORNERS.includes(want) ? prefer : want; + const order = [first, ...CORNERS.filter((c) => c !== first)]; + return marks.map((m) => { + const r = gapMarkRect([...m.text].length, size); + const up = avoid.filter((a) => (a.from ?? -Infinity) < m.until - EPS && (a.to ?? Infinity) > m.at + EPS); + for (const c of order) { + if (busy.includes(c)) continue; + const rect = cornerRect(box, c, r, size.inset); + if (!up.some((a) => overlaps(rect, a))) return { corner: c, rect }; + } + return { corner: first, rect: cornerRect(box, first, r, size.inset) }; + }); +} + +/** + * A picture's hidden regions (clip-censor.mjs censorRegionsOf: fractions of + * the SOURCE picture, source seconds) as rects in the frame to keep the mark + * off, over their seconds on the segment's clock: the source picture `sw` × + * `sh`, its part `region` (source px; the whole of it when fitted) shown in + * `dest` (frame px). `from` / `gaps` / `seconds` as censorParts reads them. + */ +export function censorAvoidRects(regions, { sw, sh, region = null, dest, from = 0, gaps = [], seconds = Infinity }) { + const src = region ?? { x: 0, y: 0, w: sw, h: sh }; + return (regions ?? []).map((g) => { + const [bx, by, bw, bh] = g.box; + const x0 = dest.x + ((bx * sw - src.x) / src.w) * dest.w; + const y0 = dest.y + ((by * sh - src.y) / src.h) * dest.h; + const x1 = dest.x + (((bx + bw) * sw - src.x) / src.w) * dest.w; + const y1 = dest.y + (((by + bh) * sh - src.y) / src.h) * dest.h; + return { + x: Math.floor(x0), y: Math.floor(y0), w: Math.ceil(x1 - x0), h: Math.ceil(y1 - y0), + from: g.from === null || g.from === undefined ? null : Math.max(0, offsetIn(g.from, from, gaps)), + to: g.to === null || g.to === undefined ? null : Math.min(seconds, offsetIn(g.to, from, gaps)), + }; + }); +} + +/** A fitted picture's rect in a box (force_original_aspect_ratio=decrease, centred): `fitted` is its size. */ +export const centredIn = (box, fitted) => ({ x: box.x + Math.floor((box.w - fitted.w) / 2), y: box.y + Math.floor((box.h - fitted.h) / 2), w: fitted.w, h: fitted.h }); + +/** + * The drawtext filters for the marks (`marks` with their `places`), each text + * read from `files[k]` (written by the caller: textfile=, so nothing needs + * filter escaping) -- one comma-joined chain, or "" for none. + * + * @param {{ marks: Array<{ at: number, until: number }>, places: Array<{ rect: { x: number, y: number } }>, + * files: string[], size: ReturnType<typeof gapMarkSize>, palette?: { fg?: string, bg?: string }, font?: string }} o + */ +export function gapMarkFilters({ marks, places, files, size, palette = {}, font = MONO_BOLD_FONT_FILE }) { + const M = GAP_CUE_MOTION; + return marks + .map((m, k) => { + const a = f3(m.at); + const b = f3(m.until); + // gapCueAlpha (common gapCue.mjs), for ffmpeg: up over `in`, down over `out`, `peak` between. + const alpha = `${M.peak}*clip(min((t-${a})/${M.in},(${b}-t)/${M.out}),0,1)`; + const { x, y } = places[k].rect; + return [ + `drawtext=textfile='${files[k]}'`, + `fontfile='${font}'`, + `fontsize=${size.fontSize}`, + `fontcolor=${palette.fg ?? "white"}`, + "box=1", + `boxcolor=${palette.bg ?? "black"}@${GAP_MARK_BOX_ALPHA}`, + `boxborderw=${size.border}`, + `x=${x + size.border}`, + `y=${y + size.border}`, + `alpha='${alpha}'`, + `enable='between(t,${a},${b})'`, + ].join(":"); + }) + .join(","); +} diff --git a/umtool/report-to-video/gap-mark.test.mjs b/umtool/report-to-video/gap-mark.test.mjs @@ -0,0 +1,76 @@ +// gap-mark.mjs (lane gap-cue, slice 1): where a segment's joins are, which are +// marked, where each mark stands, and the drawtext that draws it. +// +// Run with: pnpm test:scripts +import assert from "node:assert/strict"; +import test from "node:test"; + +import { GAP_CUE_LIFE } from "yt-dlp-transcript-common/lib/report/gapCue.mjs"; +import { + censorAvoidRects, centredIn, gapMarkFilters, gapMarkPlaces, gapMarkRect, gapMarkSize, segmentGapJoins, segmentGapMarks, +} from "./gap-mark.mjs"; + +test("the joins: each gap's on the segment's clock (the seconds before it that play), its length, its mark", () => { + // A segment from source 100 s: gaps at 110–137 (27 s) and 150–153 (3 s), on its own clock 10–37 and 50–53. + const joins = segmentGapJoins({ + segGaps: [{ from: 10, to: 37 }, { from: 50, to: 53 }], + clipGaps: [{ from: 110, to: 137 }, { from: 150, to: 153, mark: false }], + segStart: 100, + cue: { mark: true }, + }); + assert.deepEqual(joins, [{ at: 10, seconds: 27, mark: true }, { at: 23, seconds: 3, mark: false }]); + // A clip cut from its pieces: the seconds a join says are the recording's (toReal). + const pieced = segmentGapJoins({ segGaps: [{ from: 4, to: 4.5 }], clipGaps: [{ from: 5, to: 5.5 }], segStart: 1, cue: { mark: true }, toReal: (t) => (t >= 5.5 ? t + 184.5 : t) }); + assert.deepEqual(pieced, [{ at: 4, seconds: 185, mark: true }]); +}); + +test("the marks: the clip's settings over the project's; under min none; the label's text", () => { + const joins = [{ at: 2, seconds: 27, mark: true }, { at: 8, seconds: 1.5, mark: true }, { at: 12, seconds: 75, mark: true }]; + const marks = segmentGapMarks({ render: { gapCue: { mark: true } }, entry: { type: "clip", gapCue: { label: "{s} later" } }, joins, seconds: 20 }); + assert.deepEqual(marks.map((m) => [m.at, m.text]), [[2, "27 s later"], [12, "1:15 later"]]); + assert.equal(marks[0].until, Number((2 + GAP_CUE_LIFE).toFixed(4))); +}); + +test("the place: the layout's corner, inset; off a hidden region while it is up; never a busy corner", () => { + const size = gapMarkSize(1920, 1080); + assert.deepEqual(size, { fontSize: 26, border: 9, inset: 28 }); + const box = { x: 100, y: 50, w: 1600, h: 900 }; + const marks = [{ at: 2, until: 3.1, text: "» 27 s" }, { at: 9, until: 10.1, text: "» 27 s" }]; + const r = gapMarkRect(6, size); + assert.deepEqual(r, { w: 94 + 18, h: 32 + 18 }, "six Plex Mono glyphs at 26 px and the border round them"); + const bl = gapMarkPlaces({ marks, box, want: "auto", prefer: "bl", size }); + assert.deepEqual(bl.map((p) => p.corner), ["bl", "bl"]); + assert.deepEqual(bl[0].rect, { x: 128, y: 50 + 900 - 28 - r.h, w: r.w, h: r.h }); + // A box over the bottom left from 1.5 to 4 s: the first mark moves to the top left, the second stays. + const avoid = [{ x: 100, y: 800, w: 400, h: 150, from: 1.5, to: 4 }]; + assert.deepEqual(gapMarkPlaces({ marks, box, want: "auto", prefer: "bl", size, avoid }).map((p) => p.corner), ["tl", "bl"]); + // An asked corner wins unless something is under it; a busy corner is skipped. + assert.deepEqual(gapMarkPlaces({ marks, box, want: "br", prefer: "bl", size }).map((p) => p.corner), ["br", "br"]); + assert.deepEqual(gapMarkPlaces({ marks, box, want: "auto", prefer: "tl", size, busy: ["tl"] }).map((p) => p.corner), ["tr", "tr"]); +}); + +test("a hidden region in the frame: its source fractions through the fit, its seconds on the segment's clock", () => { + // A 1280×720 source fitted into a 1600×900 box at (100, 50); a region on its left half over source 120–130 s. + const dest = centredIn({ x: 100, y: 50, w: 1600, h: 900 }, { w: 1600, h: 900 }); + const [a] = censorAvoidRects([{ box: [0, 0.5, 0.5, 0.5], from: 120, to: 130 }], { sw: 1280, sh: 720, dest, from: 100, gaps: [{ from: 105, to: 110 }], seconds: 60 }); + assert.deepEqual(a, { x: 100, y: 500, w: 800, h: 450, from: 15, to: 25 }); + // A 9:16 crop shown full: the region through the crop. + const [b] = censorAvoidRects([{ box: [0.25, 0, 0.25, 1], from: null, to: null }], { sw: 1920, sh: 1080, region: { x: 480, y: 0, w: 608, h: 1080 }, dest: { x: 0, y: 0, w: 1080, h: 1920 } }); + assert.deepEqual([b.x, b.w, b.from, b.to], [0, 853, null, null]); +}); + +test("the filters: one drawtext per mark, its text from its file, faded by alpha over its seconds", () => { + const size = gapMarkSize(1920, 1080); + const f = gapMarkFilters({ + marks: [{ at: 2, until: 3.1 }], + places: [{ rect: { x: 128, y: 970 } }], + files: ["/out/segments/c1.gapmark-0.txt"], + size, palette: { fg: "#ffffff", bg: "#12100c" }, font: "/fonts/Mono.ttf", + }); + assert.equal( + f, + "drawtext=textfile='/out/segments/c1.gapmark-0.txt':fontfile='/fonts/Mono.ttf':fontsize=26:fontcolor=#ffffff:box=1:boxcolor=#12100c@0.55:boxborderw=9:" + + "x=137:y=979:alpha='0.9*clip(min((t-2)/0.15,(3.1-t)/0.35),0,1)':enable='between(t,2,3.1)'", + ); + assert.equal(gapMarkFilters({ marks: [], places: [], files: [], size }), ""); +}); diff --git a/umtool/report-to-video/gaps-render.test.mjs b/umtool/report-to-video/gaps-render.test.mjs @@ -149,6 +149,85 @@ test("render: a gap is taken out of ONE segment -- the kept seconds long, no bla } }); +// ---- the mark at a gap's join (gap-mark.mjs; common gapCue.mjs) ------------------- + +/** Each frame's mean luma over a `w` × `h` crop at (x, y). */ +function cropLumas(file, x, y, w, h) { + const st = spawnSync("ffmpeg", ["-v", "error", "-i", file, "-vf", `crop=${w}:${h}:${x}:${y},signalstats,metadata=print:key=lavfi.signalstats.YAVG:file=-`, "-f", "null", "-"], { maxBuffer: 1 << 24 }); + return st.stdout.toString().split("\n").filter((l) => l.includes("YAVG")).map((l) => Number(l.split("=")[1])); +} +const setManifest = async (p, fn) => { + const m = JSON.parse(await readFile(p.manifestPath, "utf8")); + fn(m); + await writeFile(p.manifestPath, JSON.stringify(m)); +}; +const reusedIds = (events) => events.filter((e) => e.ev === "note" && / segment unchanged /.test(e.message)).map((e) => e.message.split(":")[0]); + +test("the gap mark OFF -- nothing set, mark false, a gap's why, a marked gap under min -- is the segment it was: reused, the same key, nothing new in its record", { skip: !have && "needs ffmpeg" }, async () => { + quiet(); + const p = await project({ gaps: [{ from: 3, to: 4 }] }); + try { + await buildVideo({ manifestPath: p.manifestPath, opts: { noNetwork: true } }); + const was = await record(p, "c1"); + const bytes = md5(p.seg("c1")); + const offs = [ + (m) => { m.render.gapCue = { mark: false }; }, + (m) => { m.timeline[0].gaps[0].why = "dead-air"; m.timeline[0].gapCue = { corner: "br" }; }, + // On, but the gap is 1 s: under the default 2 s minimum it draws nothing. + (m) => { m.render.gapCue = { mark: true }; }, + ]; + for (const off of offs) { + await setManifest(p, off); + const events = []; + setProgressMode((e) => events.push(e)); + await buildVideo({ manifestPath: p.manifestPath, opts: { noNetwork: true } }); + assert.ok(reusedIds(events).includes("c1"), `c1 reused (${JSON.stringify(reusedIds(events))})`); + const now = await record(p, "c1"); + assert.equal(now.segKey, was.segKey, "the same key: the same argv, inputs and record"); + assert.equal(now.gapMarks, undefined); + assert.equal(md5(p.seg("c1")), bytes); + } + } finally { + await rm(p.root, { recursive: true, force: true }); + } +}); + +test("the gap mark ON draws '» 1 s' at the join over its life, in the record; only that segment re-renders; off again it is the plain segment's bytes", { skip: !have && "needs ffmpeg" }, async () => { + quiet(); + const p = await project({ gaps: [{ from: 3, to: 4 }] }); + const plain = await project({ gaps: [{ from: 3, to: 4 }] }); + try { + await buildVideo({ manifestPath: plain.manifestPath, opts: { noNetwork: true } }); + await buildVideo({ manifestPath: p.manifestPath, opts: { noNetwork: true } }); + const c2 = md5(p.seg("c2")); + await setManifest(p, (m) => { m.render.gapCue = { mark: true, min: 0.5 }; }); + const events = []; + setProgressMode((e) => events.push(e)); + await buildVideo({ manifestPath: p.manifestPath, opts: { noNetwork: true } }); + assert.ok(!reusedIds(events).includes("c1") && reusedIds(events).includes("c2"), `c1 rebuilt, c2 reused (${JSON.stringify(reusedIds(events))})`); + assert.equal(md5(p.seg("c2")), c2); + const rec = await record(p, "c1"); + // The join: 2 s into c1 (1–3 plays, 3–4 is out). Up 1.1 s, at the plain cut's top left. + assert.deepEqual(rec.gapMarks, [{ at: 2, until: 3.1, seconds: 1, text: "» 1 s", corner: "tl" }]); + near(await probeDuration(p.seg("c1"), FPS), 4, 1 / FPS + 1e-6, "the mark adds no time"); + // Its box at 320×180: inset 8, a 12 px face with a 4 px border -- darker than the grey while it is up. + const y = cropLumas(p.seg("c1"), 8, 8, 40, 22); + const yPlain = cropLumas(plain.seg("c1"), 8, 8, 40, 22); + const at = (arr, t) => arr[Math.floor(t * FPS)]; + near(at(y, 1.5), at(yPlain, 1.5), 1, "before the join: as plain"); + assert.ok(at(yPlain, 2.5) - at(y, 2.5) > 20, `up at 2.5 s (${at(y, 2.5)} vs ${at(yPlain, 2.5)})`); + near(at(y, 3.5), at(yPlain, 3.5), 1, "gone after its life"); + // Off again: the plain segment, byte for byte. + await setManifest(p, (m) => { delete m.render.gapCue; }); + await buildVideo({ manifestPath: p.manifestPath, opts: { noNetwork: true } }); + assert.equal(md5(p.seg("c1")), md5(plain.seg("c1"))); + assert.equal((await record(p, "c1")).gapMarks, undefined); + } finally { + await rm(p.root, { recursive: true, force: true }); + await rm(plain.root, { recursive: true, force: true }); + } +}); + // ---- a gap-joined clip cut from its pieces ----------------------------------------- // Two moments of one recording joined by a gap: 1–5 s and 190–200 s. Only the // two pieces are on disk (two windows, the second WHITE with a higher tone), diff --git a/umtool/report-to-video/gaps.mjs b/umtool/report-to-video/gaps.mjs @@ -25,6 +25,11 @@ // join, where the gap was), `sourceAtOffset` maps back (the join shows the // material after the gap). // +// A gap may also say whether its join is MARKED (`mark`: true | false, over its +// clip's and the project's `gapCue`) and what it was cut for (`why`: "dead-air" +// | "other") -- common lib/report/gapCue.mjs is that rule. Both ride along +// with the gap through every list here and change none of its seconds. +// // Dependency-free, so a client bundle (Play the cut, the clip editor, the live // preview) takes it alone; the writer (umtool lib/report/manifest.mjs), the // build's validators (lint.mjs, build-video.mjs) and `umtool check` share @@ -37,6 +42,13 @@ export const GAP_LIMITS = Object.freeze({ min: 0.2, max: 40, keep: 0.5 }); export const GAP_FADE = 0.025; const fin = (v) => typeof v === "number" && Number.isFinite(v); +/** What a gap was cut for (common gapCue.mjs GAP_WHY: kept here too, this module imports nothing). */ +export const GAP_WHY_VALUES = Object.freeze(["dead-air", "other"]); +/** A gap's own keys beyond its seconds, kept as they are: `mark` (a boolean) and `why` (GAP_WHY_VALUES). */ +export const gapOwnKeys = (x) => ({ + ...(typeof x?.mark === "boolean" ? { mark: x.mark } : {}), + ...(GAP_WHY_VALUES.includes(x?.why) ? { why: x.why } : {}), +}); const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); const EPS = 1e-6; /** The writer's tolerance for a stored 2 dp edge (manifest.mjs WIN_EPS). */ @@ -67,7 +79,7 @@ export function gapsOf(entry) { if (!Array.isArray(g) || !g.length) return []; return g .filter((x) => isObj(x) && fin(x.from) && fin(x.to) && x.to > x.from) - .map((x) => ({ from: x.from, to: x.to })) + .map((x) => ({ from: x.from, to: x.to, ...gapOwnKeys(x) })) .sort((a, b) => a.from - b.from); } @@ -128,6 +140,8 @@ export function validateGaps(entry, where = `timeline entry ${entry?.id ?? "?"}` errors.push(`${where}.gaps[${k}] ${g.from}–${g.to} is under ${GAP_LIMITS.min} s — too short to hear as a cut`); return; } + if (g.mark !== undefined && typeof g.mark !== "boolean") errors.push(`${where}.gaps[${k}].mark is true (mark its join) or false, not ${JSON.stringify(g.mark)}`); + if (g.why !== undefined && !GAP_WHY_VALUES.includes(g.why)) errors.push(`${where}.gaps[${k}].why is one of ${GAP_WHY_VALUES.join(", ")}, not ${JSON.stringify(g.why)}`); ok.push({ ...g, k }); }); if (errors.length) return errors; @@ -291,7 +305,7 @@ export function validateGapEntries(manifest) { export function normalizeGaps(list) { const r2 = (n) => Number(Number(n).toFixed(2)); return (list ?? []) - .map((g) => ({ from: r2(g.from), to: r2(g.to) })) + .map((g) => ({ from: r2(g.from), to: r2(g.to), ...gapOwnKeys(g) })) .sort((a, b) => a.from - b.from || a.to - b.to); } @@ -508,11 +522,14 @@ export function recordGaps(record) { * Edit a clip's gaps list, as the CLI and the clip editor ask: `add` a span * (merged with any gap it touches or overlaps), `remove` the gap holding a * source second (or starting nearest it, within `tolerance`), or `set` the - * whole list (`[]` clears it). Returns the new list, normalized; the caller - * validates it on the entry. + * whole list (`[]` clears it), or `edit` the gap holding a source second + * (`{ at, mark?, why? }`: each set, or null to drop it -- its seconds never + * move). Returns the new list, normalized; the caller validates it on the + * entry. * * @param {Array<{ from: number, to: number }>} gaps the clip's now - * @param {{ add?: { from: number, to: number }, remove?: number, set?: Array<{ from: number, to: number }> }} op + * @param {{ add?: { from: number, to: number }, remove?: number, set?: Array<{ from: number, to: number }>, + * edit?: { at: number, mark?: boolean | null, why?: string | null } }} op * @param {{ tolerance?: number }} [opts] */ export function editGaps(gaps, op, { tolerance = 0.05 } = {}) { @@ -538,6 +555,22 @@ export function editGaps(gaps, op, { tolerance = 0.05 } = {}) { if (k < 0) throw new Error(`no gap at ${t}${list.length ? ` (gaps: ${list.map((g) => `${g.from}–${g.to}`).join(", ")})` : " — the clip has none"}`); list = list.filter((_, i) => i !== k); } + if (op.edit !== undefined) { + const t = Number(op.edit?.at); + if (!fin(t)) throw new Error(`which gap? a source second inside it (got ${op.edit?.at})`); + const k = list.findIndex((g) => t >= g.from - tolerance && t <= g.to + tolerance); + if (k < 0) throw new Error(`no gap at ${t}${list.length ? ` (gaps: ${list.map((g) => `${g.from}–${g.to}`).join(", ")})` : " — the clip has none"}`); + const next = { ...list[k] }; + for (const key of ["mark", "why"]) { + if (!(key in op.edit)) continue; + const v = op.edit[key]; + if (v === null || v === undefined) delete next[key]; + else if (key === "mark" && typeof v !== "boolean") throw new Error(`a gap's mark is on, off or default (got ${JSON.stringify(v)})`); + else if (key === "why" && !GAP_WHY_VALUES.includes(v)) throw new Error(`a gap's why is ${GAP_WHY_VALUES.join(", ")} or default (got ${JSON.stringify(v)})`); + else next[key] = v; + } + list = list.map((g, i) => (i === k ? next : g)); + } return normalizeGaps(list); } diff --git a/umtool/report-to-video/gaps.test.mjs b/umtool/report-to-video/gaps.test.mjs @@ -142,6 +142,23 @@ test("editGaps: add (merging what it touches), remove by a second inside, set; p assert.equal(GAP_LIMITS.min, 0.2); }); +test("a gap's own mark and why (common gapCue.mjs) ride along: kept, checked, edited, never moving its seconds", () => { + const own = [{ from: 105, to: 107, mark: false, why: "dead-air" }, { from: 110, to: 110.5 }]; + assert.deepEqual(gapsOf({ ...CLIP, gaps: own }), own); + assert.deepEqual(gapsOf({ ...CLIP, gaps: [{ from: 105, to: 107, mark: "no", why: "boring", label: "x" }] }), [{ from: 105, to: 107 }], "ill-formed ones are not read"); + assert.deepEqual(normalizeGaps([{ from: 105.004, to: 107, why: "other" }]), [{ from: 105, to: 107, why: "other" }]); + assert.deepEqual(validateGaps({ ...CLIP, gaps: own }), []); + const errs = validateGaps({ ...CLIP, gaps: [{ from: 105, to: 107, mark: "no" }, { from: 110, to: 110.5, why: "boring" }] }, "c1"); + assert.deepEqual(errs, ['c1.gaps[0].mark is true (mark its join) or false, not "no"', 'c1.gaps[1].why is one of dead-air, other, not "boring"']); + assert.deepEqual(editGaps(own, { edit: { at: 106, mark: true } }), [{ from: 105, to: 107, mark: true, why: "dead-air" }, { from: 110, to: 110.5 }]); + assert.deepEqual(editGaps(own, { edit: { at: 106, mark: null, why: null } }), [{ from: 105, to: 107 }, { from: 110, to: 110.5 }]); + assert.deepEqual(editGaps(own, { edit: { at: 110.2, why: "other" } })[1], { from: 110, to: 110.5, why: "other" }); + assert.throws(() => editGaps(own, { edit: { at: 108, mark: true } }), /no gap at 108/); + assert.throws(() => editGaps(own, { edit: { at: 106, why: "boring" } }), /why is dead-air, other or default/); + // Adding a gap elsewhere keeps the others' own keys. + assert.deepEqual(editGaps(own, { add: { from: 114, to: 115 } })[0], own[0]); +}); + // ---- the filtergraph ------------------------------------------------------------ test("gapFilterParts: nothing without gaps; trim + concat with a fade at each join with", () => { diff --git a/umtool/report-to-video/modules/gap-cue.mjs b/umtool/report-to-video/modules/gap-cue.mjs @@ -0,0 +1,40 @@ +// THE GAP MARK (module `gap-cue`, an input): "» 27 s" at the join a clip's gap +// leaves, drawn into the clip's segment over its seconds (report-to-video +// gap-mark.mjs; the settings, the label and the timing: common +// lib/report/gapCue.mjs, which umtool's pages read too). It draws on the +// footage at its encode, so it has no page and no region. +import { GAP_CUE_CORNERS, GAP_CUE_DEFAULTS, GAP_CUE_LABEL_MAX, GAP_CUE_MIN, validateGapCue } from "yt-dlp-transcript-common/lib/report/gapCue.mjs"; +import { defineModule } from "./contract.mjs"; + +export default defineModule({ + id: "gap-cue", + version: 1, + z: 3, + kind: "input", + slot: "footage", + // Its form in the stacked vertical deck (vertical-deck.mjs): drawn in the segment, as the blur is. + vertical: { slot: "input" }, + title: "Gap mark", + summary: "A small mark at each join a clip's gap leaves, saying how much was skipped.", + configKey: "render.gapCue", + defaults: { ...GAP_CUE_DEFAULTS }, + validate: (_value, { manifest }) => validateGapCue(manifest), + ui: [ + { key: "mark", type: "boolean", label: "Mark the gaps' joins", default: GAP_CUE_DEFAULTS.mark }, + { key: "min", type: "number", min: GAP_CUE_MIN.min, max: GAP_CUE_MIN.max, step: 0.5, label: "Shortest gap marked (s)", default: GAP_CUE_DEFAULTS.min }, + { key: "corner", type: "enum", options: [...GAP_CUE_CORNERS], label: "Corner", default: GAP_CUE_DEFAULTS.corner }, + { key: "label", type: "text", label: "Label ({s} is the time skipped)", default: GAP_CUE_DEFAULTS.label }, + ], + docs: { + heading: "Gap mark", + intro: "The full reference is [Gaps inside a clip](#gaps-inside-a-clip) (the mark at the join).", + 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.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\`), at most ${GAP_CUE_LABEL_MAX} characters · default \`${GAP_CUE_DEFAULTS.label}\``, "`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=` clears them)"], + ["a gap's `mark`, `why`", "`mark` `true` · `false` (over the clip's and the project's); `why` `dead-air` · `other` (draws nothing yet)", "`umtool set <p> <clip> gap.mark=12.3:off gap.why=12.3:dead-air` (`…:default` drops it)"], + ], + }, +}); diff --git a/umtool/report-to-video/modules/index.mjs b/umtool/report-to-video/modules/index.mjs @@ -33,6 +33,7 @@ import counter from "./counter.mjs"; import claims from "./claims.mjs"; import intro from "./intro.mjs"; import blur from "./blur.mjs"; +import gapCue from "./gap-cue.mjs"; import pair from "./pair.mjs"; import chapter from "./chapter.mjs"; import status from "./status.mjs"; @@ -54,7 +55,7 @@ export { assertRegion, defineModule, MODULE_KINDS, MODULE_SLOTS, PLAY_CLOCKS, RE /** Every module, by z (stack order), then id. */ export const MODULES = Object.freeze( - [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, analysis, intro, blur, pair, chapter, status, chat, shelf, diet, peak, goals, promise, streak, dial, odometer, trail, dialFinale, runsFinale] + [chart, shell, subtitle, qr, rail, sectionTitle, counter, claims, feed, popupPosts, stamp, stats, fx, threads, flips, finale, teaser, analysis, intro, blur, gapCue, pair, chapter, status, chat, shelf, diet, peak, goals, promise, streak, dial, odometer, trail, dialFinale, runsFinale] .sort((a, b) => a.z - b.z || a.id.localeCompare(b.id)), );