commit 241f6fce4c29e422ef6ff660bf6909c5e5b9fa9c
parent edcd9af6876b208740c4cae2a04d11e681c2343e
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 04:34:13 -0500
Merge main (lane/vertical) into lane/ui-simplify: the changelog keeps both [Unreleased] bullets
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
29 files changed, 2024 insertions(+), 18 deletions(-)
diff --git a/common/lib/report/draft/videoOps.test.ts b/common/lib/report/draft/videoOps.test.ts
@@ -169,7 +169,7 @@ test("the look ops (release 38): look, slide and room through the look's own rul
assert.match(r.applied[1]!.warnings![0]!, /the slide's knobs show once the join style is blur slide/);
assert.deepEqual(
r.refused.map((x) => x.why),
- ["render.transition must be a number of seconds from 0 (a hard cut) to 3", '"chrome" is not a look setting (headerHeight, footerHeight, qr, transition, transitionStyle, loudness, captions, room, slide, blur, intro)'],
+ ["render.transition must be a number of seconds from 0 (a hard cut) to 3", '"chrome" is not a look setting (headerHeight, footerHeight, qr, transition, transitionStyle, loudness, captions, room, slide, blur, intro, format, vertical)'],
);
assert.equal((manifest.render as { transition: number }).transition, 0.4, "the input is not touched");
});
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";
+export type LookKey = "headerHeight" | "footerHeight" | "qr" | "transition" | "transitionStyle" | "loudness" | "captions" | "room" | "slide" | "blur" | "intro" | "format" | "vertical";
export const LOOK_KEYS: readonly LookKey[];
export const BAND_MAX: number;
export const TRANSITION_MAX: number;
diff --git a/common/lib/report/look.mjs b/common/lib/report/look.mjs
@@ -17,6 +17,8 @@
// `intro` (the brand intro, ./intro.mjs) is a look key too: a take compares
// styles with `umtool look <p> intro=<style>`, and every writer checks it here.
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 { VERTICAL_CLIP_LAYOUTS, validateVerticalFormat } from "./vertical.mjs";
const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
const num = (v) => typeof v === "number" && Number.isFinite(v);
@@ -24,7 +26,7 @@ const q = (v) => JSON.stringify(v);
const round2 = (n) => Number(Number(n).toFixed(2));
/** The render keys the Look panel writes, in its order. */
-export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro"]);
+export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical"]);
/** `headerHeight` / `footerHeight`: whole pixels, 0 (off) to this. */
export const BAND_MAX = 240;
@@ -257,7 +259,10 @@ export function verticalErrors(v, who = "vertical") {
if (v === undefined || v === null) return [];
if (!isObj(v)) return [`${who} must be an object ({crop: [x, y, w, h]}), not ${q(v)}`];
const errors = [];
- for (const k of Object.keys(v)) if (k !== "crop" && k !== "aspect") errors.push(`${who}.${k} is not a setting here (crop, aspect)`);
+ for (const k of Object.keys(v)) if (k !== "crop" && k !== "aspect" && k !== "layout") errors.push(`${who}.${k} is not a setting here (crop, aspect, layout)`);
+ if (v.layout !== undefined && !VERTICAL_CLIP_LAYOUTS.includes(v.layout)) errors.push(`${who}.layout must be one of ${VERTICAL_CLIP_LAYOUTS.join(", ")}`);
+ // A clip may set its vertical layout alone: the crop is then the centred one.
+ if (v.crop === undefined && v.layout !== undefined) return errors;
if (v.aspect !== undefined && (!num(v.aspect) || v.aspect <= 0.2 || v.aspect > 5)) {
errors.push(`${who}.aspect must be the source's width / height (a number from 0.2 to 5), not ${q(v.aspect)}`);
}
@@ -296,7 +301,10 @@ export function validateVertical(manifest) {
export function validateLook(manifest) {
// render.room and a clip's room (release 36 lane E) are part of the look.
// 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)];
+ return [
+ ...validateCaptions(manifest), ...validateLoudness(manifest), ...validateVertical(manifest), ...validateRoom(manifest), ...validateRenderBlur(manifest), ...validateIntro(manifest),
+ ...validateVerticalFormat(manifest),
+ ];
}
// ---------------------------------------------------------------------------
@@ -366,8 +374,13 @@ export function applyLookPatch(manifest, patch) {
// A style name or {style, ground?, sound?, seconds?}; validateIntro (below) says what is wrong.
render.intro = introPatchValue(v);
break;
+ case "format":
+ // "landscape" is the default: written as no key at all.
+ if (v === "landscape") delete render.format;
+ else render.format = v;
+ break;
default:
- // loudness, captions, room, slide: stored as given; the build's validators below say what is wrong.
+ // loudness, captions, room, slide, vertical: stored as given; the build's validators below say what is wrong.
render[k] = v;
}
}
diff --git a/common/lib/report/vertical.d.mts b/common/lib/report/vertical.d.mts
@@ -0,0 +1,42 @@
+// Types for ./vertical.mjs (lane vertical): the vertical format's rules and a clip's side post.
+
+type Render = Record<string, unknown> | null | undefined;
+
+export type ClipLayout = "full" | "framed" | "quote";
+export type PostLayout = "card" | "stack" | "media";
+export type SideLayout = "split" | "overlay";
+export type VerticalKnobs = {
+ clip: ClipLayout;
+ post: PostLayout;
+ side: SideLayout;
+ captions: { size: "l" | "xl"; lines: 1 | 2 };
+ hook: false | "title" | "section" | { text: string };
+ tag: boolean;
+ safe: { top: number; bottom: number; right: number };
+ loudness: number;
+ maxSeconds: number;
+};
+export const RENDER_FORMATS: readonly ("landscape" | "vertical")[];
+export const VERTICAL_CLIP_LAYOUTS: readonly ClipLayout[];
+export const VERTICAL_POST_LAYOUTS: readonly PostLayout[];
+export const VERTICAL_SIDE_LAYOUTS: readonly SideLayout[];
+export const LANDSCAPE_SIDE_PLACES: readonly ("right" | "left")[];
+export const SIDE_PLACES: readonly string[];
+export const VERTICAL_CAPTION_SIZES: readonly string[];
+export const VERTICAL_HOOKS: readonly string[];
+export const VERTICAL_HOOK_MAX: number;
+export const SIDE_MIN_SECONDS: number;
+export const VERTICAL_WIDTH: number;
+export const VERTICAL_HEIGHT: number;
+export const VERTICAL_DEFAULTS: Readonly<VerticalKnobs>;
+export const VERTICAL_KEYS: readonly string[];
+export const VERTICAL_SAFE_MAX: Readonly<{ top: number; bottom: number; right: number }>;
+export function verticalOn(render: Render): boolean;
+export function verticalKnobs(render: Render): VerticalKnobs;
+export function clipLayoutOf(entry: unknown, render: Render): ClipLayout;
+export function validateVerticalRender(manifest: unknown): string[];
+export function sideErrors(side: unknown, who?: string, opts?: { itemIds?: Set<string> | null }): string[];
+export function validateClipSides(manifest: unknown): string[];
+export function sidePostOf(entry: unknown, timeline?: unknown[]): Record<string, unknown> | null;
+export function sideSpan(side: unknown, seconds: number): { from: number; to: number } | null;
+export function validateVerticalFormat(manifest: unknown): string[];
diff --git a/common/lib/report/vertical.mjs b/common/lib/report/vertical.mjs
@@ -0,0 +1,193 @@
+// THE VERTICAL FORMAT'S RULES (lane vertical, 5 Nov): a whole cut rendered
+// 9:16 for the shorts platforms, and the side post a clip may carry.
+//
+// render.format "vertical" | "landscape" absent = landscape, the cut as it always was
+// render.vertical { clip?, post?, side?, captions?, hook?, tag?, safe?, loudness?, maxSeconds? }
+// clip "full" (T1: a 9:16 crop, big word captions in the lower middle, a source tag)
+// "framed" (T2: the whole 16:9 picture in the middle third over a blurred enlargement
+// of itself; captions below, a hook band above)
+// "quote" (T3: the picture in the top 40 %; the line being said set large below it,
+// each word lit as it is said; channel and date cited)
+// post "card" (P1: the card at full width, its attachment beneath)
+// "stack" (P2: the conversation as a column, the parents dimmed above, his post lit)
+// "media" (P3: the attachment large at the top, the words in a panel under it)
+// side "split" (M1: the clip in the top half, the side post in the bottom half while it is up)
+// "overlay" (M2: the clip full-bleed, the side post floating over its lower third)
+// captions { size?: "l" | "xl", lines?: 1 | 2 } large, at most two lines
+// hook false | "title" | "section" | { text } the band over a framed clip: the clip's own
+// title, its section's title, or a line of the cut's own copy -- never invented commentary
+// tag true | false the small "channel · date" tag on a clip
+// safe { top?, bottom?, right? } fractions of the frame kept clear of key text
+// (the platform's own buttons sit there)
+// loudness LUFS the short is brought to (-30 to -8; the shorts platforms play at -14)
+// maxSeconds a short over this is said so (a note, never a refusal)
+//
+// clip.side { item?: "<post item id>", post?: {<a post item's fields>}, from, to, place? }
+// a post shown BESIDE a clip while it plays: not read aloud, the clip's own sound running.
+// `from`/`to` are seconds into the clip as it plays; `place` overrides the cut's
+// render.vertical.side for this clip ("split" | "overlay"), or, in a landscape cut,
+// "right" (the default) | "left" for the panel's side.
+// clip.vertical.layout this clip's own layout ("full" | "framed" | "quote") over the cut's.
+//
+// PURE: no fs, no ffmpeg. Plain ESM with a .d.mts beside it.
+
+const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
+const num = (v) => typeof v === "number" && Number.isFinite(v);
+const q = (v) => JSON.stringify(v);
+
+export const RENDER_FORMATS = Object.freeze(["landscape", "vertical"]);
+export const VERTICAL_CLIP_LAYOUTS = Object.freeze(["full", "framed", "quote"]);
+export const VERTICAL_POST_LAYOUTS = Object.freeze(["card", "stack", "media"]);
+export const VERTICAL_SIDE_LAYOUTS = Object.freeze(["split", "overlay"]);
+/** Where a side post sits in a LANDSCAPE cut. */
+export const LANDSCAPE_SIDE_PLACES = Object.freeze(["right", "left"]);
+export const SIDE_PLACES = Object.freeze([...VERTICAL_SIDE_LAYOUTS, ...LANDSCAPE_SIDE_PLACES]);
+export const VERTICAL_CAPTION_SIZES = Object.freeze(["l", "xl"]);
+export const VERTICAL_HOOKS = Object.freeze(["title", "section"]);
+/** A hook line of the cut's own copy: at most this many characters. */
+export const VERTICAL_HOOK_MAX = 90;
+/** The shortest a side post may be up (s). */
+export const SIDE_MIN_SECONDS = 1;
+
+export const VERTICAL_WIDTH = 1080;
+export const VERTICAL_HEIGHT = 1920;
+
+/** The shorts conventions, as knobs: what a cut that sets none gets. */
+export const VERTICAL_DEFAULTS = Object.freeze({
+ clip: "full",
+ post: "card",
+ side: "split",
+ captions: Object.freeze({ size: "xl", lines: 2 }),
+ hook: false,
+ tag: true,
+ safe: Object.freeze({ top: 0.08, bottom: 0.2, right: 0.12 }),
+ loudness: -14,
+ maxSeconds: 60,
+});
+export const VERTICAL_KEYS = Object.freeze(Object.keys(VERTICAL_DEFAULTS));
+export const VERTICAL_SAFE_MAX = Object.freeze({ top: 0.25, bottom: 0.35, right: 0.25 });
+
+/** Is this cut rendered 9:16? */
+export const verticalOn = (render) => render?.format === "vertical";
+
+/** The cut's vertical knobs, the defaults filled in (whatever its format). */
+export function verticalKnobs(render) {
+ const v = isObj(render?.vertical) ? render.vertical : {};
+ return {
+ clip: VERTICAL_CLIP_LAYOUTS.includes(v.clip) ? v.clip : VERTICAL_DEFAULTS.clip,
+ post: VERTICAL_POST_LAYOUTS.includes(v.post) ? v.post : VERTICAL_DEFAULTS.post,
+ side: VERTICAL_SIDE_LAYOUTS.includes(v.side) ? v.side : VERTICAL_DEFAULTS.side,
+ captions: { ...VERTICAL_DEFAULTS.captions, ...(isObj(v.captions) ? v.captions : {}) },
+ hook: v.hook === undefined || v.hook === null ? VERTICAL_DEFAULTS.hook : v.hook,
+ tag: typeof v.tag === "boolean" ? v.tag : VERTICAL_DEFAULTS.tag,
+ safe: { ...VERTICAL_DEFAULTS.safe, ...(isObj(v.safe) ? v.safe : {}) },
+ loudness: num(v.loudness) ? v.loudness : VERTICAL_DEFAULTS.loudness,
+ maxSeconds: num(v.maxSeconds) ? v.maxSeconds : VERTICAL_DEFAULTS.maxSeconds,
+ };
+}
+
+/** A clip's layout in a vertical cut: its own `vertical.layout`, else the cut's. */
+export function clipLayoutOf(entry, render) {
+ const own = entry?.vertical?.layout;
+ return VERTICAL_CLIP_LAYOUTS.includes(own) ? own : verticalKnobs(render).clip;
+}
+
+/** Every reason `render.format` / `render.vertical` cannot be built. */
+export function validateVerticalRender(manifest) {
+ const r = manifest?.render;
+ const errors = [];
+ if (r?.format !== undefined && r?.format !== null && !RENDER_FORMATS.includes(r.format)) {
+ errors.push(`render.format must be one of ${RENDER_FORMATS.join(", ")}, not ${q(r.format)}`);
+ }
+ const v = r?.vertical;
+ if (v === undefined || v === null) return errors;
+ if (!isObj(v)) return [...errors, `render.vertical must be an object of the vertical knobs (${VERTICAL_KEYS.join(", ")})`];
+ for (const k of Object.keys(v)) if (!VERTICAL_KEYS.includes(k)) errors.push(`render.vertical.${k} is not a vertical knob (${VERTICAL_KEYS.join(", ")})`);
+ const oneOf = (k, list) => {
+ if (v[k] !== undefined && !list.includes(v[k])) errors.push(`render.vertical.${k} must be one of ${list.join(", ")}, not ${q(v[k])}`);
+ };
+ oneOf("clip", VERTICAL_CLIP_LAYOUTS);
+ oneOf("post", VERTICAL_POST_LAYOUTS);
+ oneOf("side", VERTICAL_SIDE_LAYOUTS);
+ if (v.captions !== undefined) {
+ if (!isObj(v.captions)) errors.push("render.vertical.captions must be {size?, lines?}");
+ else {
+ for (const k of Object.keys(v.captions)) if (k !== "size" && k !== "lines") errors.push(`render.vertical.captions.${k} is not a caption knob (size, lines)`);
+ if (v.captions.size !== undefined && !VERTICAL_CAPTION_SIZES.includes(v.captions.size)) errors.push(`render.vertical.captions.size must be one of ${VERTICAL_CAPTION_SIZES.join(", ")}`);
+ if (v.captions.lines !== undefined && v.captions.lines !== 1 && v.captions.lines !== 2) errors.push("render.vertical.captions.lines must be 1 or 2 (a short's captions are at most two lines)");
+ }
+ }
+ if (v.hook !== undefined && v.hook !== false) {
+ if (isObj(v.hook)) {
+ const t = v.hook.text;
+ if (Object.keys(v.hook).some((k) => k !== "text")) errors.push("render.vertical.hook must be {text} (a line of the cut's own copy)");
+ if (typeof t !== "string" || !t.trim() || t.length > VERTICAL_HOOK_MAX) errors.push(`render.vertical.hook.text must be a line of 1–${VERTICAL_HOOK_MAX} characters`);
+ } else if (!VERTICAL_HOOKS.includes(v.hook)) errors.push(`render.vertical.hook must be false, ${VERTICAL_HOOKS.map(q).join(", ")} or {text}`);
+ }
+ if (v.tag !== undefined && typeof v.tag !== "boolean") errors.push("render.vertical.tag must be true or false");
+ if (v.safe !== undefined) {
+ if (!isObj(v.safe)) errors.push("render.vertical.safe must be {top?, bottom?, right?}");
+ else {
+ for (const [k, x] of Object.entries(v.safe)) {
+ const max = VERTICAL_SAFE_MAX[k];
+ if (max === undefined) errors.push(`render.vertical.safe.${k} is not a safe edge (top, bottom, right)`);
+ else if (!num(x) || x < 0 || x > max) errors.push(`render.vertical.safe.${k} must be a fraction of the frame from 0 to ${max}`);
+ }
+ }
+ }
+ if (v.loudness !== undefined && !(num(v.loudness) && v.loudness >= -30 && v.loudness <= -8)) errors.push("render.vertical.loudness must be LUFS from -30 to -8");
+ if (v.maxSeconds !== undefined && !(num(v.maxSeconds) && v.maxSeconds >= 5 && v.maxSeconds <= 600)) errors.push("render.vertical.maxSeconds must be seconds from 5 to 600");
+ return errors;
+}
+
+/** Every reason a clip's `side` cannot be built (its post's own fields are the post item's validator's). */
+export function sideErrors(side, who = "side", { itemIds = null } = {}) {
+ if (side === undefined || side === null) return [];
+ if (!isObj(side)) return [`${who} must be {item | post, from, to, place?}`];
+ const errors = [];
+ for (const k of Object.keys(side)) if (!["item", "post", "from", "to", "place"].includes(k)) errors.push(`${who}.${k} is not a side setting (item, post, from, to, place)`);
+ const hasItem = typeof side.item === "string" && side.item.trim() !== "";
+ const hasPost = isObj(side.post);
+ if (hasItem === hasPost) errors.push(`${who} needs exactly one of item (a post item's id) or post (a post's fields)`);
+ if (hasItem && itemIds && !itemIds.has(side.item)) errors.push(`${who}.item: no post item ${q(side.item)} in the timeline`);
+ if (hasPost && (typeof side.post.text !== "string" || !(side.post.handle || side.post.author))) errors.push(`${who}.post needs at least text and a handle or author`);
+ if (!num(side.from) || side.from < 0) errors.push(`${who}.from must be seconds into the clip (0 or more)`);
+ if (!num(side.to)) errors.push(`${who}.to must be seconds into the clip`);
+ if (num(side.from) && num(side.to) && side.to - side.from < SIDE_MIN_SECONDS) errors.push(`${who} must be up at least ${SIDE_MIN_SECONDS} s (to − from)`);
+ if (side.place !== undefined && !SIDE_PLACES.includes(side.place)) errors.push(`${who}.place must be one of ${SIDE_PLACES.join(", ")}`);
+ return errors;
+}
+
+/** Every clip's `side`, against the timeline (an `item` names a post item in it). */
+export function validateClipSides(manifest) {
+ const tl = Array.isArray(manifest?.timeline) ? manifest.timeline : [];
+ const itemIds = new Set(tl.filter((e) => e?.type === "post" && typeof e.id === "string").map((e) => e.id));
+ const errors = [];
+ tl.forEach((e, i) => {
+ if (e?.side === undefined) return;
+ const who = `timeline[${i}] (${e?.id ?? "?"}).side`;
+ if (e?.type !== "clip") errors.push(`${who}: only a clip carries a side post`);
+ else errors.push(...sideErrors(e.side, who, { itemIds }));
+ });
+ return errors;
+}
+
+/** The post a clip's side shows: its own `post`, else the post item it names (null when there is none). */
+export function sidePostOf(entry, timeline = []) {
+ const s = entry?.side;
+ if (!isObj(s)) return null;
+ if (isObj(s.post)) return { type: "post", id: `${entry.id}-side`, platform: "x", ...s.post };
+ if (typeof s.item === "string") return (timeline ?? []).find((e) => e?.type === "post" && e.id === s.item) ?? null;
+ return null;
+}
+
+/** The side's span clamped to a clip `seconds` long, or null when none of it is inside. */
+export function sideSpan(side, seconds) {
+ if (!isObj(side) || !num(side.from) || !num(side.to)) return null;
+ const from = Math.max(0, side.from);
+ const to = Math.min(num(seconds) ? seconds : Infinity, side.to);
+ return to - from >= 0.2 ? { from, to } : null;
+}
+
+/** All of the vertical format's checks. */
+export const validateVerticalFormat = (manifest) => [...validateVerticalRender(manifest), ...validateClipSides(manifest)];
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, 11);
+ assert.equal(LOOK_KEYS.length, 13);
});
test("the request table: every request → the model's ops → the diff lines kept and the reasons refused", () => {
diff --git a/common/package.json b/common/package.json
@@ -53,6 +53,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/vertical.mjs": "./lib/report/vertical.mjs",
"./lib/report/intro.mjs": "./lib/report/intro.mjs",
"./lib/report/fxParams.mjs": "./lib/report/fxParams.mjs",
"./lib/report/videoAssistOps.mjs": "./lib/report/videoAssistOps.mjs",
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -2,6 +2,7 @@
## [Unreleased]
- **umtool: Play is one press from anywhere, a clip is added without its spec, and every page leads with its next step.** A cut or a take named anywhere now carries a Play that opens the newest take (at the item when there is one): the project's head on every tab (with Walk, + Add a clip and the status `latest <take> · <length> · rendered <day> · <n> open notes`), every Cut tab row, every take card, the take walk, `/jobs`' renders (with the mp4's local path and Copy), the Inbox's cards and the rail's Recent cuts; a cut of posts showed no Play at all. **+ Add a clip** finds the words in the recordings the cut draws on (or the archive, or a pasted link with a time), sets the in and out on the moment's cues, places it after a row (by date when the cut is in date order) and fetches its window through the editor; from the Cut tab, from Play at the playhead and from a take ("to this take only": `umtool timeline <p> --take <t> insert <spec> --after <id>`). **+ Add posts** is `posts reel` with a preview; **Reads and voices** edits the pronunciation lexicon and the voice map with Try it; also the redacted words, the slur filter and the cut's narration mix, and queues the cut-wide passes (every script, every missing read, context from captures, conversations) as queue steps. A take has **Check before render** (`lint --take`), **Check the joins**, **New draft from this take** and **Add items from another project** (with a preview); New take has **Save as a draft**; the post bench's **edits go to: take <t> only** writes the take's patch (`--in-take`) and its **Re-join the read** re-times, drops parts or URLs and raises the caps; the clip bench can **Fetch this window again**; the reel cut takes a finale, a file name and a dry run; the Deliver tab opens on **Output files**, absolute paths with Copy. The rest of each page sits under one **Options** / **Advanced** disclosure, its open state remembered per viewer; nothing was removed.
+- **A report video renders 9:16 too: vertical shorts of clips, post reads and side posts, in one format.** `render.format: "vertical"` builds the same timeline 1080x1920 at its fps (no deck, header, QR or intro), and `umtool vertical <p> --take <t> --reel <r>` (or `umtool trailer … --vertical`) builds a short of a take's items without touching the cut: each clip cut again in its layout -- full (a 9:16 crop, big captions lit word by word, a source tag), framed (the whole picture in the middle third over a blurred enlargement, a hook from the cut's own titles above) or quote (the picture in the top 40 %, the line set large below, cited) -- and each post item drawn again in a portrait box (card, stack or media-first). A clip can carry a SIDE POST (`umtool set <p> <clip> side.item=… side.from=… side.to=…`): a post shown beside it while it plays, never read, the clip's sound running -- split or overlay in a vertical cut, a panel sliding in at the side in 16:9. Text keeps out of the platforms' buttons (top 8 %, bottom 20 %, right 12 %, knobs), the short is brought to -14 LUFS and said when it runs over 60 s; `--reframe` recomposes a finished 16:9 master instead (the footage box, the post's card over its attachment, the deck's date line), the cheapest for any cut. A clip's crop and layout are `umtool set … vertical.crop=… vertical.layout=…`; no `format` key and the 16:9 render is byte for byte what it was. umtool/docs/cli.md "Make a vertical short", knobs.md "Vertical shorts".
- **A take can carry items of other projects, and be edited without touching the project.** A cut assembled as a take of one project from the items of several (the mid cut: a take of the full cut, items from the full cut and a staging project) needed a script to clone the entries, hard-link their narration in and copy each re-read into the take's patch by hand. `umtool take <p> --id <t> --import-item <project>:<item>[,<item>…] [--after|--before <entry>]` now clones the items with their narration and its pick, hard-links every file they name into the take's project (another file already at a path: linked under `imports/<source>/` instead, never written over), places them, and is safe to run again (`updated`, or `unchanged` with no write). `posts set-item`, `roles`, `narrate`, `reread` and `fx` take `--in-take <take>`: the same edit lands in the take's patch with an undo point of the take's own (`umtool timeline <p> --take <t> undo`), the project's manifest untouched. `umtool take … --draft --from <take>` starts a draft from another take's patch, and `umtool lint <p> [--take <t>]` runs the build's lint on a take and checks that every file its items name is in the project. `posts narrate --thread` finds the editor's WORKER_TOKEN in `editor/.env` as umtool's other editor calls do. A cut whose posts carry the progress bar (`posts progress auto`) no longer fails its lint (`render.posts.progress is not a knob`), nor does one with the clock, panel, join, link-visit or branch-map knobs.
- **Every umtool take render records itself, and umtool runs a queue of steps in order.** A render that died at exit 1 behind a filtered shell chain left no trace (`take.json` kept `builtAt: null`, no log), and the next chain read the chain's own DONE as success. Now every render, whoever starts it, writes `takes/<id>/render.json` (running, waiting at the heavy slot, done, failed or cancelled; its stage; on failure the first error line and the log's last 40 lines; on done the mp4 and its seconds) and the full `takes/<id>/render.log`; done needs exit 0 and a non-empty mp4, and a record whose process is gone reads failed. `umtool take status <p> --id <t>` exits 0 done, 3 still going, 1 failed. `umtool queue add [--after <qid>] -- <command…>` queues a umtool command that the umtool app runs, one step at a time, surviving the session, a restart or a ship: a failure blocks what waits on it, `retry` puts both back, a step that was running when the app died is failed with its log and never re-run. `umtool queue ls|status|wait|log|cancel|retry` and `umtool jobs` poll them; `/jobs` (the rail's *Running*) and the Takes page show the queue and the records, with the error and the log. umtool/docs/cli.md, "Queue and poll instead of scripting".
- **A small fix to a report-video take re-renders in minutes, not half an hour.** A take renders hard cuts, and its final picture was one overlay pass over the whole cut on every take -- 12.6 of mid-6's 30 minutes, 26 of mid-7's 60 -- however small the change. The pass is now in keyed chunks, one segment's run each: `umtool take … --from <take>` re-encodes only the chunks of the post it touched, and a post that grew or shrank moves the chunks after it without changing them (the deck's frames after it are the same frames, later). The deck is drawn only where a chunk to encode reads it, so a take `--from` a pruned one no longer captures the whole deck again (12,347 captures, ~3 minutes on mid-7), and the cut's sound is keyed by each segment's audio, so a caption or a knob that moves no word keeps it. The picture is now frame-exact: the old pass laid each next segment at the longer of its picture and its sound, the footage up to 0.3 s behind the deck by the end of the cut.
diff --git a/umtool/app/api/report/post-item/route.ts b/umtool/app/api/report/post-item/route.ts
@@ -2,6 +2,7 @@ import { readFile, realpath, stat } from "node:fs/promises";
import path from "node:path";
import { joinCarryOf, panelEntry, postCardHtml, postItemPlan } from "umtool-report-to-video/post-item";
import { avatarUrls } from "umtool-report-to-video/post-avatars";
+import { sideCardEntry, sidePostOf } from "umtool-report-to-video/vertical";
import { jobState, startJob } from "@/lib/research/case-editor";
import { withEditNotes } from "@/lib/report/guard";
import { StaleToken, StructureRefused, manifestToken, updatePostFx, updatePostItem, updatePostNarration } from "@/lib/report/manifest.mjs";
@@ -33,6 +34,8 @@ export const dynamic = "force-dynamic";
// (post-redact.mjs), never in the page, its slurs
// masked (post-slurs.mjs); &uncensored=1 the
// slurs as posted (the redaction kept)
+// GET ?project&side=<clip>&w&h[&take][&published=1] a clip's SIDE POST's card page (side-card.mjs,
+// lane vertical): the post shown beside the clip, at w × h
// GET ?project&file=posts-media/… an attachment (byte ranges): only a file
// under the project's posts-media/
// GET ?project&font=regular|bold the cut's faces, for the page
@@ -116,6 +119,39 @@ export async function GET(request: Request) {
});
}
+ // A clip's SIDE POST (lane vertical): its card page, transparent around the card, the cut's redaction when published.
+ const sideOf = q.get("side");
+ if (sideOf) {
+ let m = r.manifest as Record<string, unknown>;
+ try {
+ if (q.get("take")) m = (await resolveTakeManifest(r.project.dir, q.get("take") as string, { base: m })).manifest as Record<string, unknown>;
+ } catch (e) {
+ return new Response(e instanceof Error ? e.message : String(e), { status: 400 });
+ }
+ const tl = (Array.isArray(m.timeline) ? m.timeline : []) as Entry[];
+ const clip = tl.find((e) => e?.type === "clip" && e.id === sideOf);
+ const post = clip ? (sidePostOf(clip, tl) as Entry | null) : null;
+ if (!post) return new Response(`no side post on ${sideOf}`, { status: 404 });
+ const sw = Math.round(Number(q.get("w")) || 0);
+ const sh = Math.round(Number(q.get("h")) || 0);
+ if (!(sw >= 160 && sw <= 3840 && sh >= 90 && sh <= 2160)) return new Response("w and h are the side card's box, in px", { status: 400 });
+ const base = `/api/report/post-item?project=${encodeURIComponent(r.project.id)}`;
+ let redaction = null;
+ try {
+ if (q.get("published") === "1") redaction = await projectRedaction(r.project.dir, m, { uncensored: q.get("uncensored") === "1", say: false });
+ } catch (e) {
+ return new Response(e instanceof Error ? e.message : String(e), { status: 500 });
+ }
+ const html = postCardHtml(sideCardEntry(post), {
+ width: sw, height: sh, transparent: true,
+ avatars: avatarUrls(m, (src: string) => `${base}&file=${encodeURIComponent(src)}`) as Record<string, string>,
+ palette: (render.palette ?? {}) as Record<string, string>,
+ fonts: { regular: `${base}&font=regular`, bold: `${base}&font=bold` },
+ phase: "read", redaction,
+ });
+ return new Response(html, { headers: { "content-type": "text/html; charset=utf-8", ...noStore } });
+ }
+
const id = q.get("id") ?? "";
let found;
try {
diff --git a/umtool/bin/umtool.mjs b/umtool/bin/umtool.mjs
@@ -82,6 +82,9 @@
// umtool render-mode on [--for 90m] [--note T] | off [--force] | status [--json] render mode: a render gets the machine
// umtool render-mode on [--for 90m] [--print-token] -- <cmd …> held while <cmd> runs (its env carries the token)
// umtool pool [stats|prune|verify] [--json] the render pool: every built unit by its key, shared by every take
+// umtool vertical <project> --take <t> (--reel R | --beats F | --items a,b) [--clip full|framed|quote]
+// [--post card|stack|media] [--side split|overlay] [--hook …] [--reframe] [--json]
+// a vertical short (1080x1920) of the take's items, built natively or reframed from the master
// umtool trailer <project> --take <t> (--beats F | --beats-json J) [--intro] [--finale S] [--xfade 0.3]
// [--out NAME] [--dry-run] [--json] a trailer cut from the take's finished master
// | --reel <name> [--take <t>] a beat reel (promo/<name>-beats.json) -> <slug>.<name>.mp4
@@ -999,6 +1002,11 @@ function usage() {
" whole timeline; beats are clip source seconds or master seconds ([--dry-run] the mapping only)",
" --reel <name> [--take <t>]: a beat reel's beats and settings (promo/<name>-beats.json),",
" written to takes/<t>/out/<slug>.<name>.mp4; no --take: its pinned, last-cut or latest master",
+ " --vertical [--layout reframe] [the vertical flags]: the reel 9:16 (umtool vertical --reel)",
+ " umtool vertical <project> --take <t> (--reel R | --beats F | --items a,b) [--clip full|framed|quote]",
+ " [--post card|stack|media] [--side split|overlay] [--hook title|section|<copy>] [--reframe] [--json]",
+ " a vertical short (1080x1920, -14 LUFS) of the take's items: each clip cut again in its layout,",
+ " each post drawn in a portrait box; --reframe recomposes the finished 16:9 master instead",
" umtool trailer-beats <project> [ls] | add <clip> [<from>-<to>] [--at N] [--label L] | add-raw <at> <dur> | set <n> <from>-<to>",
" | remove <n> | move <n> --to <m> | order | limit <s|m:ss|x|instagram|shorts|tiktok> | xfade <s> | intro on|off",
" | candidates [--add] the trailer's beats (promo/trailer-beats.json, the Trailer page's file): each",
@@ -1145,6 +1153,8 @@ const COMMANDS = {
// The render pool (report-to-video render-pool.mjs): lib/report/poolCli.mjs.
pool: async () => process.exit(await (await import("../lib/report/poolCli.mjs")).poolCommand(argv.slice(argv.indexOf("pool") + 1))),
trailer: async () => process.exit(await (await import("../lib/report/trailerCli.mjs")).trailerCommand(argv.slice(argv.indexOf("trailer") + 1))),
+ // A vertical short (1080x1920) of a take's items, natively or reframed: lib/report/verticalCli.mjs.
+ vertical: async () => process.exit(await (await import("../lib/report/verticalCli.mjs")).verticalCommand(argv.slice(argv.indexOf("vertical") + 1))),
// Do the QR links open on their sites (UI notes #8): lib/report/linksCli.mjs.
links: async () => process.exit(await (await import("../lib/report/linksCli.mjs")).linksCommand(argv.slice(argv.indexOf("links") + 1))),
// Which named voice each clip is (UI notes #15): lib/report/speakerCheck.mjs.
diff --git a/umtool/components/projects/review/PlayCut.tsx b/umtool/components/projects/review/PlayCut.tsx
@@ -31,6 +31,7 @@ import AddPost from "./AddPost";
import { AddClipToggle } from "../AddClip";
import { Options, PanelSlot } from "@/components/ui/disclosure";
import PostItemPlayer, { postItemAssets, type PostPlan } from "./PostItemPlayer";
+import SidePostOverlay from "./SidePostOverlay";
import ComboBadge, { type ComboInfo } from "./ComboBadge";
// ---------------------------------------------------------------------------
@@ -879,6 +880,9 @@ export default function PlayCut({
const postNow = item && entry?.type === "post" && entry.post && entry.postPlan ? { item, entry } : null;
const placeholder = item && !postNow && (!item.clip || missing || broken) ? { kind: !item.clip ? "card" : "missing", item, entry } : null;
const pct = (n: number, of: number) => `${(n / of) * 100}%`;
+ // A clip's side post (lane vertical): its card over the clip for the side's span (SidePostOverlay).
+ const sideEntry = item && entry?.type === "clip" ? (entry as { side?: { from: number; to: number; place?: string | null } }).side : undefined;
+ const sideNow = item && sideEntry ? <SidePostOverlay project={project} take={take} clipId={item.id} side={sideEntry} s={Math.max(0, t - item.start)} published={asPublished} /> : null;
// ---- post items fetched ahead (postPreload.ts): from the one on screen, ~20 s on --------------------------
const postBox = box ? { width: box.width, height: box.height } : { width: 1920, height: 1080 };
@@ -1125,6 +1129,7 @@ export default function PlayCut({
</div>
)}
{placeholderCard}
+ {sideNow && rect && <div className="pointer-events-none absolute" style={{ left: pct(rect.x, g.W), top: pct(rect.y, g.H), width: pct(rect.width, g.W), height: pct(rect.height, g.H) }}>{sideNow}</div>}
{doc.feed && <FeedOverlay key={doc.feed.src ?? "none"} feed={doc.feed} frame={g} t={tc} testid="play-feed" />}
{postsWin && doc.posts && <PostsOverlay key={`${postsWin.segment}:${postsWin.src ?? "none"}`} win={postsWin} geometry={doc.posts.geometry} frame={g} t={tc} />}
{doc.stamp && <FeedOverlay key={`stamp:${doc.stamp.src ?? "none"}`} feed={doc.stamp} frame={g} t={tc} ready="stamp:ready" testid="play-stamp" name="fact-check stamps" />}
@@ -1141,6 +1146,7 @@ export default function PlayCut({
{footageCanvas({ inset: 0, width: "100%", height: "100%" }, 1280, 720)}
{postNow && <div className="absolute inset-0" style={{ background: bg }}>{postPlayer({ width: 1920, height: 1080 })}{comboBadge({ width: 1920, height: 1080 })}</div>}
{placeholderCard}
+ {sideNow}
</div>
)}
{ui.playing && ui.waiting && (
diff --git a/umtool/components/projects/review/SidePostOverlay.tsx b/umtool/components/projects/review/SidePostOverlay.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+// A CLIP'S SIDE POST in Play the cut (lane vertical; common lib/report/vertical.mjs): the post shown beside the
+// clip while it plays -- never read, the clip's sound running -- drawn by the post-item route's `side` page (the
+// card the build lays in, side-card.mjs), at the right (or left) of the footage box over the side's from-to,
+// sliding in and out as the render does (vertical.mjs landscapeSideGeometry, SIDE_MOTION).
+
+type Side = { from: number; to: number; place?: string | null };
+
+const MOTION = 0.35;
+
+export default function SidePostOverlay({ project, take, clipId, side, s, published }: { project: string; take: string | null; clipId: string; side: Side; s: number; published: boolean }) {
+ const up = s >= side.from - MOTION && s <= side.to + MOTION;
+ if (!up) return null;
+ const left = side.place === "left";
+ // How far in it is: 0 off-frame, 1 in place (an ease-out in, an ease-in out).
+ const k = s < side.from + MOTION ? Math.max(0, Math.min(1, (s - side.from) / MOTION)) : s > side.to - MOTION ? Math.max(0, Math.min(1, (side.to - s) / MOTION)) : 1;
+ const ease = 1 - (1 - k) * (1 - k);
+ const src = `/api/report/post-item?project=${encodeURIComponent(project)}&side=${encodeURIComponent(clipId)}&w=640&h=600${take ? `&take=${encodeURIComponent(take)}` : ""}${published ? "&published=1" : ""}`;
+ return (
+ <div
+ className="pointer-events-none absolute"
+ style={{ top: "7%", height: "86%", width: "34%", [left ? "left" : "right"]: "2.5%", transform: `translateX(${(left ? -1 : 1) * (1 - ease) * 110}%)`, zIndex: 3 }}
+ data-play-side={clipId}
+ >
+ <iframe title={`side post of ${clipId}`} src={src} className="h-full w-full border-0 bg-transparent" style={{ colorScheme: "normal" }} />
+ </div>
+ );
+}
diff --git a/umtool/docs/cli.md b/umtool/docs/cli.md
@@ -242,6 +242,41 @@ $U queue add --label "render mid-15" -- take emberparadox/mr-obvious --id mid-15
- Exit codes: **0** done (also "nothing changed"), **1** refused (no such take, item or entry; a
rendering take; a link out of the project), **2** usage.
+## Make a vertical short (9:16, for Shorts, Reels and TikTok)
+
+A short is cut from a TAKE's items, natively: every clip cut again in its vertical layout, every post item drawn again
+in a portrait box, text kept out of the platforms' buttons (the top 8 %, bottom 20 %, right 12 %), -14 LUFS, said
+when it runs over 60 s. Three or four commands; no script.
+
+```sh
+U="node umtool/bin/umtool.mjs"
+# 1. (clips) Where the face is: the 9:16 box of each clip's picture, as fractions [x, y, w, h] (w = 0.3164 on 16:9).
+$U set emberparadox/in-her-words u01 'vertical.crop=[0.64,0,0.3164,1]'
+# 2. (optional) A post shown BESIDE a clip while it plays -- never read, the clip's sound running.
+$U set emberparadox/in-her-words x02 side.item=p-2115519823090479417 side.from=0.8 side.to=15
+# 3. The short: a reel's beats (promo/<r>-beats.json, as `trailer --reel` reads them) or --items, in a layout.
+$U vertical emberparadox/in-her-words --take draft-24 --reel short-ihw --clip full --json
+$U vertical emberparadox/mr-obvious --take mid-14 --reel short-die --post stack --json
+# 4. Or the cheapest: the take's finished 16:9 master recomposed 9:16, nothing cut again.
+$U vertical emberparadox/mr-obvious --take mid-14 --reel short-die --reframe --json
+```
+
+- **Layouts.** Clips: `--clip full` (a 9:16 crop full-bleed, big captions lit word by word, a source tag), `framed`
+ (the whole picture in the middle third over a blurred enlargement; `--hook title|section|"<copy>"` above it),
+ `quote` (the picture in the top 40 %, the words set large below, cited). Posts: `--post card` (attachment under
+ the words), `stack` (over them, the thread below), `media` (the attachment large on top). A clip with a side
+ post: `--side split` (the clip on top, the post rising into the bottom half) or `overlay` (floating over the
+ lower third). A clip's own `vertical.layout` beats `--clip`.
+- **Writes** `takes/<t>/out/<slug>.<reel>.<layout>.vertical.mp4` and its `.json` (the pieces, the loudness, the
+ notes); `--out FILE` names it. `--dry-run` says what it would cut; `--json` prints the record.
+- **The beats** are a reel's: `{id, start, end}` (a clip's source seconds), `{at, dur}` (master seconds: every item
+ under it, a post played from the part the span covers) or `{id}` (an item, whole). `umtool trailer <p> --reel <r>
+ --take <t> --vertical [--layout reframe]` is the same command.
+- **The cut itself vertical**: `umtool look <p> format='"vertical"' vertical='{"clip":"framed","post":"card"}'` (or
+ the same keys in a take's patch) renders the whole timeline 9:16 -- `umtool take` as ever.
+- `--landscape` builds the same items in the take's 16:9 look, to compare (a side post is a panel at the right).
+- Hooks only ever say the cut's own words: a clip's title, its section's title (the deck's marker), or a line you give.
+
## `check` is the one to run before every build
```
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -1208,6 +1208,41 @@ voice map a new read uses are `<p>`'s (`umtool posts say <p>`, `posts voices <p>
source project's. `--json` on a take-scoped edit is the command's own object with
`take: {id, edits, revisions, undo}`.
+## Vertical shorts (one format: clips, posts, side posts)
+
+The same timeline renders 16:9 or 9:16. `render.format: "vertical"` (a take's patch, or `umtool look`) builds the
+whole cut 1080x1920 at its fps; `umtool vertical` builds a short of a take's items without touching the cut
+([cli.md](cli.md#make-a-vertical-short-916-for-shorts-reels-and-tiktok)). No `format` key: the 16:9 render is byte for
+byte what it was.
+
+| Knob | Values (default) | What it does |
+|---|---|---|
+| `render.format` | `"landscape"` · `"vertical"` (absent = landscape) | the whole cut 9:16: no header, footer, QR, rail, deck or brand intro |
+| `render.vertical.clip` | `full` · `framed` · `quote` (`full`) | T1 a 9:16 crop full-bleed, captions in the lower middle, a source tag · T2 the whole picture in the middle third over a blurred enlargement, hook above, captions below · T3 the picture in the top 40 %, the line set large below, each word lit, "— channel · date" |
+| `render.vertical.post` | `card` · `stack` · `media` (`card`) | P1 the card at full width, its attachment under the words · P2 the attachment over them, the thread column below · P3 the attachment large on top (60 %), the words under it |
+| `render.vertical.side` | `split` · `overlay` (`split`) | a clip with a side post: M1 the clip in the top half, the post rising into the bottom half for its span · M2 the clip full-bleed, the post floating over the lower third (the captions move above it) |
+| `render.vertical.captions` | `{size: "l"\|"xl", lines: 1\|2}` (`xl`, 2) | large, at most two lines, each word lit as it is said |
+| `render.vertical.hook` | `false` · `"title"` · `"section"` · `{text}` (`false`) | the band over a framed clip: its title, its section's title (the deck's markers), or a line of the cut's own copy -- never invented commentary |
+| `render.vertical.tag` | `true` · `false` (`true`) | the small "channel · date" tag on a clip |
+| `render.vertical.safe` | `{top, bottom, right}` fractions (0.08, 0.2, 0.12) | kept clear of every caption, tag, card and post (the platforms' buttons) |
+| `render.vertical.loudness` | LUFS -30 … -8 (-14) | each clip levelled to it in its segment; the short brought to it at the end |
+| `render.vertical.maxSeconds` | 5 … 600 (60) | a short over it is said so (a note, never a refusal) |
+| a clip's `vertical` | `{crop: [x, y, w, h], aspect?, layout?}` | its 9:16 box on the source (else centred) and its own layout over the cut's |
+| a clip's `side` | `{item \| post, from, to, place?}` | a post shown BESIDE the clip while it plays: not read, the clip's sound on. `item` a post item of the cut, `post` its fields; `from`/`to` seconds into the clip; `place` `split`/`overlay` (vertical) or `right`/`left` (16:9: a panel over that side of the picture, sliding in) |
+
+| | From a terminal |
+|---|---|
+| a clip's crop, layout, side post | `umtool set <p> <clip> 'vertical.crop=[0.64,0,0.3164,1]' vertical.layout=quote side.item=<post item> side.from=1 side.to=9 side.place=overlay` (`side=` removes it; `--json`) |
+| the cut 9:16 | `umtool look <p> format='"vertical"' vertical='{"clip":"framed","hook":"section"}'` (`format='"landscape"'` back) |
+| a short of a take's items | `umtool vertical <p> --take <t> (--reel <r> \| --beats F \| --items a,b) [--clip …] [--post …] [--side …] [--hook …] [--json]` |
+| a reel 9:16 | `umtool trailer <p> --reel <r> --take <t> --vertical [--layout reframe]` |
+| R, recomposed from the master | `umtool vertical <p> --take <t> --reel <r> --reframe` (each item's footage box, card and attachment, the deck's date line; nothing cut again) |
+| the same items 16:9, to compare | `umtool vertical <p> --take <t> --reel <r> --landscape` |
+
+A clip's `vertical` and `side` are read from the PROJECT's manifest over the take's (they are set after the take was
+made). The side card is drawn by the post card's own page with the cut's redaction and the authors' pictures; its
+attachments are left off. Play the cut shows the side post over the clip for its span.
+
## Takes: relabel, supersede, cancel, delete, fork as variant, compare
| | In umtool | From a terminal | Route |
diff --git a/umtool/lib/report/knobsCli.mjs b/umtool/lib/report/knobsCli.mjs
@@ -53,9 +53,13 @@ const REVIEW_KEYS = ["verdict", "reason", "rejectNote", "correction"];
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"];
+export const VERTICAL_SET_KEYS = Object.freeze(["vertical", "vertical.crop", "vertical.layout", "vertical.aspect"]);
+export const SIDE_SET_KEYS = Object.freeze(["side", "side.item", "side.post", "side.from", "side.to", "side.place"]);
const SET_KEYS = [
...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",
+ // The vertical format (lane vertical): the clip's 9:16 crop and layout, and its side post.
+ ...VERTICAL_SET_KEYS, ...SIDE_SET_KEYS,
];
export const SET_USAGE = [
@@ -91,6 +95,11 @@ export const SET_USAGE = [
" chat=on shows the clip's live chat (its video's live_chat.cues.json, for the clip's source span) in a column",
" beside the footage; chat=off, or `chat=` (the default), does not. A video with no chat draws nothing and the",
" build log says so. The column's look: umtool look <p> chat.position=left (docs/knobs.md \"Live chat\").",
+ " vertical.crop='[x,y,w,h]' (fractions of the source: the 9:16 box a vertical render cuts; vertical.aspect the",
+ " source's w/h when not 16:9); vertical.layout=full|framed|quote (this clip's layout in a vertical cut).",
+ " side.item=<post item id> | side.post='{\"author\",\"handle\",\"date\",\"text\",…}' -- a post shown BESIDE the",
+ " clip while it plays, never read, the clip's sound running; side.from / side.to seconds into the clip;",
+ " side.place=split|overlay (vertical) | right|left (16:9). `side=` removes it (docs/knobs.md \"Vertical\").",
" 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`.",
@@ -205,6 +214,11 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso
entryPatch.layout = value;
continue;
}
+ if (VERTICAL_SET_KEYS.includes(key) || SIDE_SET_KEYS.includes(key)) {
+ // A post's id names a post item whatever it parses as; the rest as given (the writer checks them).
+ entryPatch[key] = key === "side.item" && value !== null ? String(value) : value;
+ continue;
+ }
if (key === "chat") {
// The live-chat column beside this clip (report-to-video chat.mjs): on|off|true|false; `chat=` clears it.
entryPatch.chat = chatFlag(value);
@@ -267,6 +281,8 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso
if ("blur" in entryPatch) results.blur = result.entry.blur ?? null;
if ("layout" in entryPatch) results.layout = result.entry.layout ?? "clip";
if ("chat" in entryPatch) results.chat = result.entry.chat ?? null;
+ if (VERTICAL_SET_KEYS.some((k) => k in entryPatch)) results.vertical = result.entry.vertical ?? null;
+ if (SIDE_SET_KEYS.some((k) => k in entryPatch)) results.side = result.entry.side ?? 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) {
results.gaps = result.entry.gaps ?? [];
@@ -298,6 +314,8 @@ export async function setCommand(args, { root = REPORTS_ROOT, out = (s) => conso
if ("layout" in results) out(`${clipId}: layout ${results.layout}`);
if ("chat" in results) out(`${clipId}: chat ${results.chat === true ? "on (its video's live_chat.cues.json beside the footage; the build says if there is none)" : results.chat === false ? "off" : "default (off)"}`);
if ("fx" in results) out(`${clipId}: fx ${results.fx ? JSON.stringify(results.fx) : "none"}`);
+ if ("vertical" in results) out(`${clipId}: vertical ${results.vertical ? JSON.stringify(results.vertical) : "the cut's (the centred crop)"}`);
+ if ("side" in results) out(`${clipId}: side ${results.side ? JSON.stringify({ ...results.side, ...(results.side.post ? { post: `@${results.side.post.handle ?? results.side.post.author}` } : {}) }) : "none"}`);
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 (results.review) {
const r = results.review;
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"]);
+ assert.deepEqual(LOOK_KEYS, ["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide", "blur", "intro", "format", "vertical"]);
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
@@ -38,6 +38,7 @@ import { validateThreadEntries } from "yt-dlp-transcript-common/lib/report/panel
import { validateAssist } from "yt-dlp-transcript-common/lib/clips/assist.mjs";
import { verticalErrors } from "umtool-report-to-video/look";
import { LOOK_KEYS, applyLookPatch, lookOf } from "yt-dlp-transcript-common/lib/report/look.mjs";
+import { sideErrors } from "yt-dlp-transcript-common/lib/report/vertical.mjs";
import { validateRoom } from "umtool-report-to-video/room";
import { applySectionEnter } from "./sections.mjs";
import { citeUrlAt, parseClipSpec } from "./clipEditorModel.mjs";
@@ -731,6 +732,28 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n
else throw new Error(`chat must be true or false, not ${JSON.stringify(patch.chat)}`);
}
+ // The vertical format (lane vertical, common lib/report/vertical.mjs): the clip's own 9:16 crop and layout
+ // (`vertical`), and the post it shows BESIDE it while it plays (`side`) -- a whole object, or one field
+ // (`vertical.crop`, `side.from`, …); null / "" removes it. Checked by the look's rules, as the build checks them.
+ for (const key of ["vertical", "side"]) {
+ // A whole `vertical` is the framing block's below (release 36); its fields are set here.
+ const whole = key === "vertical" ? undefined : patch[key];
+ const fields = Object.keys(patch).filter((k) => k.startsWith(`${key}.`));
+ if (whole === undefined && !fields.length) continue;
+ let next = whole !== undefined ? (whole === null || whole === "" ? null : whole) : { ...(entry[key] ?? {}) };
+ for (const k of fields) {
+ const f = k.slice(key.length + 1);
+ const v = patch[k];
+ if (next === null) next = {};
+ if (v === null || v === "") delete next[f];
+ else next[f] = v;
+ }
+ if (next === null || (typeof next === "object" && !Array.isArray(next) && !Object.keys(next).length)) delete entry[key];
+ else entry[key] = next;
+ const errors = key === "vertical" ? verticalErrors(entry.vertical, `${clipId}.vertical`) : sideErrors(entry.side, `${clipId}.side`, { itemIds: new Set((manifest.timeline ?? []).filter((e) => e?.type === "post").map((e) => e.id)) });
+ if (errors.length) throw new Error(errors.join("; "));
+ }
+
// ---- the walk's verdict -------------------------------------------------
//
// Whether somebody has LOOKED at this clip, and what they said: confirmed,
@@ -761,8 +784,13 @@ export function patchClipEntry(manifest, clipId, patch, { edit = "trim", now = n
const errors = verticalErrors(v, "vertical");
if (errors.length) throw new Error(errors.join("; "));
const r4 = (n) => Number(Number(n).toFixed(4));
- const vv = /** @type {{ crop: number[], aspect?: number }} */ (v);
- entry.vertical = { crop: vv.crop.map(r4), ...(vv.aspect !== undefined ? { aspect: r4(vv.aspect) } : {}) };
+ const vv = /** @type {{ crop?: number[], aspect?: number, layout?: string }} */ (v);
+ // `layout` (lane vertical): the clip's own layout in a vertical cut; a layout alone keeps the centred crop.
+ entry.vertical = {
+ ...(Array.isArray(vv.crop) ? { crop: vv.crop.map(r4) } : {}),
+ ...(vv.aspect !== undefined ? { aspect: r4(vv.aspect) } : {}),
+ ...(vv.layout !== undefined ? { layout: vv.layout } : {}),
+ };
}
}
diff --git a/umtool/lib/report/playView.mjs b/umtool/lib/report/playView.mjs
@@ -155,6 +155,9 @@ export async function playView(project, { take = null, bare = false } = {}) {
// Seconds taken out of its middle (gaps.mjs): the plan plays it as one item of jump cuts.
...(Array.isArray(e.gaps) && e.gaps.length ? { gaps: e.gaps } : {}),
blur: e.blur && typeof e.blur === "object" ? e.blur : null,
+ // Its SIDE POST (lane vertical, common lib/report/vertical.mjs): shown beside it over `from`-`to` (seconds
+ // into the clip as it plays), never read -- Play lays its card (the post-item route's `side` page) over the clip.
+ ...(e.side && typeof e.side === "object" && fin(e.side.from) && fin(e.side.to) ? { side: { from: e.side.from, to: e.side.to, place: typeof e.side.place === "string" ? e.side.place : null } } : {}),
// Rejected by the walk (a fact error -- doesn't match, wrong speaker -- or a cut
// reason: irrelevant, repeats, …): why, in words -- Play skips it unless asked to show it.
rejected: (() => {
diff --git a/umtool/lib/report/trailerCli.mjs b/umtool/lib/report/trailerCli.mjs
@@ -46,6 +46,9 @@ export const TRAILER_USAGE = [
"<slug>.trailer.mp4). With no --take: the reel's pinned take, else the take it was last cut from, else the",
"latest take with a finished master (said). The Trailer page's Cut the trailer runs exactly this.",
"",
+ "umtool trailer <project> --reel <name> --take <t> --vertical [--layout reframe] [--clip …] [--post …]: the reel",
+ "9:16 -- `umtool vertical` with the same reel (its usage says the layouts).",
+ "",
"umtool trailer <project> --candidates [--json]: the clips starred (★) on the walk, in the cut's order, as beats",
"over what each plays -- with --json exactly what --beats-json takes:",
" umtool trailer <p> --take <t> --beats-json \"$(umtool trailer <p> --candidates --json)\"",
@@ -119,6 +122,18 @@ async function realSlot() {
* @returns {Promise<number>}
*/
export async function trailerCommand(args, { reportsRoot = REPORTS_ROOT, log = console.log, err = console.error, deps = {} } = {}) {
+ // `--vertical` (lane vertical): the reel 9:16, natively or reframed -- `umtool vertical` with the same reel and take.
+ if (args.includes("--vertical")) {
+ const rest = args.filter((a) => a !== "--vertical");
+ const li = rest.indexOf("--layout");
+ if (li >= 0) {
+ const layout = rest[li + 1];
+ rest.splice(li, 2, ...(layout === "reframe" ? ["--reframe"] : []));
+ if (layout && layout !== "reframe") err(`umtool trailer --vertical: --layout ${layout} -- a native layout is set with --clip / --post / --side`);
+ }
+ const { verticalCommand } = await import("./verticalCli.mjs");
+ return verticalCommand(rest, { reportsRoot, log, err });
+ }
try {
const p = parse(args);
if (p.has("--help") || !p.positional.length) {
diff --git a/umtool/lib/report/verticalCli.mjs b/umtool/lib/report/verticalCli.mjs
@@ -0,0 +1,241 @@
+// `umtool vertical` (lane vertical, 5 Nov): a vertical short (1080x1920) of a
+// take's items -- a reel's beats, or a list of items -- built NATIVELY: each
+// clip cut again in its vertical layout, each post item drawn again in a
+// portrait box (report-to-video/vertical.mjs), through build-video in the
+// heavy slot. `--reframe` instead recomposes the take's finished 16:9 master
+// (report-to-video/reframe.mjs): the cheapest, for any finished cut.
+//
+// umtool vertical <project> --take <t> (--reel <r> | --beats FILE | --items a,b,…)
+// [--clip full|framed|quote] [--post card|stack|media] [--side split|overlay]
+// [--hook title|section|"<a line of the cut's copy>"] [--captions l|xl] [--lines 1|2]
+// [--loudness -14] [--max 60] [--name N] [--out FILE] [--reframe] [--dry-run] [--json]
+//
+// The plan is report-to-video/vertical-plan.mjs. Writes
+// takes/<t>/out/<slug>.<name>.<layout>.vertical.mp4 and a .json beside it.
+import { spawn } from "node:child_process";
+import { existsSync } from "node:fs";
+import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
+import path from "node:path";
+import { REPORTS_ROOT, resolveProject } from "../projects/core.mjs";
+import { kindMakesTakes } from "../projects/kinds.mjs";
+import { takesDirOf } from "./takes.mjs";
+import { readTrailerBeats, reelFileOf } from "./trailerBeats.mjs";
+import { PIPELINE_DIR, UMTOOL_DIR } from "./driver.mjs";
+
+export const VERTICAL_USAGE = [
+ "usage: umtool vertical <project> --take <t> (--reel <r> | --beats FILE | --items <id>,<id>…)",
+ " [--clip full|framed|quote] [--post card|stack|media] [--side split|overlay]",
+ " [--hook title|section|\"<a line of the cut's own copy>\"] [--captions l|xl] [--lines 1|2]",
+ " [--loudness -14] [--max 60] [--name N] [--out FILE] [--reframe] [--dry-run] [--json]",
+ "",
+ "A vertical short (1080x1920, the take's fps) of a take's items: a reel's beats (promo/<r>-beats.json, as",
+ "`umtool trailer --reel` reads them), a beats file, or whole items. Built natively: each clip cut again in",
+ "its layout -- full (a 9:16 crop, big captions lit word by word, a source tag), framed (the whole picture in",
+ "the middle third over a blurred enlargement, a hook above, captions below) or quote (the picture in the top",
+ "40 %, the words set large under it) -- each post item drawn again in a portrait box -- card (its attachment",
+ "under the words), stack (over them, the thread below) or media (the attachment large over the words) -- and",
+ "a clip with a side post (`umtool set <p> <clip> side.item=<post item>` …) in split (the clip on top, the post",
+ "rising into the bottom half) or overlay (the post floating over the lower third). Text keeps out of the",
+ "safe edges (top 8 %, bottom 20 %, right 12 %). The short is brought to -14 LUFS (--loudness), and one over",
+ "60 s (--max) is said so. A clip's vertical crop and layout and its side post are read from the PROJECT's",
+ "manifest over the take's. The hook only ever says the cut's own words: a clip's title, its section's title,",
+ "or a line you give it from the cut's copy.",
+ "--reframe recomposes the take's finished 16:9 master instead (each item's region -- the footage, the post's",
+ "card and attachment, the deck's date line -- laid out 9:16): nothing is cut again, any finished take.",
+ "Writes takes/<t>/out/<slug>.<name>.<layout>.vertical.mp4 (--out: that file) and a .json beside it. The build",
+ "runs in the heavy slot, as a take's does.",
+].join("\n");
+
+class CliError extends Error {}
+
+const VALUED = new Set(["--take", "--reel", "--beats", "--items", "--clip", "--post", "--side", "--hook", "--captions", "--lines", "--loudness", "--max", "--name", "--out"]);
+const BOOL = new Set(["--reframe", "--landscape", "--dry-run", "--json", "--help"]);
+
+function parse(args) {
+ /** @type {Record<string, string>} */
+ const flags = {};
+ const positional = [];
+ for (let i = 0; i < args.length; i += 1) {
+ const a = args[i];
+ if (a.startsWith("--")) {
+ if (VALUED.has(a)) {
+ if (i + 1 >= args.length) throw new CliError(`${a} needs a value`);
+ flags[a] = args[++i];
+ } else if (BOOL.has(a)) flags[a] = "";
+ else throw new CliError(`unknown flag ${a}`);
+ } else positional.push(a);
+ }
+ return { flags, positional, has: (n) => n in flags };
+}
+
+/** The vertical knobs the flags ask for (render.vertical's shape), over the cut's own. */
+export function knobsOfFlags(flags) {
+ /** @type {Record<string, any>} */
+ const k = {};
+ if (flags["--clip"]) k.clip = flags["--clip"];
+ if (flags["--post"]) k.post = flags["--post"];
+ if (flags["--side"]) k.side = flags["--side"];
+ if (flags["--hook"]) k.hook = ["title", "section", "false"].includes(flags["--hook"]) ? (flags["--hook"] === "false" ? false : flags["--hook"]) : { text: flags["--hook"] };
+ if (flags["--captions"] || flags["--lines"]) {
+ k.captions = {};
+ if (flags["--captions"]) k.captions.size = flags["--captions"];
+ if (flags["--lines"]) k.captions.lines = Number(flags["--lines"]);
+ }
+ if (flags["--loudness"] !== undefined) k.loudness = Number(flags["--loudness"]);
+ if (flags["--max"] !== undefined) k.maxSeconds = Number(flags["--max"]);
+ return k;
+}
+
+const readJson = (file) => readFile(file, "utf8").then((t) => JSON.parse(t), () => null);
+
+/** Run a process, its output to `log`; resolves to its exit code. */
+function run(argv, { cwd, log }) {
+ return new Promise((resolve, reject) => {
+ const child = spawn(argv[0], argv.slice(1), { cwd, stdio: ["ignore", "pipe", "pipe"] });
+ const lines = (b) => {
+ for (const line of b.toString().split("\n")) if (line.trim()) log(line);
+ };
+ child.stdout.on("data", lines);
+ child.stderr.on("data", lines);
+ child.on("error", reject);
+ child.on("close", (code) => resolve(code ?? 1));
+ });
+}
+
+/**
+ * `umtool vertical …`
+ * @param {string[]} args everything after `vertical`
+ * @param {{ reportsRoot?: string, log?: (s: string) => void, err?: (s: string) => void }} [opts]
+ * @returns {Promise<number>}
+ */
+export async function verticalCommand(args, { reportsRoot = REPORTS_ROOT, log = console.log, err = console.error } = {}) {
+ const V = await import("umtool-report-to-video/vertical");
+ const P = await import("umtool-report-to-video/vertical-plan");
+ try {
+ const p = parse(args);
+ if (p.has("--help") || !p.positional.length) {
+ log(VERTICAL_USAGE);
+ return p.has("--help") ? 0 : 2;
+ }
+ const json = p.has("--json");
+ const say = json ? err : log;
+ const r = await resolveProject(p.positional[0], reportsRoot);
+ if (r.ambiguous) throw new CliError(`"${p.positional[0]}" is the name of ${r.ambiguous.length} projects — pass its id`);
+ if (!r.project) throw new CliError(`no project matches "${p.positional[0]}"`);
+ if (!kindMakesTakes(r.project.kind)) throw new CliError(`${r.project.id} is a ${r.project.kind}, not a report video`);
+ const dir = r.project.dir;
+ const reel = p.flags["--reel"] ?? null;
+ let take = p.flags["--take"] ?? null;
+ let beats = null;
+ if (reel) {
+ const doc = await readTrailerBeats(dir, { reel });
+ if (!doc.exists) throw new CliError(`no reel ${reel}: ${reelFileOf(reel)} is not there`);
+ beats = P.beatsOf(doc.beats);
+ take ??= doc.settings?.take ?? null;
+ } else if (p.has("--beats")) {
+ const doc = await readJson(path.resolve(p.flags["--beats"]));
+ if (!doc) throw new CliError(`--beats ${p.flags["--beats"]}: not a JSON file`);
+ beats = P.beatsOf(doc);
+ }
+ const items = p.has("--items") ? p.flags["--items"].split(",").map((s) => s.trim()).filter(Boolean) : null;
+ if (!beats && !items) throw new CliError("--reel <r>, --beats FILE or --items <id>,…: what the short is made of");
+ if (!take) throw new CliError("--take <t>: the take whose items the short is cut from");
+ if (!/^[a-z0-9][a-z0-9-]*$/.test(take)) throw new CliError(`--take ${take}: a take id`);
+ const takeDir = path.join(takesDirOf(dir), take);
+ // The take's manifest as rendered, else (a draft, never rendered) the project's with the take's patch laid on.
+ let takeManifest = await readJson(path.join(takeDir, "video.manifest.json"));
+ if (!takeManifest) {
+ const { resolveTakeManifest } = await import("./takeManifest.mjs");
+ takeManifest = await resolveTakeManifest(dir, take).then((x) => x.manifest, (e) => {
+ throw new CliError(`take ${take}: ${e instanceof Error ? e.message : e}`);
+ });
+ }
+ const projectManifest = await readJson(path.join(dir, "video.manifest.json"));
+ const outDir = path.join(takeDir, "out");
+ const sourced = path.join(outDir, "sourced");
+ const schedule = await readJson(path.join(sourced, "schedule.json"));
+ const knobs = knobsOfFlags(p.flags);
+ const errors = V.validateVerticalRender({ render: { format: "vertical", vertical: { ...(takeManifest.render?.vertical ?? {}), ...knobs } } });
+ if (errors.length) throw new CliError(errors.join("; "));
+ const name = P.shortName({ reel, name: p.flags["--name"] ?? null });
+ const reframe = p.has("--reframe");
+ // `--landscape`: the same items in the take's own 16:9 look (a side post as a panel), for comparison.
+ const landscape = p.has("--landscape");
+ if (landscape && reframe) throw new CliError("--landscape or --reframe, not both");
+ const tag = landscape ? "landscape" : P.layoutTag(knobs, { reframe });
+ const slug = takeManifest.slug ?? r.project.id.split("/").pop();
+ const outFile = p.flags["--out"] ? path.resolve(p.flags["--out"]) : path.join(outDir, `${slug}.${name}.${tag}${landscape ? "" : ".vertical"}.mp4`);
+ const cuts = new Map();
+ for (const e of takeManifest.timeline ?? []) {
+ if (e?.type !== "clip") continue;
+ const c = await readJson(path.join(sourced, "segments", `${e.id}.cut.json`));
+ if (c) cuts.set(e.id, c);
+ }
+ const plan = P.planVerticalCut({ timeline: takeManifest.timeline ?? [], beats, items, schedule, cuts, project: projectManifest?.timeline ?? [] });
+ if (p.has("--dry-run")) {
+ const out = { project: r.project.id, take, name, layout: tag, wouldWrite: outFile, pieces: plan.pieces, items: plan.timeline.map((e) => ({ id: e.id, type: e.type, start: e.start, end: e.end })) };
+ log(json ? JSON.stringify(out, null, 2) : [`would write ${outFile}`, ...plan.pieces.map((x) => ` ${x.id}${x.to === null ? "" : ` ${x.from}–${x.to}`}`)].join("\n"));
+ return 0;
+ }
+ const started = Date.now();
+ let made;
+ if (reframe) {
+ const RF = await import("umtool-report-to-video/reframe");
+ made = await RF.reframeTake({ takeDir, outDir, slug, beats, items, plan, render: { ...takeManifest.render, vertical: { ...(takeManifest.render?.vertical ?? {}), ...knobs } }, outFile, log: say });
+ } else if (landscape) {
+ const renderPath = path.join(dir, `.vertical-${take}-${name}.render.json`);
+ await writeFile(renderPath, JSON.stringify({ ...takeManifest, render: P.renderForPart(takeManifest.render, plan.timeline), timeline: plan.timeline }, null, 2) + "\n", "utf8");
+ const own = path.join(takeDir, `out-landscape-${name}`);
+ const argv = [process.execPath, path.join(PIPELINE_DIR, "build-video.mjs"), renderPath, "--out", own, "--skip-fetch", "--no-chapters"];
+ say(`vertical --landscape: building ${plan.timeline.length} item(s) 16:9 in the heavy slot …`);
+ const code = await run(argv, { cwd: path.join(UMTOOL_DIR, ".."), log: say }).finally(() => rm(renderPath, { force: true }));
+ if (code !== 0) throw new CliError(`the landscape build exited ${code}`);
+ const RF = await import("umtool-report-to-video/reframe");
+ await mkdir(path.dirname(outFile), { recursive: true });
+ await writeFile(outFile, await readFile(path.join(own, `${slug}.mp4`)));
+ made = { seconds: await RF.probeSeconds(outFile), loudness: null };
+ } else {
+ // The build's manifest: the take's render, the planned items; beside the project's manifest, so its files resolve.
+ const renderPath = path.join(dir, `.vertical-${take}-${name}.render.json`);
+ const doc = { ...takeManifest, timeline: plan.timeline };
+ await writeFile(renderPath, JSON.stringify(doc, null, 2) + "\n", "utf8");
+ const work = `vertical-${name}-${tag}`;
+ const sections = V.sectionTitlesOf(takeManifest);
+ const built = path.join(outDir, `${slug}.${name}.${tag}.vertical-build.mp4`);
+ const argv = [
+ process.execPath, path.join(PIPELINE_DIR, "build-video.mjs"), renderPath, "--out", outDir,
+ "--skip-fetch", "--no-chapters", "--vertical", "--vertical-knobs", JSON.stringify(knobs), "--vertical-work", work, "--vertical-out", built,
+ // The hook "section" names a clip's section in the WHOLE take (each planned entry under its source's id).
+ "--vertical-sections", JSON.stringify(Object.fromEntries(plan.timeline.map((e) => [e.id, sections.get(e.id.replace(/~\d+$/, "")) ?? null]))),
+ ];
+ say(`vertical: building ${plan.timeline.length} item(s) 9:16 in the heavy slot …`);
+ const code = await run(argv, { cwd: path.join(UMTOOL_DIR, ".."), log: say }).finally(() => rm(renderPath, { force: true }));
+ if (code !== 0) throw new CliError(`the vertical build exited ${code}`);
+ const RF = await import("umtool-report-to-video/reframe");
+ made = await RF.assembleShort({
+ pieces: plan.pieces, segmentsDir: path.join(outDir, work, "segments"), built, outFile,
+ render: { ...takeManifest.render, vertical: { ...(takeManifest.render?.vertical ?? {}), ...knobs } }, log: say,
+ });
+ }
+ const record = {
+ version: 1, kind: "vertical-short", project: r.project.id, take, name, layout: tag, reframe,
+ knobs, pieces: plan.pieces, seconds: made.seconds, loudness: made.loudness ?? null,
+ notes: V.verticalNotes({ format: "vertical", vertical: knobs }, made.seconds), out: outFile,
+ madeAt: new Date().toISOString(), buildSeconds: Math.round((Date.now() - started) / 1000),
+ };
+ await writeFile(outFile.replace(/\.mp4$/, ".json"), JSON.stringify(record, null, 2) + "\n", "utf8");
+ if (json) log(JSON.stringify(record, null, 2));
+ else {
+ for (const n of record.notes) log(`note: ${n}`);
+ log(`wrote ${outFile} (${made.seconds.toFixed(1)} s, 1080x1920)`);
+ }
+ return 0;
+ } catch (e) {
+ if (e instanceof CliError || e?.name === "VerticalPlanError") {
+ err(`umtool vertical: ${e.message}`);
+ return 2;
+ }
+ throw e;
+ }
+}
+
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -216,6 +216,14 @@ import {
// The snap itself (a montage's window snaps with it too), re-exported for the tests.
import { snap } from "./snap.mjs";
import { buildPostSegment } from "./post-render.mjs";
+// THE VERTICAL FORMAT (lane vertical): render.format "vertical" (or --vertical) builds the cut 9:16 -- each clip in
+// its layout (vertical.mjs), each post item in a portrait box -- and a clip's side post (side-card.mjs) in either format.
+import {
+ clipGeometry, clipVerticalLayout, landscapeSideGeometry, landscapeSideOverlay, sidePostOf, sideSpan, sourceTagText,
+ sectionTitlesOf, validateVerticalRender, verticalAss, verticalClipGraph, verticalHookOf, verticalNotes, verticalOn,
+ verticalPostBox, verticalPostEntry, verticalRender,
+} from "./vertical.mjs";
+import { renderSideCard, sideFitFilter } from "./side-card.mjs";
import { TRAILER_AUDIO, trailerHitsGraph } from "./trailer-hits.mjs";
import { planContext, planContextOf } from "./post-conversation.mjs";
@@ -1745,11 +1753,79 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes,
return blurPictureFilters({ blur, span, h, layout, lineFiles, render });
};
+ // 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;
+ if (entry.side && !sidePost) EMIT("note", { message: `${entry.id}: its side names no post the cut has — it plays without one` });
+ const sideCard = async (w, h) => {
+ const card = await renderSideCard(sidePost, {
+ width: w, height: h, render, avatars: dirs.sides.avatars, redaction: dirs.sides.redaction,
+ file: path.join(outDir, "segments", `${entry.id}.side.png`),
+ });
+ cutRecord.side = { post: sidePost.id ?? null, from: sideUp.from, to: sideUp.to, width: w, height: h };
+ return ["-loop", "1", "-framerate", String(render.fps), "-t", (segSeconds + 1).toFixed(3), "-i", card.file];
+ };
+
+ // A VERTICAL cut (vertical.mjs): the clip in its layout -- full, framed or quote, or split / overlay when it
+ // carries a side post -- its captions lit word by word, its tag and hook, as one ASS file. A source with no
+ // picture keeps the plain path's poster.
+ if (dirs.vertical && media.hasVideo) {
+ const layout = clipVerticalLayout(entry, render);
+ const geo = clipGeometry(layout, render, width, height);
+ const [sw, sh] = await probeDims(raw);
+ const inputs = cutArgs(raw, segA, segB);
+ let next = 1;
+ let ain = "[0:a]";
+ if (soundInput) {
+ ain = `[${next}:a]`;
+ next += 1;
+ inputs.push(...soundInput);
+ }
+ let side = null;
+ if (sideUp && geo.card) {
+ inputs.push(...(await sideCard(geo.card.w, geo.card.h)));
+ side = { idx: next, ...sideUp };
+ next += 1;
+ }
+ const g = gapped(ain);
+ const graph = verticalClipGraph({
+ geo, srcW: sw, srcH: sh, crop: entry.vertical?.crop ?? null, blur: await blurPicture(sw, sh), side, fps: render.fps, W: width, H: height,
+ });
+ const tag = sourceTagText({ channel: channelName(entry, meta, provenance), date: entry.date ?? uploadDateToIso(meta.uploadDate) });
+ const cap = await segmentCaptions({
+ entry, provenance, look: dirs.look, render, outDir, from: cutRecord.start, seconds: segSeconds, bottom: 0, gaps: cutRecord.gaps ?? [],
+ vertical: { geo, tag, hook: verticalHookOf(entry, render, dirs.vertical.sections), side: sideUp },
+ });
+ cutRecord.vertical = { layout, crop: entry.vertical?.crop ?? null, width, height, ...(cap ? { captions: cap.lines } : {}) };
+ await encodeClipSegment({
+ seg, outDir, render, opts, id: entry.id, record: cutRecord,
+ argv: [
+ "-nostdin", "-v", "error", "-y",
+ ...inputs,
+ "-filter_complex", [
+ ...g.parts,
+ ...levelParts(null, g.a),
+ `${g.v}${graph}[vp]`,
+ cap ? `[vp]${cap.filter}[v]` : "[vp]null[v]",
+ ].join(";"),
+ "-map", "[v]", "-map", audioMap,
+ ...encodeArgs(render),
+ seg,
+ ],
+ });
+ return seg;
+ }
+
if (deckOn(render)) {
const fr = framing ?? segmentFraming(render);
const pst = await poster(fr.box, 1);
const picture = await blurPicture(fr.box.width, fr.box.height);
const g = gapped(soundInput ? `[${pst ? 2 : 1}:a]` : "[0:a]");
+ // A side post: a panel over the box's right (or left) while it is up, its card the LAST input.
+ const sideGeo = sideUp ? landscapeSideGeometry({ x: fr.box.x, y: fr.box.y, w: fr.box.width, h: fr.box.height }, entry.side.place) : null;
+ const sideInput = sideGeo ? await sideCard(sideGeo.w, sideGeo.h) : [];
+ const sideIdx = 1 + (pst ? 1 : 0) + (soundInput ? 1 : 0);
+ const framed = `${pst ? "[pic]" : g.v}${deckFramingFilter(render, { feed: fr.layout === "feed", picture })}`;
// The box it was framed into, so --chrome-only can refuse another layout's.
await encodeClipSegment({
seg, outDir, render, opts, id: entry.id, record: { ...cutRecord, framing: fr },
@@ -1758,10 +1834,13 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes,
...cutArgs(raw, segA, segB),
...(pst ? pst.input : []),
...(soundInput ?? []),
+ ...sideInput,
"-filter_complex", [
...g.parts,
...levelParts(pst ? pst.parts : null, g.a),
- `${pst ? "[pic]" : g.v}${deckFramingFilter(render, { feed: fr.layout === "feed", picture })}[v]`,
+ ...(sideGeo
+ ? [`${framed}[vb]`, `[${sideIdx}:v]${sideFitFilter(sideGeo.w, sideGeo.h)}[vsc]`, `[vb][vsc]${landscapeSideOverlay(sideGeo, sideUp, render.width)}[v]`]
+ : [`${framed}[v]`]),
].join(";"),
"-map", "[v]", "-map", audioMap,
...encodeArgs(render),
@@ -1929,6 +2008,14 @@ async function buildClipSegment(entry, meta, render, dirs, opts, chrome, nodes,
}
}
if (dirs.short) cutRecord.short = { crop: entry.vertical?.crop ?? null, width, height };
+ // A side post: a panel over the picture's right (or left) while it is up, its card the LAST input.
+ if (sideUp && !dirs.short) {
+ const sideGeo = landscapeSideGeometry({ x: 0, y: HH, w: VW, h: VH }, entry.side.place);
+ inputs.push(...(await sideCard(sideGeo.w, sideGeo.h)));
+ parts.push(`[${nextIdx}:v]${sideFitFilter(sideGeo.w, sideGeo.h)}[vsc]`, `${vOut}[vsc]${landscapeSideOverlay(sideGeo, sideUp, width)}[vsd]`);
+ nextIdx += 1;
+ vOut = "[vsd]";
+ }
await encodeClipSegment({
seg, outDir, render, opts, id: entry.id,
@@ -1999,7 +2086,7 @@ function lookWordsFor(entry, provenance, look, from, to) {
* and the filter that burns it in, or null (a note) when the clip has no
* words. `from` is the source second the segment starts at.
*/
-async function segmentCaptions({ entry, provenance, look, render, outDir, from, seconds, bottom, audible = null, gaps = [] }) {
+async function segmentCaptions({ entry, provenance, look, render, outDir, from, seconds, bottom, audible = null, gaps = [], vertical = null }) {
// `audible` (room at the edges): the words of that span only, and no line past its end.
const src = await lookWordsFor(entry, provenance, look, audible ? audible.from : from, audible ? audible.to : from + seconds);
if (audible) seconds = Math.min(seconds, audible.to - from);
@@ -2011,11 +2098,18 @@ async function segmentCaptions({ entry, provenance, look, render, outDir, from,
}
if (!src.words.length) {
EMIT("note", { message: `${entry.id}: no words to caption — it plays without captions` });
- return null;
+ if (!vertical) return null;
}
const rel = gaps.length
? (x) => ({ ...x, start: offsetIn(x.start, from, gaps), end: offsetIn(x.end, from, gaps) })
: (x) => ({ ...x, start: x.start - from, end: x.end - from });
+ // A vertical clip (vertical.mjs): its words lit as said, its tag, hook and quote, one document.
+ if (vertical) {
+ const file = path.join(outDir, "segments", `${entry.id}.vertical.ass`);
+ const words = src.words.map(rel);
+ await replaceFile(file, verticalAss({ geo: vertical.geo, render, words, seconds, tag: vertical.tag, hook: vertical.hook, side: vertical.side, W: render.width, H: render.height }));
+ return { filter: assFilter(file, FONTS_DIR), lines: words.length, wordsFrom: src.wordsFrom };
+ }
const size = render.captions?.size ?? "m";
const geo = captionGeometry({ width: render.width, height: render.height, size, bottom });
const lines = captionLines({
@@ -6260,6 +6354,19 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
if (e.type !== "clip") throw new Error(`${opts.short} is a ${e.type ?? "non-clip"} entry: a short is made from a clip`);
manifest.render = shortRender(manifest.render ?? {});
}
+ // A VERTICAL cut (vertical.mjs): the manifest's own render.format, or `--vertical` (with its knobs,
+ // opts.verticalKnobs) on a landscape one. 1080x1920, no header, footer, QR, rail or deck.
+ const vertical = !!opts.vertical || verticalOn(manifest.render);
+ if (vertical) {
+ if (opts.short) throw new Error("--short builds one clip's short; a vertical cut is the whole cut's: not both");
+ const knobs = opts.verticalKnobs && typeof opts.verticalKnobs === "object" ? opts.verticalKnobs : null;
+ const asked = { ...(manifest.render ?? {}), format: "vertical", ...(knobs ? { vertical: { ...(manifest.render?.vertical ?? {}), ...knobs } } : {}) };
+ const errors = validateVerticalRender({ render: asked });
+ if (errors.length) throw new Error(`vertical: ${errors.join("; ")}`);
+ manifest.render = verticalRender(asked);
+ // The brand intro is a landscape page: a short opens on its first moment.
+ manifest.timeline = (manifest.timeline ?? []).filter((e) => !isIntro(e));
+ }
// A join preview (release 38, join-preview.mjs): the first few joins of
// the cut, each clip shortened to a few seconds at the join, in the cut's look.
if (opts.joinPreview) {
@@ -6352,6 +6459,11 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
const dirs = variantPaths(outRoot, manifest.slug, variant);
// A short's work is its own: the cut's segments are never overwritten by one.
if (opts.short) dirs.dir = path.join(outRoot, "shorts-work");
+ // So is a vertical build of a landscape cut (`--vertical`): its own work dir and file (`--vertical-out` names it).
+ if (vertical && !verticalOn(whole.render)) {
+ dirs.dir = path.join(outRoot, opts.verticalWork ?? "vertical");
+ dirs.final = opts.verticalOut ? path.resolve(opts.verticalOut) : path.join(outRoot, `${manifest.slug}.vertical.mp4`);
+ }
// A join preview's too: its own work dir and file, the cut's out/ untouched.
if (opts.joinPreview) {
dirs.dir = path.join(outRoot, "join-preview-work");
@@ -6371,7 +6483,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
});
FX_CHANNELS_DIR = channelsDir;
// Read only for a cut that plays post items: a cut without them publishes nothing it could blank.
- POST_REDACTION = (manifest.timeline ?? []).some((e) => e?.type === "post") ? await readPostRedaction(channelsDir, manifest, { uncensored: opts.uncensored === true }) : null;
+ POST_REDACTION = (manifest.timeline ?? []).some((e) => e?.type === "post" || (e?.type === "clip" && e.side)) ? await readPostRedaction(channelsDir, manifest, { uncensored: opts.uncensored === true }) : null;
// Which cut this is (post-slurs.mjs): censored, or the uncensored one.
if (POST_REDACTION?.slurs) {
const sl = POST_REDACTION.slurs;
@@ -6381,6 +6493,9 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
// manifest (readLookSources); a short is framed by its clip's crop.
if (captionsOn(render)) dirs.look = await readLookSources(manifestDir);
if (opts.short) dirs.short = { id: opts.short };
+ // A vertical cut's hooks may name a clip's section: the deck's markers, read from the cut as written.
+ // A short of a take's items (umtool vertical) passes the WHOLE take's sections: its own timeline is a part of it.
+ if (vertical) dirs.vertical = { on: true, sections: opts.verticalSections ? new Map(Object.entries(opts.verticalSections)) : sectionTitlesOf(whole) };
// A project's out/ first, through ensureOutDir: with UMTOOL_MEDIA_DIR set it
// is a link to the media root, and the recursive mkdirs below would
@@ -6523,6 +6638,12 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
? reservedFooter(render)
: await renderFooterAssets(render, manifest.timelineNodes, outDir);
+ // A vertical cut lays each post item for a portrait box (vertical.mjs verticalPostEntry: the run's copy).
+ if (vertical) manifest.timeline = manifest.timeline.map((e) => verticalPostEntry(e, render));
+ // A clip's side post (side-card.mjs) is drawn with the cut's redaction and the authors' pictures.
+ if (manifest.timeline.some((e) => e?.type === "clip" && e.side)) {
+ dirs.sides = { timeline: manifest.timeline, avatars: avatarUrls(manifest, (src) => path.resolve(manifestDir, src)), redaction: POST_REDACTION };
+ }
const entries = manifest.timeline.filter((e) => !only || e.id === only);
if (only && !entries.length) throw new Error(`no timeline entry with id ${only}`);
// The combo counter (post-combo.mjs): each post item's repeat of an earlier one's attachment, counted
@@ -6639,7 +6760,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
// A post item (post-render.mjs): its card drawn from the archived post, its attachments laid in.
EMIT("card", { id: entry.id, i, n: entries.length });
const fr = deck ? framing ?? segmentFraming(render) : null;
- const df = fr ? deckFraming(render, { feed: fr.layout === "feed" }) : null;
+ const df = fr ? deckFraming(render, { feed: fr.layout === "feed" }) : vertical ? verticalPostBox(render) : null;
const seg = await buildPostSegment(entry, {
render, outDir, manifestDir,
box: df ? { width: df.box.width, height: df.box.height } : { width: render.width, height: render.height },
@@ -7322,6 +7443,7 @@ async function main() {
"usage: build-video.mjs <manifest.json> [--out <dir>] [--variant sourced|full]\n" +
" [--only <id>] [--fetch-only <id>] [--short <id>] (a vertical short of one clip: <project>/shorts/<id>.mp4)\n" +
" [--join-preview [--join-from <id>]] (the first few joins, a few seconds each side: out/join-preview.mp4)\n" +
+ " [--vertical [--vertical-knobs <json>] [--vertical-work <dir>] [--vertical-out <file>]] (the cut 9:16: out/<slug>.vertical.mp4)\n" +
" [--pad <s>] [--pad-before <s>] [--pad-after <s>] [--skip-fetch] [--no-network] [--audio-fallback] [--no-xfade] [--no-chapters] [--chapters-only]\n" +
" [--progress ndjson] [--continue-on-error] [--no-reuse] [--no-segment-cache]\n" +
" [--no-rail] [--rail-only] [--preview <start> <dur>]\n" +
@@ -7376,6 +7498,12 @@ async function main() {
short: flag("--short") ?? null,
clipPreview: flag("--clip-preview") ?? null,
joinPreview: argv.includes("--join-preview") ? { from: flag("--join-from") ?? null } : null,
+ // A vertical build of the cut (vertical.mjs): its knobs over the cut's render.vertical, its work dir and its file.
+ vertical: argv.includes("--vertical"),
+ verticalKnobs: flag("--vertical-knobs") ? JSON.parse(flag("--vertical-knobs")) : null,
+ verticalWork: flag("--vertical-work") ?? null,
+ verticalOut: flag("--vertical-out") ?? null,
+ verticalSections: flag("--vertical-sections") ? JSON.parse(flag("--vertical-sections")) : null,
};
try {
Object.assign(opts, chromeFlags(argv));
diff --git a/umtool/report-to-video/package.json b/umtool/report-to-video/package.json
@@ -22,6 +22,10 @@
"./brand": "./brand.mjs",
"./brand-ids": "./brand-ids.mjs",
"./build-video": "./build-video.mjs",
+ "./vertical": "./vertical.mjs",
+ "./vertical-plan": "./vertical-plan.mjs",
+ "./reframe": "./reframe.mjs",
+ "./side-card": "./side-card.mjs",
"./check-availability": "./check-availability.mjs",
"./check-joins": "./check-joins.mjs",
"./chunked-encode": "./chunked-encode.mjs",
diff --git a/umtool/report-to-video/post-item.mjs b/umtool/report-to-video/post-item.mjs
@@ -745,13 +745,17 @@ export function postLayout(entry, { width, height }) {
}
// A WIDE attachment (operator, 4 Nov: "for these super wide images a top-bottom layout would be better"): at full
// width above (or below) the card, never a side panel -- `panel`, else the cut's rule (panelEntry).
- const panel = panelOf(entry);
+ // A PORTRAIT box (a vertical cut, vertical.mjs) never lays the attachments beside the words: under them.
+ const tall = height > width;
+ const panel = tall && panelOf(entry) === "side" ? "bottom" : panelOf(entry);
if (panel === "top" || panel === "bottom") {
const first = shown[0] ?? {};
const crop = Array.isArray(first.crop) ? first.crop : null;
const ar = ((first.width ?? 16) * (crop ? crop[2] : 1)) / Math.max(1, (first.height ?? 9) * (crop ? crop[3] : 1));
const fullW = width - 2 * pad;
- const slotH = Math.max(Math.round(120 * k), Math.min(Math.round(fullW / Math.max(0.2, ar)), Math.round(height * POST_PANEL_SHARE)));
+ // A portrait box gives the panel its own share (`panelShare`, vertical.mjs's media-first layout) or POST_PANEL_SHARE_TALL.
+ const share = tall ? (fin(entry?.panelShare) ? clamp(entry.panelShare, 0.2, 0.75) : POST_PANEL_SHARE_TALL) : POST_PANEL_SHARE;
+ const slotH = Math.max(Math.round(120 * k), Math.min(Math.round(fullW / Math.max(0.2, ar)), Math.round(height * share)));
const cw = Math.min(fullW, Math.round(1500 * k));
const cardH = height - 3 * pad - slotH;
const slotY = panel === "top" ? pad : height - pad - slotH;
@@ -779,6 +783,8 @@ export function postLayout(entry, { width, height }) {
/** A wide panel's height: at most this share of the box. */
export const POST_PANEL_SHARE = 0.42;
+/** In a portrait box (a vertical cut): at most this share. */
+export const POST_PANEL_SHARE_TALL = 0.45;
/** The cut's rule for a wide attachment (`render.posts.panel`): at this width ÷ height or more, laid at full width `place`. */
export const POST_PANEL_DEFAULTS = Object.freeze({ wide: 2.0, place: "top" });
diff --git a/umtool/report-to-video/post-render.mjs b/umtool/report-to-video/post-render.mjs
@@ -406,7 +406,7 @@ export function trackExpr(track, axis) {
return `+(${e})`;
}
-async function loadChromium() {
+export async function loadChromium() {
let mod;
try {
mod = await import("@playwright/test");
diff --git a/umtool/report-to-video/reframe.mjs b/umtool/report-to-video/reframe.mjs
@@ -0,0 +1,245 @@
+// A VERTICAL SHORT'S LAST STEPS (lane vertical): the pieces joined and brought
+// to the short's loudness (assembleShort), and R -- the REFRAME -- a short
+// recomposed from a finished take's 16:9 master, nothing cut again
+// (reframeTake).
+//
+// R lays each item's regions of the master into 9:16 over a blurred,
+// darkened enlargement of them:
+// a clip its footage box (the take's cut record, `framing.box`) at full
+// width in the middle, the schedule's title and subtitle (the
+// deck's date and source line) above it
+// a post its card's box over its attachment's box (post-item.mjs
+// postLayout on the footage box), stacked and fitted inside the
+// safe area; a post with no attachment, its card alone
+// Its text comes from the take's own schedule: nothing is written that the
+// cut does not say.
+import { execFile } from "node:child_process";
+import { mkdir, readFile, rename, rm, writeFile } from "node:fs/promises";
+import path from "node:path";
+import { promisify } from "node:util";
+import { postLayout } from "./post-item.mjs";
+import { VERTICAL_HEIGHT, VERTICAL_WIDTH, safeArea, verticalKnobs } from "./vertical.mjs";
+import { assColour, assTime, captionText } from "./look.mjs";
+
+const execFileP = promisify(execFile);
+const FFMPEG = process.env.FFMPEG ?? "ffmpeg";
+const FFPROBE = process.env.FFPROBE ?? "ffprobe";
+const even = (n) => Math.max(2, 2 * Math.round(n / 2));
+const f3 = (n) => Number(n).toFixed(3);
+const readJson = (file) => readFile(file, "utf8").then((t) => JSON.parse(t), () => null);
+
+/** The short's encode: the take's settings, at 1080x1920. */
+export const shortEncode = (render) => [
+ "-c:v", "libx264", "-preset", render?.preset ?? "medium", "-crf", String(render?.crf ?? 20), "-pix_fmt", "yuv420p",
+ "-r", String(render?.fps ?? 30), "-c:a", "aac", "-b:a", render?.audioBitrate ?? "160k", "-ar", String(render?.audioRate ?? 48000),
+ "-ac", String(render?.audioChannels ?? 2), "-movflags", "+faststart",
+];
+
+/** A file's length (s). */
+export async function probeSeconds(file) {
+ const { stdout } = await execFileP(FFPROBE, ["-v", "error", "-show_entries", "format=duration", "-of", "default=nw=1:nk=1", file]);
+ return Number(stdout.trim());
+}
+
+/** The heavy slot (heavy-gate.mjs) around an encode, with a small declared estimate. */
+async function inSlot(cmd, fn) {
+ const { withRenderSlot } = await import("./heavy-gate.mjs");
+ return withRenderSlot(cmd, fn, { estimateMb: 1500 });
+}
+
+/** The loudnorm filter's two passes: measured, then applied linearly at `target` LUFS. Returns the measure. */
+export async function normalizeLoudness(input, output, target, { log = () => {} } = {}) {
+ const spec = `I=${target}:TP=-1.5:LRA=11`;
+ const { stderr } = await execFileP(FFMPEG, ["-nostdin", "-hide_banner", "-i", input, "-af", `loudnorm=${spec}:print_format=json`, "-f", "null", "-"], { maxBuffer: 1 << 26 });
+ const m = JSON.parse(stderr.slice(stderr.lastIndexOf("{"), stderr.lastIndexOf("}") + 1));
+ const tmp = `${output}.tmp-${process.pid}.mp4`;
+ await execFileP(FFMPEG, [
+ "-nostdin", "-v", "error", "-y", "-i", input, "-c:v", "copy",
+ "-af", `loudnorm=${spec}:measured_I=${m.input_i}:measured_TP=${m.input_tp}:measured_LRA=${m.input_lra}:measured_thresh=${m.input_thresh}:offset=${m.target_offset}:linear=true`,
+ "-c:a", "aac", "-b:a", "192k", "-ar", "48000", "-movflags", "+faststart", tmp,
+ ], { maxBuffer: 1 << 24 });
+ await rename(tmp, output);
+ log(`loudness: ${Number(m.input_i).toFixed(1)} LUFS measured, brought to ${target}`);
+ return { target, measured: Number(m.input_i) };
+}
+
+/**
+ * The pieces joined into the short: the build's own joined file when every
+ * piece plays whole, else each segment's part cut and joined; then the
+ * short's loudness. `{seconds, loudness}`.
+ */
+export async function assembleShort({ pieces, segmentsDir, built, outFile, render, log = () => {} }) {
+ const target = verticalKnobs(render).loudness;
+ const whole = pieces.every((p) => !p.from && p.to === null);
+ let src = built;
+ if (!whole) {
+ src = `${outFile}.joined-${process.pid}.mp4`;
+ const inputs = [];
+ const parts = [];
+ pieces.forEach((p, i) => {
+ inputs.push("-i", path.join(segmentsDir, `${p.id}.mp4`));
+ const trim = p.to === null ? `trim=start=${f3(p.from)}` : `trim=start=${f3(p.from)}:end=${f3(p.to)}`;
+ const atrim = p.to === null ? `atrim=start=${f3(p.from)}` : `atrim=start=${f3(p.from)}:end=${f3(p.to)}`;
+ parts.push(`[${i}:v]${trim},setpts=PTS-STARTPTS,fps=${render?.fps ?? 30},format=yuv420p,setsar=1[v${i}]`, `[${i}:a]${atrim},asetpts=PTS-STARTPTS,afade=t=in:d=0.08,areverse,afade=t=in:d=0.12,areverse[a${i}]`);
+ });
+ parts.push(`${pieces.map((_, i) => `[v${i}][a${i}]`).join("")}concat=n=${pieces.length}:v=1:a=1[v][a]`);
+ log(`vertical: joining ${pieces.length} piece(s)`);
+ await inSlot(["umtool", "vertical", "join"], () => execFileP(FFMPEG, ["-nostdin", "-v", "error", "-y", ...inputs, "-filter_complex", parts.join(";"), "-map", "[v]", "-map", "[a]", ...shortEncode(render), src], { maxBuffer: 1 << 24 }));
+ }
+ await mkdir(path.dirname(outFile), { recursive: true });
+ const loudness = await normalizeLoudness(src, outFile, target, { log });
+ if (!whole) await rm(src, { force: true });
+ await rm(built, { force: true });
+ return { seconds: await probeSeconds(outFile), loudness };
+}
+
+// ---------------------------------------------------------------------------
+// R: the reframe.
+// ---------------------------------------------------------------------------
+
+/**
+ * The master spans a short covers, in order: `{id, type, a, b, seg}` -- from
+ * clip beats (their source seconds through the cut record), master beats, or
+ * whole items. Pure.
+ */
+export function masterSpans({ beats = null, items = null, schedule, cuts = new Map() }) {
+ const segs = Array.isArray(schedule?.segments) ? schedule.segments : [];
+ const byId = new Map(segs.map((s) => [s.id, s]));
+ const out = [];
+ if (items?.length) {
+ for (const id of items) {
+ const s = byId.get(id);
+ if (s) out.push({ id, type: s.type, a: s.start, b: s.end, seg: s });
+ }
+ return out;
+ }
+ for (const bt of beats ?? []) {
+ if (bt.kind === "clip") {
+ const s = byId.get(bt.id);
+ const c = cuts.get(bt.id);
+ if (!s || !c) continue;
+ const a = s.start + Math.max(0, bt.start - c.start);
+ const b = Math.min(s.end, s.start + (bt.end - c.start));
+ if (b - a > 0.2) out.push({ id: bt.id, type: "clip", a, b, seg: s });
+ continue;
+ }
+ const A = bt.at;
+ const B = bt.at + bt.dur;
+ for (const s of segs) {
+ if (!(s.end > A + 0.05 && s.start < B - 0.05)) continue;
+ out.push({ id: s.id, type: s.type, a: Math.max(A, s.start), b: Math.min(B, s.end), seg: s });
+ }
+ }
+ return out;
+}
+
+/**
+ * One span's 9:16 recomposition as a filtergraph on the master `[0:v]`
+ * (already cut to the span): its regions, fitted and stacked in the safe
+ * area, over a blurred enlargement. `regions` in master px; `text` the ASS
+ * file of its title/subtitle (or null).
+ */
+export function reframeGraph({ regions, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT, safe, fps = 30, ass = null, fontsDir = null }) {
+ const gap = 24;
+ const top = safe.y0 + 150;
+ const avail = safe.y1 - top;
+ const maxW = W - 2 * 40;
+ // One scale for the stack: as wide as the frame allows, as tall as the safe area allows.
+ const sumH = regions.reduce((n, r) => n + r.h, 0) + gap * (regions.length - 1);
+ const s = Math.min(maxW / Math.max(...regions.map((r) => r.w)), (avail - gap * (regions.length - 1)) / Math.max(1, sumH - gap * (regions.length - 1)));
+ const sized = regions.map((r) => ({ ...r, sw: even(r.w * s), sh: even(r.h * s) }));
+ const total = sized.reduce((n, r) => n + r.sh, 0) + gap * (sized.length - 1);
+ let y = Math.round(top + (avail - total) / 2);
+ const big = regions.reduce((a, r) => (r.w * r.h > a.w * a.h ? r : a), regions[0]);
+ const parts = [`[0:v]split=${regions.length + 1}[rbg]${regions.map((_, i) => `[r${i}]`).join("")}`];
+ parts.push(`[rbg]crop=${big.w}:${big.h}:${big.x}:${big.y},scale=${W}:${H}:force_original_aspect_ratio=increase,crop=${W}:${H},gblur=sigma=40:steps=2,eq=brightness=-0.3:saturation=0.7,setsar=1[b0]`);
+ sized.forEach((r, i) => {
+ parts.push(`[r${i}]crop=${r.w}:${r.h}:${r.x}:${r.y},scale=${r.sw}:${r.sh}:flags=lanczos,setsar=1[c${i}]`);
+ parts.push(`[b${i}][c${i}]overlay=x=${Math.round((W - r.sw) / 2)}:y=${y}[b${i + 1}]`);
+ y += r.sh + gap;
+ });
+ const last = `[b${sized.length}]`;
+ parts.push(ass ? `${last}ass=filename='${ass}'${fontsDir ? `:fontsdir='${fontsDir}'` : ""},fps=${fps},format=yuv420p[v]` : `${last}fps=${fps},format=yuv420p[v]`);
+ return parts.join(";");
+}
+
+/** The ASS of a reframed span's title and subtitle (the schedule's), top of the safe area. */
+export function reframeAss({ title = "", subtitle = "", seconds, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT, safe, font = "IBM Plex Sans" }) {
+ const st = (name, fs, colour, mv, bold) => `Style: ${name},${[font, fs, assColour(colour), assColour(colour), assColour("#000000"), assColour("#000000", 0x80), bold, 0, 0, 0, 100, 100, 0, 0, 1, 3, 1, 7, safe.x0, W - safe.x1, mv, 1].join(",")}`;
+ const end = assTime(seconds);
+ return [
+ "[Script Info]", "ScriptType: v4.00+", `PlayResX: ${W}`, `PlayResY: ${H}`, "WrapStyle: 0", "ScaledBorderAndShadow: yes", "",
+ "[V4+ Styles]",
+ "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
+ st("title", 58, "#F6F1E6", safe.y0 + 8, -1),
+ st("sub", 36, "#D9D2C3", safe.y0 + 84, 0),
+ "", "[Events]", "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text",
+ ...(title ? [`Dialogue: 0,0:00:00.00,${end},title,,0,0,0,,${captionText(title)}`] : []),
+ ...(subtitle ? [`Dialogue: 0,0:00:00.00,${end},sub,,0,0,0,,${captionText(subtitle)}`] : []),
+ "",
+ ].join("\n");
+}
+
+/** A span's regions in master px: a clip's box; a post's card over its attachments (postLayout on the box). */
+export function spanRegions({ type, box, entry = null }) {
+ if (!box) return null;
+ if (type !== "post" || !entry) return [{ x: box.x, y: box.y, w: even(box.width), h: even(box.height) }];
+ const L = postLayout(entry, { width: box.width, height: box.height });
+ const rect = (r) => ({ x: Math.round(box.x + r.x), y: Math.round(box.y + r.y), w: even(r.width), h: even(r.height) });
+ const out = [];
+ if (L.card) out.push(rect(L.card));
+ if (L.slot && L.mode !== "text") out.push(rect(L.slot));
+ return out.length ? out : [{ x: box.x, y: box.y, w: even(box.width), h: even(box.height) }];
+}
+
+/**
+ * R over a take: each span of its master recomposed 9:16, joined, brought to
+ * the short's loudness. `{seconds, loudness}`.
+ */
+export async function reframeTake({ takeDir, outDir, slug, beats = null, items = null, render, outFile, log = () => {} }) {
+ const sourced = path.join(outDir, "sourced");
+ const schedule = await readJson(path.join(sourced, "schedule.json"));
+ if (!schedule) throw new Error(`${path.basename(takeDir)} has no out/sourced/schedule.json: render the take first`);
+ const manifest = await readJson(path.join(takeDir, "video.manifest.json"));
+ const byId = new Map((manifest?.timeline ?? []).map((e) => [e.id, e]));
+ const cuts = new Map();
+ for (const s of schedule.segments ?? []) {
+ const c = await readJson(path.join(sourced, "segments", `${s.id}.cut.json`));
+ if (c) cuts.set(s.id, c);
+ }
+ const spans = masterSpans({ beats, items, schedule, cuts });
+ if (!spans.length) throw new Error("nothing of the master is under the beats");
+ const master = path.join(outDir, `${slug}.mp4`);
+ const work = path.join(outDir, `reframe-${process.pid}`);
+ await mkdir(work, { recursive: true });
+ const safe = safeArea(render);
+ const fps = render?.fps ?? 30;
+ const { FONTS_DIR } = await import("./brand.mjs");
+ const files = [];
+ try {
+ await inSlot(["umtool", "vertical", "--reframe"], async () => {
+ for (const [i, sp] of spans.entries()) {
+ const box = cuts.get(sp.id)?.framing?.box ?? null;
+ const regions = spanRegions({ type: sp.type, box, entry: byId.get(sp.id) ?? null }) ?? [{ x: 0, y: 0, w: render.width ?? 1920, h: render.height ?? 1080 }];
+ const ass = path.join(work, `${i}.ass`);
+ await writeFile(ass, reframeAss({ title: sp.seg.title ?? "", subtitle: sp.seg.subtitle ?? "", seconds: sp.b - sp.a, safe }), "utf8");
+ const file = path.join(work, `${i}.mp4`);
+ log(`reframe: ${sp.id} ${sp.a.toFixed(2)}–${sp.b.toFixed(2)} (${regions.length} region${regions.length === 1 ? "" : "s"})`);
+ await execFileP(FFMPEG, [
+ "-nostdin", "-v", "error", "-y", "-ss", f3(sp.a), "-t", f3(sp.b - sp.a), "-i", master,
+ "-filter_complex", reframeGraph({ regions, safe, fps, ass, fontsDir: FONTS_DIR }),
+ "-map", "[v]", "-map", "0:a", ...shortEncode(render), file,
+ ], { maxBuffer: 1 << 24 });
+ files.push(file);
+ }
+ const list = path.join(work, "list.txt");
+ await writeFile(list, files.map((f) => `file '${f}'`).join("\n") + "\n", "utf8");
+ await execFileP(FFMPEG, ["-nostdin", "-v", "error", "-y", "-f", "concat", "-safe", "0", "-i", list, "-c", "copy", path.join(work, "joined.mp4")]);
+ });
+ await mkdir(path.dirname(outFile), { recursive: true });
+ const loudness = await normalizeLoudness(path.join(work, "joined.mp4"), outFile, verticalKnobs(render).loudness, { log });
+ return { seconds: await probeSeconds(outFile), loudness, spans: spans.map((s) => ({ id: s.id, a: s.a, b: s.b })) };
+ } finally {
+ await rm(work, { recursive: true, force: true });
+ }
+}
diff --git a/umtool/report-to-video/side-card.mjs b/umtool/report-to-video/side-card.mjs
@@ -0,0 +1,69 @@
+// A CLIP'S SIDE POST, drawn (lane vertical): the post a clip carries beside it
+// (`clip.side`, common lib/report/vertical.mjs) as one PNG the clip's segment
+// lays over its picture while the side is up. Drawn by the same card page as
+// a post item (post-item.mjs postCardHtml), redaction and all -- the bars and
+// the pills of the cut's redaction are on it, its letters never in the page --
+// with its attachments left off: it is read beside a clip, not played.
+//
+// Cached by a key of what it draws, beside the segment
+// (segments/<clip>.side.png + .side.json).
+
+import { createHash } from "node:crypto";
+import { readFile, rename, writeFile, mkdir } from "node:fs/promises";
+import path from "node:path";
+import { pathToFileURL } from "node:url";
+import { postCardHtml } from "./post-item.mjs";
+import { loadChromium } from "./post-render.mjs";
+
+// The post as a side card shows it (vertical.mjs, pure: Play's route reads it too).
+import { sideCardEntry } from "./vertical.mjs";
+export { sideCardEntry };
+
+/** The key of a side card: what it draws, at what size, under which redaction. */
+export function sideCardKey(post, { width, height, palette = null, redaction = null, avatars = {} } = {}) {
+ return createHash("sha256").update(JSON.stringify({ v: 2, post: sideCardEntry(post), width, height, palette, redaction, avatars })).digest("hex");
+}
+
+/**
+ * The side card's PNG at `width` × `height` (its page's ground transparent
+ * around the card), at `file`; reused when its record's key matches.
+ */
+export async function renderSideCard(post, { width, height, render = {}, avatars = {}, redaction = null, file }) {
+ const key = sideCardKey(post, { width, height, palette: render.palette ?? null, redaction, avatars });
+ const rec = `${file.replace(/\.png$/, "")}.json`;
+ const have = await readFile(rec, "utf8").then((t) => JSON.parse(t), () => null);
+ if (have?.key === key && (await readFile(file).then(() => true, () => false))) return { file, key, cached: true };
+ await mkdir(path.dirname(file), { recursive: true });
+ const fonts = {
+ regular: render.fontRegular ? pathToFileURL(render.fontRegular).href : "",
+ bold: render.fontBold ? pathToFileURL(render.fontBold).href : "",
+ };
+ const av = Object.fromEntries(Object.entries(avatars).map(([h, f]) => [h, pathToFileURL(f).href]));
+ // The page is laid at least as tall as it is wide, so the card takes the whole width and its words their full
+ // size (post-item.mjs sizes them by the page's height); the CARD alone is shot, and the clip's segment fits it
+ // into the side's box (sideFitFilter).
+ const vw = width;
+ const vh = Math.max(height, Math.round(width * 0.95));
+ const html = postCardHtml(sideCardEntry(post), { width: vw, height: vh, palette: render.palette, fonts, phase: "read", avatars: av, redaction, transparent: true });
+ const chromium = await loadChromium();
+ const browser = await chromium.launch({ headless: true });
+ try {
+ const ctx = await browser.newContext({ viewport: { width: vw, height: vh }, deviceScaleFactor: 1, offline: true, serviceWorkers: "block" });
+ const page = await ctx.newPage();
+ const htmlFile = `${file.replace(/\.png$/, "")}.html`;
+ await writeFile(htmlFile, html, "utf8");
+ await page.goto(pathToFileURL(htmlFile).href, { waitUntil: "load" });
+ await page.waitForSelector("body[data-post-ready='1']", { timeout: 15000 });
+ const tmp = `${file}.tmp-${process.pid}.png`;
+ await page.locator("[data-post-card]").first().screenshot({ path: tmp, omitBackground: true });
+ await rename(tmp, file);
+ } finally {
+ await browser.close();
+ }
+ await writeFile(rec, JSON.stringify({ version: 1, key, width, height, post: post?.id ?? null }, null, 2) + "\n");
+ return { file, key, cached: false };
+}
+
+/** The filter that fits a side card's PNG (any size) into its box `w` × `h`, centred, its ground transparent. */
+export const sideFitFilter = (w, h) =>
+ `format=rgba,scale=w=${w}:h=${h}:force_original_aspect_ratio=decrease:flags=lanczos,pad=${w}:${h}:(ow-iw)/2:(oh-ih)/2:color=0x00000000,setsar=1`;
diff --git a/umtool/report-to-video/vertical-plan.mjs b/umtool/report-to-video/vertical-plan.mjs
@@ -0,0 +1,160 @@
+// A VERTICAL SHORT'S PLAN (lane vertical): which of a take's items a short is
+// made of, and the part of each it plays -- from a reel's beats, or a list of
+// items. Pure: umtool's vertical command (lib/report/verticalCli.mjs) reads
+// the files and runs the build; this decides.
+//
+// A beat is one of the two shapes the trailer's beats file holds (trailer.mjs), or a whole item:
+// {id} an item of the take, whole (a post item read through, a clip as cut)
+// {id, start, end} a clip's SOURCE span: the clip, cut to those seconds
+// {at, dur} a span of the take's 16:9 MASTER: every item it covers
+// (the take's schedule.json says where each sits), a clip
+// cut to the source seconds under it (its cut record's
+// start), a post item built whole and played from the
+// part the span covers
+//
+// A clip's own `vertical` (crop, layout) and `side` are read from the
+// PROJECT's manifest over the take's: they are set with `umtool set` after the
+// take was made, and a short is cut from the take's items as the project now
+// frames them.
+
+const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
+const num = (v) => typeof v === "number" && Number.isFinite(v);
+const r3 = (n) => Math.round(n * 1000) / 1000;
+
+export class VerticalPlanError extends Error {}
+
+/** A beats file's beats: an array, or `{beats: [...]}` (a reel's). */
+export function beatsOf(doc) {
+ const list = Array.isArray(doc) ? doc : Array.isArray(doc?.beats) ? doc.beats : null;
+ if (!list) throw new VerticalPlanError("a beats file is an array of beats, or {beats: [...]}");
+ return list.map((b, i) => {
+ if (isObj(b) && typeof b.id === "string" && num(b.start) && num(b.end) && b.end > b.start) return { kind: "clip", id: b.id, start: b.start, end: b.end };
+ if (isObj(b) && num(b.at) && num(b.dur) && b.dur > 0) return { kind: "master", at: b.at, dur: b.dur, label: typeof b.label === "string" ? b.label : null };
+ if (isObj(b) && typeof b.id === "string" && b.start === undefined && b.end === undefined) return { kind: "item", id: b.id };
+ throw new VerticalPlanError(`beat ${i + 1}: not {id, start, end} (a clip's source span), {at, dur} (a span of the master) or {id} (a whole item)`);
+ });
+}
+
+/** The project's per-clip framing (vertical, side) laid over a take's entry. */
+export function withProjectFraming(entry, projectById) {
+ const own = projectById?.get?.(entry?.id);
+ if (!own || entry?.type !== "clip") return entry;
+ const out = { ...entry };
+ for (const k of ["vertical", "side"]) if (own[k] !== undefined) out[k] = own[k];
+ return out;
+}
+
+/** A clip entry cut to the source span [a, b]: its gaps inside kept, its own cut points dropped. */
+export function cutClip(entry, a, b, id = entry.id) {
+ const { cutStart: _a, cutEnd: _b, ...rest } = entry;
+ const gaps = (Array.isArray(entry.gaps) ? entry.gaps : []).filter((g) => g.to > a + 0.2 && g.from < b - 0.2);
+ const out = { ...rest, id, start: r3(a), end: r3(b) };
+ if (gaps.length) out.gaps = gaps;
+ else delete out.gaps;
+ // A side post's span is seconds into the clip AS IT PLAYED in the take: moved by the cut's new start.
+ if (isObj(entry.side) && num(entry.side.from) && num(entry.side.to) && num(entry.start) && a > entry.start) {
+ const d = a - entry.start;
+ const side = { ...entry.side, from: r3(Math.max(0, entry.side.from - d)), to: r3(entry.side.to - d) };
+ if (side.to - side.from >= 1) out.side = side;
+ else delete out.side;
+ }
+ return out;
+}
+
+/**
+ * The plan: `{timeline, pieces}`. `timeline` the entries the vertical build
+ * makes (each id once); `pieces` the order they play in, each
+ * `{id, from, to}` -- seconds of that entry's vertical segment, `to` null for
+ * the whole of it.
+ *
+ * @param {{ timeline: any[], beats?: any[] | null, items?: string[] | null, schedule?: any, cuts?: Map<string, any>,
+ * project?: any[] }} o
+ */
+export function planVerticalCut({ timeline, beats = null, items = null, schedule = null, cuts = new Map(), project = [] }) {
+ const projectById = new Map((project ?? []).filter((e) => typeof e?.id === "string").map((e) => [e.id, e]));
+ const byId = new Map((timeline ?? []).filter((e) => typeof e?.id === "string").map((e) => [e.id, withProjectFraming(e, projectById)]));
+ const out = [];
+ const pieces = [];
+ const used = new Map();
+ const uniq = (id) => {
+ const n = (used.get(id) ?? 0) + 1;
+ used.set(id, n);
+ return n === 1 ? id : `${id}~${n}`;
+ };
+ const add = (entry, piece) => {
+ out.push(entry);
+ pieces.push({ id: entry.id, from: piece?.from ?? 0, to: piece?.to ?? null });
+ };
+ if (items?.length) {
+ for (const id of items) {
+ const e = byId.get(id);
+ if (!e) throw new VerticalPlanError(`no item ${id} in the take`);
+ add({ ...e, id: uniq(id) });
+ }
+ return { timeline: out, pieces };
+ }
+ if (!beats?.length) throw new VerticalPlanError("a short needs beats (--reel / --beats) or items (--items)");
+ const segs = Array.isArray(schedule?.segments) ? schedule.segments : [];
+ for (const b of beats) {
+ if (b.kind === "item") {
+ const e = byId.get(b.id);
+ if (!e) throw new VerticalPlanError(`beat ${b.id}: no item ${b.id} in the take`);
+ add({ ...e, id: uniq(b.id) });
+ continue;
+ }
+ if (b.kind === "clip") {
+ const e = byId.get(b.id);
+ if (!e) throw new VerticalPlanError(`beat ${b.id}: no clip ${b.id} in the take`);
+ if (e.type !== "clip") throw new VerticalPlanError(`beat ${b.id}: a source span names a clip, and ${b.id} is a ${e.type}`);
+ add(cutClip(e, b.start, b.end, uniq(b.id)));
+ continue;
+ }
+ if (!segs.length) throw new VerticalPlanError("a master span needs the take's schedule.json (out/sourced/schedule.json)");
+ const A = b.at;
+ const B = b.at + b.dur;
+ const hit = segs.filter((s) => num(s.start) && num(s.end) && s.end > A + 0.05 && s.start < B - 0.05);
+ if (!hit.length) throw new VerticalPlanError(`beat at ${A}: no item of the take's schedule is under it`);
+ for (const s of hit) {
+ const e = byId.get(s.id);
+ if (!e) continue;
+ const from = Math.max(0, A - s.start);
+ const to = Math.min(s.end - s.start, B - s.start);
+ if (e.type === "clip") {
+ const cut = cuts.get(s.id);
+ if (!cut || !num(cut.start)) throw new VerticalPlanError(`beat at ${A}: clip ${s.id} has no cut record (segments/${s.id}.cut.json) to map its master seconds`);
+ add(cutClip(e, cut.start + from, cut.start + to, uniq(s.id)));
+ } else {
+ const whole = from < 0.05 && to > s.end - s.start - 0.05;
+ add({ ...e, id: uniq(s.id) }, whole ? null : { from: r3(from), to: r3(to) });
+ }
+ }
+ }
+ return { timeline: out, pieces };
+}
+
+/** Is every piece played whole? (Then the build's own joined file is the short.) */
+export const piecesWhole = (pieces) => pieces.every((p) => !p.from && p.to === null);
+
+/** A short's name for its files: the reel's, else "items". */
+export const shortName = ({ reel = null, name = null } = {}) => String(name ?? reel ?? "items").replace(/[^A-Za-z0-9._-]+/g, "-");
+
+/** The layout a short is named by: its clip, post and side layouts that differ from the defaults, or "reframe". */
+export function layoutTag(knobs = {}, { reframe = false } = {}) {
+ if (reframe) return "reframe";
+ const parts = [];
+ if (knobs.clip) parts.push(knobs.clip);
+ if (knobs.post) parts.push(knobs.post);
+ if (knobs.side) parts.push(knobs.side);
+ return parts.length ? parts.join("-") : "vertical";
+}
+
+/**
+ * A take's render for a PART of its timeline (the landscape build of a short's items): the deck's markers that
+ * follow an entry the part does not carry are left out (the deck refuses a marker after a missing entry).
+ */
+export function renderForPart(render, timeline) {
+ const ids = new Set((timeline ?? []).map((e) => String(e?.id ?? "").replace(/~\d+$/, "")).concat((timeline ?? []).map((e) => e?.id)));
+ const deck = render?.chrome?.deck;
+ if (!isObj(deck) || !Array.isArray(deck.markers)) return render;
+ return { ...render, chrome: { ...render.chrome, deck: { ...deck, markers: deck.markers.filter((m) => isObj(m) && ids.has(m.after)) } } };
+}
diff --git a/umtool/report-to-video/vertical.mjs b/umtool/report-to-video/vertical.mjs
@@ -0,0 +1,445 @@
+// THE VERTICAL FORMAT, drawn (lane vertical, 5 Nov). The rules -- the knobs,
+// their defaults and their checks -- are common's (lib/report/vertical.mjs),
+// re-exported here; this module is the pure geometry the build draws them
+// with: a clip's picture in each layout, its captions, tag and hook as one ASS
+// document, a side post's place and motion, and a post item's box.
+//
+// T1 "full" the 9:16 crop full-bleed; big captions in the lower middle, each word lit as said
+// T2 "framed" the whole picture in the middle third over a blurred, darkened enlargement of
+// itself; the hook band above it, the captions below it
+// T3 "quote" the picture in the top 40 %; the words set large below it as a quote, each lit
+// as it is said; "-- channel · date" under them
+// M1 "split" (a clip with a side post) the picture in the top half; the post rises into the
+// bottom half at the side's `from` and leaves at its `to`
+// M2 "overlay" (a clip with a side post) T1, the post floating over its lower third
+// P1-P3 a post item drawn by post-render in a portrait box inside the safe area
+//
+// Every text a layout draws keeps out of the safe edges (render.vertical.safe:
+// the top 8 %, the bottom 20 % and the right 12 % by default), where the
+// platforms lay their own buttons and captions.
+//
+// PURE: no fs, no ffmpeg. The build (build-video.mjs) and umtool's vertical
+// command (lib/report/verticalCli.mjs) call it.
+
+import {
+ VERTICAL_HEIGHT, VERTICAL_WIDTH, clipLayoutOf, sidePostOf, sideSpan, verticalKnobs, verticalOn,
+} from "yt-dlp-transcript-common/lib/report/vertical.mjs";
+import { assColour, assTime, captionText, cropPixels } from "./look.mjs";
+
+export {
+ LANDSCAPE_SIDE_PLACES, RENDER_FORMATS, SIDE_MIN_SECONDS, SIDE_PLACES, VERTICAL_CAPTION_SIZES, VERTICAL_CLIP_LAYOUTS,
+ VERTICAL_DEFAULTS, VERTICAL_HEIGHT, VERTICAL_HOOKS, VERTICAL_KEYS, VERTICAL_POST_LAYOUTS, VERTICAL_SIDE_LAYOUTS,
+ VERTICAL_WIDTH, clipLayoutOf, sideErrors, sidePostOf, sideSpan, validateClipSides, validateVerticalFormat,
+ validateVerticalRender, verticalKnobs, verticalOn,
+} from "yt-dlp-transcript-common/lib/report/vertical.mjs";
+
+const isObj = (v) => !!v && typeof v === "object" && !Array.isArray(v);
+const even = (n) => Math.max(2, 2 * Math.round(n / 2));
+const f3 = (n) => Number(n).toFixed(3);
+
+/** The caption colours: a word not yet said, a word said (lit). */
+export const VERTICAL_CAPTION_COLOURS = Object.freeze({ said: "#FFC840", unsaid: "#FFFFFF", muted: "#D9D2C3" });
+/** The caption face (vendored, look.mjs CAPTION_FONT). */
+export const VERTICAL_FONT = "IBM Plex Sans";
+/** A caption group: at most this many words, broken at a pause this long (s). */
+export const VERTICAL_GROUP_WORDS = 7;
+export const VERTICAL_GROUP_PAUSE = 0.5;
+/** A quote's phrase (T3): at most this many words. */
+export const VERTICAL_QUOTE_WORDS = 14;
+/** How long a caption stays up after its last word (s), never past the next. */
+export const VERTICAL_HOLD = 0.35;
+/** The side post's entrance and exit (s). */
+export const SIDE_MOTION = 0.35;
+
+/**
+ * The render a vertical cut is built with: 1080x1920 at the cut's fps, no
+ * header, footer, QR, rail, deck or montage; the cut's posts, narration,
+ * palette and fonts kept; the loudness the short is brought to.
+ */
+export function verticalRender(render = {}) {
+ const { chrome: _c, rail: _r, chromeEngine: _e, brand: _b, montage: _m, intro: _i, room: _ro, ...rest } = render;
+ const k = verticalKnobs(render);
+ return {
+ ...rest,
+ format: "vertical",
+ width: VERTICAL_WIDTH,
+ height: VERTICAL_HEIGHT,
+ headerHeight: 0,
+ footerHeight: 0,
+ qr: false,
+ captions: { style: "speakers", ...(isObj(render.captions?.labels) ? { labels: render.captions.labels } : {}), size: "l" },
+ loudness: { target: k.loudness },
+ };
+}
+
+/** The safe area in px: text keeps inside x0..x1, y0..y1. */
+export function safeArea(render, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT) {
+ const s = verticalKnobs(render).safe;
+ return { x0: Math.round(W * 0.055), x1: Math.round(W * (1 - s.right)), y0: Math.round(H * s.top), y1: Math.round(H * (1 - s.bottom)) };
+}
+
+/** The caption face's size (px) for the cut's caption size. */
+export const captionSize = (render, W = VERTICAL_WIDTH) => Math.round(W * (verticalKnobs(render).captions.size === "xl" ? 0.08 : 0.068));
+
+/** Characters a caption line holds at `size` px across `width` px (a bold face's average advance). */
+export const lineChars = (width, size) => Math.max(10, Math.floor(width / (size * 0.56)));
+
+/**
+ * Where everything sits for a clip in `layout` (a clip layout, or "split" /
+ * "overlay" for a clip carrying a side post), in px of the frame:
+ * `video` the picture's box, `crop` its aspect cut from the source,
+ * `captions` {align, marginL, marginR, marginV} (ASS), `card` the side post's
+ * box, `tag` / `hook` / `quote` / `cite` the text blocks' anchors.
+ */
+export function clipGeometry(layout, render, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT) {
+ const a = safeArea(render, W, H);
+ const size = captionSize(render, W);
+ const capMarg = { marginL: a.x0, marginR: W - a.x1 };
+ const tag = { x: a.x0, y: a.y0 + Math.round(H * 0.012), size: Math.round(W * 0.034) };
+ if (layout === "framed") {
+ const vh = even((W * 9) / 16);
+ const vy = even((H - vh) / 2 - H * 0.02);
+ return {
+ layout, size, tag,
+ video: { x: 0, y: vy, w: W, h: vh, aspect: W / vh, fill: "fit" },
+ background: true,
+ hook: { bottom: vy - Math.round(H * 0.025), size: Math.round(W * 0.062) },
+ captions: { align: 8, ...capMarg, marginV: vy + vh + Math.round(H * 0.025) },
+ };
+ }
+ if (layout === "quote") {
+ const vh = even(H * 0.4);
+ return {
+ layout, size: Math.round(W * 0.066), tag: null,
+ video: { x: 0, y: 0, w: W, h: vh, aspect: W / vh, fill: "crop" },
+ background: true,
+ mark: { x: a.x0 - 8, y: vh + Math.round(H * 0.012), size: Math.round(W * 0.16) },
+ captions: { align: 7, marginL: a.x0, marginR: W - a.x1 + 20, marginV: vh + Math.round(H * 0.085) },
+ cite: { x: a.x0, bottom: a.y1 - Math.round(H * 0.02), size: Math.round(W * 0.036) },
+ };
+ }
+ if (layout === "split") {
+ const vh = even(H / 2);
+ const cardY = vh + Math.round(H * 0.022);
+ return {
+ // The tag on the picture, under the top band: the bottom half is the side post's.
+ layout, size, tag,
+ video: { x: 0, y: 0, w: W, h: vh, aspect: W / vh, fill: "crop" },
+ background: true,
+ captions: { align: 2, ...capMarg, marginV: H - vh + Math.round(H * 0.018) },
+ card: { x: a.x0 - 20, y: cardY, w: even(a.x1 - a.x0 + 20), h: even(a.y1 - cardY - Math.round(H * 0.01)) },
+ };
+ }
+ // full (T1), and overlay (M2): the crop full-bleed.
+ const cardH = even(H * 0.27);
+ const card = layout === "overlay" ? { x: a.x0 - 20, y: a.y1 - cardH - Math.round(H * 0.01), w: even(a.x1 - a.x0 + 20), h: cardH } : null;
+ return {
+ layout, size, tag,
+ video: { x: 0, y: 0, w: W, h: H, aspect: 9 / 16, fill: "crop" },
+ background: false,
+ hook: { top: tag.y + Math.round(tag.size * 2.2), size: Math.round(W * 0.058) },
+ captions: { align: 2, ...capMarg, marginV: H - a.y1 + Math.round(H * 0.06) },
+ // While the side post is up, the captions sit above it.
+ captionsAbove: card ? { align: 2, ...capMarg, marginV: H - card.y + Math.round(H * 0.015) } : null,
+ card,
+ };
+}
+
+/** A box of `aspect` (w/h) cut from a `sw` × `sh` picture about `crop`'s centre (or the middle), even px. */
+export function aspectCrop(sw, sh, aspect, crop = null) {
+ let w = sw;
+ let h = Math.round(sw / aspect);
+ if (h > sh) {
+ h = sh;
+ w = Math.round(sh * aspect);
+ }
+ w = Math.min(even(w), sw - (sw % 2));
+ h = Math.min(even(h), sh - (sh % 2));
+ const [fx, fy, fw, fh] = Array.isArray(crop) && crop.length === 4 ? crop : [0, 0, 1, 1];
+ const cx = (fx + fw / 2) * sw;
+ const cy = (fy + fh / 2) * sh;
+ return { w, h, x: Math.round(Math.max(0, Math.min(sw - w, cx - w / 2))), y: Math.round(Math.max(0, Math.min(sh - h, cy - h / 2))) };
+}
+
+/**
+ * The picture of a vertical clip as ONE filtergraph from a single input pad
+ * (written after the build's `${pic}`) to its last filter (the build names it):
+ * the source's own blur first (`blur`: clip-blur's filters on the source
+ * picture), then the layout. `side` ({idx, from, to}: the card PNG's input
+ * index and its span in the segment's seconds) lays the side post in.
+ */
+export function verticalClipGraph({ geo, srcW, srcH, crop = null, blur = [], side = null, fps = 30, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT, id = "v" }) {
+ const p = (s) => `${id}${s}`;
+ const v = geo.video;
+ const lead = [...blur, "setsar=1"].join(",");
+ const parts = [];
+ // The picture's own box: a 9:16 crop (the clip's `vertical.crop` when set), else the layout's aspect.
+ const box = v.fill === "fit" ? null : v.aspect === 9 / 16 ? cropPixels(crop, srcW, srcH) : aspectCrop(srcW, srcH, v.aspect, crop);
+ const fg = box ? `crop=${box.w}:${box.h}:${box.x}:${box.y},scale=${v.w}:${v.h}:flags=lanczos,setsar=1` : `scale=${v.w}:${v.h}:force_original_aspect_ratio=decrease:flags=lanczos,pad=${v.w}:${v.h}:(ow-iw)/2:(oh-ih)/2:color=black,setsar=1`;
+ if (geo.background) {
+ // The ground: the picture enlarged to cover the frame, blurred and darkened.
+ const dark = geo.layout === "framed" ? -0.16 : -0.3;
+ parts.push(
+ `${lead},split=2[${p("bgs")}][${p("fgs")}]`,
+ `[${p("bgs")}]scale=${W}:${H}:force_original_aspect_ratio=increase,crop=${W}:${H},gblur=sigma=38:steps=2,eq=brightness=${dark}:saturation=0.75,setsar=1[${p("bg")}]`,
+ `[${p("fgs")}]${fg}[${p("fg")}]`,
+ `[${p("bg")}][${p("fg")}]overlay=x=${v.x}:y=${v.y}:format=auto,fps=${fps}`,
+ );
+ } else {
+ parts.push(`${lead},${fg},fps=${fps}`);
+ }
+ if (side && geo.card) {
+ const c = geo.card;
+ const a = Number(side.from);
+ const b = Number(side.to);
+ const m = SIDE_MOTION;
+ // Up from below with an ease-out, and down again at its end; off-frame outside its span.
+ const y = `if(lt(t,${f3(a)}),${H},if(lt(t,${f3(a + m)}),${c.y}+(${H}-${c.y})*pow(1-(t-${f3(a)})/${m},2),if(lt(t,${f3(b - m)}),${c.y},if(lt(t,${f3(b)}),${c.y}+(${H}-${c.y})*pow((t-${f3(b - m)})/${m},2),${H}))))`;
+ parts[parts.length - 1] += `[${p("pre")}]`;
+ parts.push(`[${side.idx}:v]format=rgba,scale=w=${c.w}:h=${c.h}:force_original_aspect_ratio=decrease:flags=lanczos,pad=${c.w}:${c.h}:(ow-iw)/2:(oh-ih)/2:color=0x00000000,setsar=1[${p("card")}]`, `[${p("pre")}][${p("card")}]overlay=x=${c.x}:y='${y}':eval=frame:format=auto`);
+ }
+ return parts.join(";");
+}
+
+/**
+ * The side post as a landscape cut draws it: a panel over the right (or left)
+ * of the picture area `pic` ({x, y, w, h} in the frame) while it is up,
+ * sliding in from that edge. Returns the box the card is drawn at and the
+ * overlay filter (from `[base]` and `[card]` pads the caller names).
+ */
+export function landscapeSideGeometry(pic, place = "right") {
+ const w = even(pic.w * 0.34);
+ const h = even(Math.min(pic.h * 0.86, w * 1.15));
+ const m = Math.round(pic.w * 0.025);
+ const x = place === "left" ? pic.x + m : pic.x + pic.w - w - m;
+ const y = Math.round(pic.y + (pic.h - h) / 2);
+ return { x, y, w, h, place: place === "left" ? "left" : "right" };
+}
+
+/** The overlay of a landscape side panel: in from its edge over SIDE_MOTION, out again at its end. */
+export function landscapeSideOverlay(geo, side, W) {
+ const a = Number(side.from);
+ const b = Number(side.to);
+ const m = SIDE_MOTION;
+ const off = geo.place === "left" ? -geo.w - 10 : W + 10;
+ const x = `if(lt(t,${f3(a)}),${off},if(lt(t,${f3(a + m)}),${geo.x}+(${off}-${geo.x})*pow(1-(t-${f3(a)})/${m},2),if(lt(t,${f3(b - m)}),${geo.x},if(lt(t,${f3(b)}),${geo.x}+(${off}-${geo.x})*pow((t-${f3(b - m)})/${m},2),${off}))))`;
+ return `overlay=x='${x}':y=${geo.y}:eval=frame:format=auto`;
+}
+
+// ---------------------------------------------------------------------------
+// The words: groups lit word by word, as one ASS document with the tag, the
+// hook and the quote's citation.
+// ---------------------------------------------------------------------------
+
+/**
+ * Words (segment seconds) to caption groups: at most `maxWords`, at most
+ * `maxChars` × `lines` characters, broken at a pause. `{start, end, words}`.
+ */
+export function captionGroups(words, { maxWords = VERTICAL_GROUP_WORDS, maxChars = 24, lines = 2, pause = VERTICAL_GROUP_PAUSE, seconds = Infinity } = {}) {
+ const used = (words ?? [])
+ .map((w) => ({ text: captionText(w.text), start: Number(w.start), end: Number(w.end) }))
+ .filter((w) => w.text && Number.isFinite(w.start) && Number.isFinite(w.end) && w.end > 0 && w.start < seconds)
+ .map((w) => ({ ...w, start: Math.max(0, w.start), end: Math.min(seconds, Math.max(w.start + 0.05, w.end)) }))
+ .sort((x, y) => x.start - y.start);
+ const groups = [];
+ let cur = null;
+ const budget = maxChars * lines;
+ for (const w of used) {
+ const chars = cur ? cur.words.reduce((n, x) => n + x.text.length + 1, 0) + w.text.length : 0;
+ const prev = cur?.words[cur.words.length - 1];
+ if (!cur || cur.words.length >= maxWords || chars > budget || (cur.words.length >= 2 && w.start - prev.end >= pause)) {
+ cur = { words: [w] };
+ groups.push(cur);
+ } else cur.words.push(w);
+ }
+ return groups.map((g, i) => {
+ const start = g.words[0].start;
+ const last = g.words[g.words.length - 1].end;
+ const next = groups[i + 1]?.words[0].start ?? Infinity;
+ const end = Math.min(seconds, Math.max(last, Math.min(next, last + VERTICAL_HOLD)));
+ return { start, end: Math.max(end, start + 0.25), words: g.words };
+ });
+}
+
+/** One group as karaoke text: each word lit when it is said (`\k`, centiseconds from the group's start). */
+export function karaokeText(group) {
+ let at = group.start;
+ return group.words
+ .map((w, j) => {
+ const lead = Math.max(0, Math.round((w.start - at) * 100));
+ const next = group.words[j + 1]?.start ?? w.end;
+ const dur = Math.max(1, Math.round((Math.max(next, w.start + 0.05) - w.start) * 100));
+ at = w.start + dur / 100;
+ return `${lead ? `{\\k${lead}}` : ""}{\\k${dur}}${w.text}`;
+ })
+ .join(" ");
+}
+
+/** A tag or a citation line: "Channel · 27 Oct 2026" from what the clip says of itself. */
+export function sourceTagText({ channel = "", date = "" } = {}) {
+ const d = /^\d{4}-\d{2}-\d{2}/.test(String(date)) ? formatDay(String(date).slice(0, 10)) : String(date ?? "");
+ return [String(channel ?? "").trim(), d].filter(Boolean).join(" · ");
+}
+
+const MONTHS = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
+/** 2026-10-27 as "27 Oct 2026". */
+export function formatDay(iso) {
+ const [y, m, d] = iso.split("-").map(Number);
+ return `${d} ${MONTHS[m - 1]} ${y}`;
+}
+
+/**
+ * The hook line a clip shows, from the cut's own copy only: `hook` "title" is
+ * the clip's own title, "section" its section's title (`sectionTitle`, given
+ * by the build), {text} the cut's line. Null when there is none.
+ */
+export function hookText(hook, { entry = null, sectionTitle = null } = {}) {
+ if (!hook) return null;
+ if (isObj(hook) && typeof hook.text === "string") return hook.text.trim() || null;
+ if (hook === "title") return typeof entry?.title === "string" && entry.title.trim() ? entry.title.trim() : null;
+ if (hook === "section") return typeof sectionTitle === "string" && sectionTitle.trim() ? sectionTitle.trim() : null;
+ return null;
+}
+
+/**
+ * The ASS document a vertical clip burns in: its captions (each word lit as
+ * said; a quote's phrases in T3), its source tag, its hook, a quote's mark and
+ * citation. `words` in segment seconds; `hook` the line (verticalHookOf), `side` the side post's span (captions
+ * move above an overlay card while it is up).
+ */
+export function verticalAss({ geo, render, words = [], seconds, tag = null, hook = null, side = null, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT, font = VERTICAL_FONT }) {
+ const k = verticalKnobs(render);
+ const quote = geo.layout === "quote";
+ const size = geo.size;
+ const width = W - geo.captions.marginL - geo.captions.marginR;
+ const maxChars = lineChars(width, size);
+ const groups = captionGroups(words, quote
+ ? { maxWords: VERTICAL_QUOTE_WORDS, maxChars, lines: 4, pause: 0.9, seconds }
+ : { maxChars, lines: k.captions.lines, seconds });
+ const C = VERTICAL_CAPTION_COLOURS;
+ const pal = { accent: "#c8752a", bg: "#12100c", ...(render?.palette ?? {}) };
+ const outline = Math.max(2, Math.round(size * 0.075));
+ const style = (name, { fs, primary, secondary = primary, align, mL = 0, mR = 0, mV = 0, bold = -1, ol = outline, sh = 2, border = 1, back = "#000000", backA = 0x80 }) =>
+ `Style: ${name},${[font, fs, assColour(primary), assColour(secondary), assColour("#000000"), assColour(back, backA), bold, 0, 0, 0, 100, 100, 0, 0, border, ol, sh, align, mL, mR, mV, 1].join(",")}`;
+ const cap = geo.captions;
+ const styles = [
+ style("cap", { fs: size, primary: C.said, secondary: C.unsaid, align: cap.align, mL: cap.marginL, mR: cap.marginR, mV: cap.marginV, ol: quote ? 0 : outline, sh: quote ? 0 : 2 }),
+ style("tag", { fs: geo.tag?.size ?? 36, primary: "#F6F1E6", align: 7, mL: geo.tag?.x ?? 0, mV: geo.tag?.y ?? 0, bold: 0, ol: 10, sh: 0, border: 3, back: pal.bg, backA: 0x40 }),
+ style("hook", { fs: geo.hook?.size ?? 60, primary: "#FFFFFF", align: geo.layout === "framed" ? 2 : 8, mL: cap.marginL, mR: cap.marginR, mV: geo.layout === "framed" ? H - (geo.hook?.bottom ?? 0) : geo.hook?.top ?? 0, ol: Math.round(outline * 0.8) }),
+ style("mark", { fs: geo.mark?.size ?? 160, primary: pal.accent, align: 7, mL: geo.mark?.x ?? 0, mV: geo.mark?.y ?? 0, ol: 0, sh: 0 }),
+ style("cite", { fs: geo.cite?.size ?? 38, primary: C.muted, align: 1, mL: geo.cite?.x ?? 0, mV: geo.cite ? H - geo.cite.bottom : 0, bold: 0, ol: 0, sh: 0 }),
+ ];
+ const end = assTime(Math.max(0.1, seconds));
+ const events = [];
+ const above = geo.captionsAbove;
+ for (const g of groups) {
+ const over = above && side && g.start < side.to && g.end > side.from;
+ const mv = over ? `{\\an${above.align}\\pos(${Math.round(W / 2 + (above.marginL - above.marginR) / 2)},${H - above.marginV})}` : "";
+ events.push(`Dialogue: 1,${assTime(g.start)},${assTime(g.end)},cap,,0,0,0,,${mv}${karaokeText(g)}`);
+ }
+ if (tag && k.tag && geo.tag) events.push(`Dialogue: 0,${assTime(0)},${end},tag,,0,0,0,,${captionText(tag)}`);
+ const h = typeof hook === "string" && hook.trim() ? hook.trim() : null;
+ if (h && geo.hook) events.push(`Dialogue: 0,${assTime(0)},${end},hook,,0,0,0,,${captionText(h)}`);
+ if (quote) {
+ events.push(`Dialogue: 0,${assTime(0)},${end},mark,,0,0,0,,“`);
+ if (tag) events.push(`Dialogue: 0,${assTime(0)},${end},cite,,0,0,0,,— ${captionText(tag)}`);
+ }
+ return [
+ "[Script Info]",
+ "ScriptType: v4.00+",
+ `PlayResX: ${W}`,
+ `PlayResY: ${H}`,
+ "WrapStyle: 0",
+ "ScaledBorderAndShadow: yes",
+ "YCbCr Matrix: None",
+ "",
+ "[V4+ Styles]",
+ "Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding",
+ ...styles,
+ "",
+ "[Events]",
+ "Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text",
+ ...events,
+ "",
+ ].join("\n");
+}
+
+// ---------------------------------------------------------------------------
+// Post items in a vertical cut: a portrait box inside the safe area.
+// ---------------------------------------------------------------------------
+
+/** Where a post item is drawn in a vertical frame: its box (post-render's) and the pad that places it. */
+export function verticalPostBox(render, W = VERTICAL_WIDTH, H = VERTICAL_HEIGHT) {
+ const a = safeArea(render, W, H);
+ const x = Math.round(W * 0.03);
+ const y = a.y0;
+ const width = even(a.x1 - x);
+ const height = even(a.y1 - y);
+ const bg = String(render?.palette?.bg ?? "#12100c").replace("#", "0x");
+ return { box: { x, y, width, height }, place: [`pad=${W}:${H}:${x}:${y}:color=${bg}`, "setsar=1", `fps=${render?.fps ?? 30}`] };
+}
+
+/** The share of a portrait box a P3 ("media") attachment takes at the top. */
+export const MEDIA_FIRST_SHARE = 0.6;
+
+/**
+ * A post item as a vertical layout draws it (the run's copy, never written
+ * back): P1 "card" lays its attachment under the words, one still card (no
+ * read-follow column); P2 "stack" over them (the conversation column below,
+ * lit as it is read); P3 "media" large over them.
+ */
+export function verticalPostEntry(entry, render) {
+ if (!isObj(entry) || entry.type !== "post") return entry;
+ const layout = verticalKnobs(render).post;
+ if (layout === "media") return { ...entry, panel: "top", panelShare: MEDIA_FIRST_SHARE };
+ if (layout === "stack") return { ...entry, panel: "top" };
+ // P1: one card, still -- the posts it answers as compact context over it, never a panning column (read-follow off).
+ return { ...entry, panel: "bottom", follow: false };
+}
+
+/** The clips of a vertical cut and the layout each plays in: its own, or split / overlay when it carries a side post. */
+export function clipVerticalLayout(entry, render) {
+ if (isObj(entry?.side)) {
+ const place = entry.side.place;
+ return place === "split" || place === "overlay" ? place : verticalKnobs(render).side;
+ }
+ return clipLayoutOf(entry, render);
+}
+
+/** A vertical cut's notes: over its length (a note, not a refusal). */
+export function verticalNotes(render, seconds) {
+ if (!verticalOn(render)) return [];
+ const max = verticalKnobs(render).maxSeconds;
+ return Number.isFinite(seconds) && seconds > max + 0.05 ? [`this short runs ${seconds.toFixed(1)} s, over its ${max} s (render.vertical.maxSeconds)`] : [];
+}
+
+export { sidePostOf as sidePost, sideSpan as sideSpanOf };
+
+/**
+ * Each entry's section title, from the deck's markers (`render.chrome.deck.markers`, each after an entry, its
+ * `label` the section from there on; `sectionTitle.first` before the first): the hook "section" reads it.
+ */
+export function sectionTitlesOf(manifest) {
+ const deck = manifest?.render?.chrome?.deck ?? {};
+ const markers = Array.isArray(deck.markers) ? deck.markers : [];
+ const after = new Map(markers.filter((m) => isObj(m) && typeof m.after === "string").map((m) => [m.after, typeof m.label === "string" ? m.label : null]));
+ let cur = isObj(deck.sectionTitle) && typeof deck.sectionTitle.first === "string" ? deck.sectionTitle.first : null;
+ const out = new Map();
+ for (const e of manifest?.timeline ?? []) {
+ if (typeof e?.id !== "string") continue;
+ out.set(e.id, cur);
+ if (after.has(e.id)) cur = after.get(e.id);
+ }
+ return out;
+}
+
+/** The hook a vertical clip shows (render.vertical.hook, resolved from the cut's own copy), or null. */
+export function verticalHookOf(entry, render, sections = null) {
+ return hookText(verticalKnobs(render).hook, { entry, sectionTitle: sections?.get?.(entry?.id) ?? null });
+}
+
+/** The post as a side card shows it: its words, its context and its author; no attachments, no word effects. */
+export function sideCardEntry(post) {
+ const { media: _m, fx: _f, panel: _p, panelShare: _s, links: _l, ...rest } = post ?? {};
+ return { ...rest, type: "post" };
+}
diff --git a/umtool/report-to-video/vertical.test.mjs b/umtool/report-to-video/vertical.test.mjs
@@ -0,0 +1,243 @@
+import { test } from "node:test";
+import assert from "node:assert/strict";
+import {
+ VERTICAL_DEFAULTS, captionGroups, clipGeometry, clipVerticalLayout, hookText, karaokeText, landscapeSideGeometry,
+ safeArea, sectionTitlesOf, sideErrors, sidePostOf, sideSpan, sourceTagText, validateClipSides, validateVerticalRender,
+ verticalAss, verticalClipGraph, verticalKnobs, verticalNotes, verticalOn, verticalPostBox, verticalPostEntry, verticalRender,
+} from "./vertical.mjs";
+import { postLayout } from "./post-item.mjs";
+import { applyLookPatch, validateLook } from "yt-dlp-transcript-common/lib/report/look.mjs";
+import { beatsOf, cutClip, layoutTag, piecesWhole, planVerticalCut, renderForPart } from "./vertical-plan.mjs";
+import { masterSpans, reframeGraph, spanRegions } from "./reframe.mjs";
+
+const W = 1080;
+const H = 1920;
+
+test("the knobs: absent is landscape, the defaults are the shorts conventions", () => {
+ assert.equal(verticalOn({}), false);
+ assert.equal(verticalOn({ format: "vertical" }), true);
+ const k = verticalKnobs({});
+ assert.equal(k.clip, "full");
+ assert.equal(k.loudness, -14);
+ assert.equal(k.maxSeconds, 60);
+ assert.deepEqual(k.safe, { top: 0.08, bottom: 0.2, right: 0.12 });
+ assert.deepEqual(verticalKnobs({ vertical: { clip: "quote", safe: { right: 0.1 } } }).safe, { top: 0.08, bottom: 0.2, right: 0.1 });
+ assert.equal(VERTICAL_DEFAULTS.captions.lines, 2);
+});
+
+test("validateVerticalRender refuses what cannot be built, and says why", () => {
+ assert.deepEqual(validateVerticalRender({ render: {} }), []);
+ assert.deepEqual(validateVerticalRender({ render: { format: "vertical", vertical: { clip: "framed", post: "media", side: "overlay", hook: "section" } } }), []);
+ const e = validateVerticalRender({ render: { format: "square", vertical: { clip: "wide", captions: { lines: 3 }, hook: "make it pop", safe: { left: 0.1 }, loudness: -2 } } });
+ assert.ok(e.some((x) => x.includes("render.format")));
+ assert.ok(e.some((x) => x.includes("vertical.clip")));
+ assert.ok(e.some((x) => x.includes("at most two lines")));
+ assert.ok(e.some((x) => x.includes("vertical.hook")));
+ assert.ok(e.some((x) => x.includes("safe.left")));
+ assert.ok(e.some((x) => x.includes("loudness")));
+ // The hook says the cut's own copy: a line, never longer than the cap.
+ assert.deepEqual(validateVerticalRender({ render: { vertical: { hook: { text: "In her own words" } } } }), []);
+});
+
+test("the look's checks carry the vertical ones; a look patch writes format and vertical", () => {
+ const m = { render: {}, timeline: [{ type: "clip", id: "a", vertical: { layout: "quote" } }] };
+ assert.deepEqual(validateLook(m), []);
+ assert.ok(validateLook({ ...m, timeline: [{ type: "clip", id: "a", vertical: { layout: "tall" } }] }).length);
+ const r = applyLookPatch({ render: {} }, { format: "vertical", vertical: { clip: "framed" } });
+ assert.deepEqual(r.errors, []);
+ assert.deepEqual(r.render, { format: "vertical", vertical: { clip: "framed" } });
+ assert.deepEqual(applyLookPatch({ render: { format: "vertical" } }, { format: "landscape" }).render, {});
+});
+
+test("a side post: one of item or post, a span inside the clip, a known place", () => {
+ assert.deepEqual(sideErrors({ item: "p1", from: 1, to: 5 }, "side", { itemIds: new Set(["p1"]) }), []);
+ assert.ok(sideErrors({ item: "p9", from: 1, to: 5 }, "side", { itemIds: new Set(["p1"]) })[0].includes("no post item"));
+ assert.ok(sideErrors({ from: 1, to: 5 }).some((x) => x.includes("exactly one")));
+ assert.ok(sideErrors({ post: { text: "x", handle: "h" }, from: 3, to: 3.5 }).some((x) => x.includes("at least")));
+ assert.ok(sideErrors({ post: { text: "x", handle: "h" }, from: 0, to: 4, place: "top" }).some((x) => x.includes("place")));
+ const tl = [{ type: "clip", id: "c", side: { item: "p", from: 0, to: 4 } }, { type: "post", id: "p", text: "hi" }, { type: "post", id: "q", side: {} }];
+ const errs = validateClipSides({ timeline: tl });
+ assert.equal(errs.length, 1);
+ assert.ok(errs[0].includes("only a clip"));
+ assert.equal(sidePostOf(tl[0], tl).id, "p");
+ assert.equal(sidePostOf({ id: "c", side: { post: { text: "t", handle: "h" }, from: 0, to: 2 } }).id, "c-side");
+ assert.deepEqual(sideSpan({ from: 2, to: 30 }, 10), { from: 2, to: 10 });
+ assert.equal(sideSpan({ from: 12, to: 30 }, 10), null);
+});
+
+test("verticalRender: 1080x1920 at the cut's fps, no chrome, rail, QR or intro; the short's loudness", () => {
+ const r = verticalRender({ width: 1920, height: 1080, fps: 25, chrome: { deck: {} }, rail: {}, intro: "boot-dark", qr: { scale: 4 }, posts: { slurs: {} }, vertical: { loudness: -15 } });
+ assert.equal(r.width, W);
+ assert.equal(r.height, H);
+ assert.equal(r.fps, 25);
+ assert.equal(r.chrome, undefined);
+ assert.equal(r.rail, undefined);
+ assert.equal(r.intro, undefined);
+ assert.equal(r.qr, false);
+ assert.deepEqual(r.posts, { slurs: {} });
+ assert.deepEqual(r.loudness, { target: -15 });
+ assert.equal(r.format, "vertical");
+});
+
+test("every layout keeps its text inside the safe area", () => {
+ const render = { format: "vertical" };
+ const a = safeArea(render);
+ assert.deepEqual(a, { x0: 59, x1: 950, y0: 154, y1: 1536 });
+ for (const layout of ["full", "framed", "quote", "split", "overlay"]) {
+ const g = clipGeometry(layout, render);
+ const c = g.captions;
+ // A caption's block: its margins keep it off the right 12 % and out of the bottom 20 %.
+ assert.ok(W - c.marginR <= a.x1 + 1, `${layout}: captions past the right edge`);
+ if (c.align <= 3) assert.ok(H - c.marginV <= a.y1, `${layout}: captions in the bottom fifth`);
+ if (g.tag) assert.ok(g.tag.y >= a.y0, `${layout}: tag in the top band`);
+ if (g.card) {
+ assert.ok(g.card.y + g.card.h <= a.y1, `${layout}: card in the bottom fifth`);
+ assert.ok(g.card.x + g.card.w <= a.x1 + 1, `${layout}: card past the right edge`);
+ }
+ if (g.cite) assert.ok(g.cite.bottom <= a.y1);
+ }
+ // T2: the picture in the middle third.
+ const f = clipGeometry("framed", render).video;
+ assert.ok(f.y >= H / 3 - 60 && f.y + f.h <= (2 * H) / 3 + 60);
+ // T3: the picture in the top 40 %.
+ assert.equal(clipGeometry("quote", render).video.h, 768);
+});
+
+test("a clip's layout: its own, else the cut's; a side post makes it split or overlay", () => {
+ const render = { vertical: { clip: "framed", side: "overlay" } };
+ assert.equal(clipVerticalLayout({ id: "a" }, render), "framed");
+ assert.equal(clipVerticalLayout({ id: "a", vertical: { layout: "quote" } }, render), "quote");
+ assert.equal(clipVerticalLayout({ id: "a", side: { item: "p", from: 0, to: 3 } }, render), "overlay");
+ assert.equal(clipVerticalLayout({ id: "a", side: { item: "p", from: 0, to: 3, place: "split" } }, render), "split");
+});
+
+test("the picture's graph: one input, the blur first, the layout; a side card rides in and out", () => {
+ const g = verticalClipGraph({ geo: clipGeometry("full", {}), srcW: 1920, srcH: 1080, crop: [0.64, 0, 0.3164, 1], blur: ["gblur=sigma=5"] });
+ assert.ok(g.startsWith("gblur=sigma=5,setsar=1,crop=608:1080:"));
+ assert.ok(!g.includes(";"));
+ const fr = verticalClipGraph({ geo: clipGeometry("framed", {}), srcW: 1920, srcH: 1080 });
+ assert.match(fr, /split=2\[vbgs\]\[vfgs\]/);
+ assert.match(fr, /gblur=sigma=38/);
+ const sp = verticalClipGraph({ geo: clipGeometry("split", {}), srcW: 1920, srcH: 1080, side: { idx: 2, from: 1, to: 6 } });
+ assert.match(sp, /\[2:v\]format=rgba/);
+ assert.match(sp, /overlay=x=\d+:y='if\(lt\(t,1\.000\),1920/);
+});
+
+test("captions: groups of at most two lines, each word lit as it is said", () => {
+ const words = "and I used a voice changer from the beginning to sound like a girl".split(" ").map((t, i) => ({ text: t, start: i * 0.3, end: i * 0.3 + 0.25 }));
+ const groups = captionGroups(words, { maxChars: 14, lines: 2 });
+ assert.ok(groups.length >= 2);
+ for (const g of groups) assert.ok(g.words.map((w) => w.text).join(" ").length <= 28 + 10);
+ const k = karaokeText(groups[0]);
+ assert.match(k, /^\{\\k30\}and \{\\k30\}I/);
+ // A pause breaks a group.
+ const paused = captionGroups([{ text: "one", start: 0, end: 0.2 }, { text: "two", start: 0.3, end: 0.5 }, { text: "three", start: 2, end: 2.2 }]);
+ assert.equal(paused.length, 2);
+});
+
+test("the ASS document: captions, the tag and a quote's citation; captions move above an overlay card", () => {
+ const words = [{ text: "hello", start: 0.5, end: 0.9 }, { text: "there", start: 1, end: 1.4 }];
+ const doc = verticalAss({ geo: clipGeometry("quote", {}), render: {}, words, seconds: 3, tag: sourceTagText({ channel: "EmberParadox", date: "2026-10-27" }) });
+ assert.match(doc, /PlayResX: 1080/);
+ assert.match(doc, /— EmberParadox · 27 Oct 2026/);
+ assert.match(doc, /\{\\k50\}hello/);
+ const ov = verticalAss({ geo: clipGeometry("overlay", {}), render: {}, words, seconds: 3, side: { from: 0, to: 2 } });
+ assert.match(ov, /\\an2\\pos\(/);
+ const hook = verticalAss({ geo: clipGeometry("framed", {}), render: {}, words, seconds: 3, hook: "Why the voice changer" });
+ assert.match(hook, /hook,,0,0,0,,Why the voice changer/);
+});
+
+test("the hook says only the cut's own copy", () => {
+ assert.equal(hookText(false, { entry: { title: "x" } }), null);
+ assert.equal(hookText("title", { entry: { title: "We need to talk" } }), "We need to talk");
+ assert.equal(hookText("section", { sectionTitle: "Why the voice changer" }), "Why the voice changer");
+ assert.equal(hookText({ text: "In her own words" }), "In her own words");
+ const m = { render: { chrome: { deck: { sectionTitle: { first: "Life is good" }, markers: [{ after: "b", label: "Second" }] } } }, timeline: [{ id: "a" }, { id: "b" }, { id: "c" }] };
+ const s = sectionTitlesOf(m);
+ assert.equal(s.get("a"), "Life is good");
+ assert.equal(s.get("b"), "Life is good");
+ assert.equal(s.get("c"), "Second");
+});
+
+test("post items: a portrait box inside the safe area, laid card / stack / media", () => {
+ const { box, place } = verticalPostBox({ fps: 30, palette: { bg: "#12100c" } });
+ assert.ok(box.x + box.width <= 950 + 2);
+ assert.equal(box.y, 154);
+ assert.ok(box.y + box.height <= 1536);
+ assert.match(place[0], /^pad=1080:1920:\d+:154:color=0x12100c$/);
+ const e = { type: "post", id: "p", text: "words", media: [{ src: "a.gif", kind: "gif", width: 480, height: 270 }] };
+ assert.equal(verticalPostEntry(e, { vertical: { post: "card" } }).panel, "bottom");
+ assert.equal(verticalPostEntry(e, { vertical: { post: "card" } }).follow, false);
+ assert.equal(verticalPostEntry(e, { vertical: { post: "stack" } }).panel, "top");
+ assert.equal(verticalPostEntry(e, { vertical: { post: "media" } }).panelShare, 0.6);
+ assert.equal(verticalPostEntry({ type: "clip", id: "c" }, {}).panel, undefined);
+});
+
+test("postLayout: a portrait box never lays the attachment beside the words; a landscape box is as it was", () => {
+ const e = { type: "post", id: "p", text: "a few words here", media: [{ src: "a.png", kind: "image", width: 800, height: 800 }] };
+ assert.equal(postLayout(e, { width: 1574, height: 886 }).panel, "side");
+ const tall = postLayout(e, { width: 910, height: 1382 });
+ assert.equal(tall.panel, "bottom");
+ assert.ok(tall.slot.y > tall.card.y);
+ const media = postLayout({ ...e, panel: "top", panelShare: 0.6 }, { width: 910, height: 1382 });
+ assert.ok(media.slot.height > tall.slot.height);
+});
+
+test("notes: a short over its length is said so", () => {
+ assert.deepEqual(verticalNotes({}, 90), []);
+ assert.equal(verticalNotes({ format: "vertical" }, 59.9).length, 0);
+ assert.match(verticalNotes({ format: "vertical" }, 72.4)[0], /72\.4 s, over its 60 s/);
+});
+
+test("the plan: clip spans cut to their beats, master spans to their items, a whole item", () => {
+ const timeline = [
+ { type: "clip", id: "c1", start: 100, end: 130, gaps: [{ from: 105, to: 106 }, { from: 125, to: 127 }], cutStart: 101 },
+ { type: "post", id: "p1", text: "x" },
+ { type: "post", id: "p2", text: "y" },
+ ];
+ const beats = beatsOf({ beats: [{ id: "c1", start: 110, end: 128 }, { at: 40, dur: 12 }, { id: "p2" }] });
+ assert.deepEqual(beats.map((b) => b.kind), ["clip", "master", "item"]);
+ const schedule = { segments: [{ id: "c1", start: 0, end: 30 }, { id: "p1", start: 30, end: 50 }, { id: "p2", start: 50, end: 60 }] };
+ const plan = planVerticalCut({ timeline, beats, schedule, project: [{ type: "clip", id: "c1", vertical: { crop: [0.6, 0, 0.3164, 1] } }] });
+ assert.deepEqual(plan.timeline.map((e) => e.id), ["c1", "p1", "p2", "p2~2"]);
+ assert.deepEqual(plan.timeline[0].gaps, [{ from: 125, to: 127 }]);
+ assert.equal(plan.timeline[0].cutStart, undefined);
+ assert.deepEqual(plan.timeline[0].vertical, { crop: [0.6, 0, 0.3164, 1] });
+ assert.deepEqual(plan.pieces[1], { id: "p1", from: 10, to: 20 });
+ assert.deepEqual(plan.pieces[2], { id: "p2", from: 0, to: 2 });
+ assert.equal(piecesWhole(plan.pieces), false);
+ assert.throws(() => beatsOf([{ at: "x" }]), /beat 1/);
+ assert.equal(layoutTag({ clip: "framed" }), "framed");
+ assert.equal(layoutTag({}, { reframe: true }), "reframe");
+});
+
+test("cutClip moves a side post's span with the cut's new start", () => {
+ const e = { type: "clip", id: "x", start: 100, end: 120, side: { item: "p", from: 6, to: 15 } };
+ assert.deepEqual(cutClip(e, 104, 118).side, { item: "p", from: 2, to: 11 });
+ assert.equal(cutClip(e, 116, 120).side, undefined);
+});
+
+test("R: master spans from beats; a post's card over its attachment; the graph stacks them", () => {
+ const schedule = { segments: [{ id: "c1", type: "clip", start: 0, end: 10 }, { id: "p1", type: "post", start: 10, end: 30 }] };
+ const spans = masterSpans({ beats: beatsOf([{ id: "c1", start: 52, end: 56 }, { at: 12, dur: 5 }]), schedule, cuts: new Map([["c1", { start: 50 }]]) });
+ assert.deepEqual(spans.map((s) => [s.id, s.a, s.b]), [["c1", 2, 6], ["p1", 12, 17]]);
+ const box = { x: 173, y: 2, width: 1574, height: 886 };
+ const regions = spanRegions({ type: "post", box, entry: { type: "post", id: "p", text: "hi there", media: [{ src: "a.png", kind: "image", width: 800, height: 800 }] } });
+ assert.equal(regions.length, 2);
+ assert.equal(spanRegions({ type: "clip", box }).length, 1);
+ const g = reframeGraph({ regions, safe: safeArea({}) });
+ assert.match(g, /^\[0:v\]split=3\[rbg\]\[r0\]\[r1\]/);
+ assert.match(g, /\[v\]$/);
+});
+
+test("landscape side panel: a third of the picture, at its right or left", () => {
+ const g = landscapeSideGeometry({ x: 0, y: 56, w: 1920, h: 1024 }, "right");
+ assert.ok(g.x + g.w <= 1920);
+ assert.equal(landscapeSideGeometry({ x: 0, y: 56, w: 1920, h: 1024 }, "left").x < 100, true);
+});
+
+test("a part of the timeline keeps only the deck's markers after entries it carries", () => {
+ const render = { fps: 30, chrome: { deck: { markers: [{ after: "a", label: "A" }, { after: "z", label: "Z" }] } } };
+ assert.deepEqual(renderForPart(render, [{ id: "a" }, { id: "b~2" }]).chrome.deck.markers, [{ after: "a", label: "A" }]);
+ assert.equal(renderForPart({ fps: 30 }, []).fps, 30);
+});