Archilyzer · Source

archilyzer

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

commit 5a32ac707fccdd6c6076ed4e5e30d353ca96ec3a
parent e4fc7d242918a42573e4af88cc52be1792179153
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue, 10 Nov 2026 10:44:17 -0500

umtool: the L10 review's should-fixes -- 720p band scaled whole, the vertical short's floor, no doubled dissolves, picture overlays in the safe area, a bare short byte for byte

1. 720p: deckLayout scales its own rows and margins by deckScale too (marker band and row, claim row, track, side
   padding, the tally's cells and gaps, the section title) and the page its marker labels and tally label; a size the
   manifest writes in pixels stays those pixels. Markers + a two-line subtitle + a goalpost + a tally fit the 155 px
   band (test); 1080 pins unchanged.
2. render-estimate manifestEstimateMb takes `vertical` (true or the knobs) and reads stackedDeckWanted;
   build-video cliEstimateMb passes --vertical/--vertical-knobs, so `umtool vertical` declares the stacked floor.
3. reframe builtSpans: a stacked short's pieces are cut from the built cut after the dissolve in, before the one
   out, never past their own segment.
4. overlayBox: stamps, stats, the measure extras and the story modules anchor in the picture inside the safe area.
5. verticalCli endCardOf: the end card only for a short that keeps the deck; a bare short's outro key pinned to main.
Nits: runs-finale and the legacy chart band in the lint's left-out list; knobs.md.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mumtool/docs/knobs.md | 25+++++++++++++++++--------
Mumtool/lib/report/verticalCli.mjs | 25+++++++++++++++++--------
Mumtool/report-to-video/build-video.mjs | 2++
Mumtool/report-to-video/chrome-deck.mjs | 15+++++++++------
Mumtool/report-to-video/chrome-story.mjs | 5+++--
Mumtool/report-to-video/deck.mjs | 91+++++++++++++++++++++++++++++++++++++++++++++++++++----------------------------
Mumtool/report-to-video/measure-extras.mjs | 6+++---
Mumtool/report-to-video/modules/index.mjs | 9+++++++--
Mumtool/report-to-video/reframe.mjs | 42+++++++++++++++++++++++++++++++++++-------
Mumtool/report-to-video/render-estimate.mjs | 17++++++++++-------
Mumtool/report-to-video/vertical-deck.test.mjs | 90++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
11 files changed, 251 insertions(+), 76 deletions(-)

diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md @@ -1699,7 +1699,7 @@ top to bottom inside the safe area (`render.vertical.safe`): | Zone | What stands there | |---|---| | the rail (under the top 8 %) | the section's name (the deck's markers; `deck.sectionTitle.first` before the first), its progress -- one segment per section, filled as its clips play -- and `2 / 5` | -| the picture | the clip's 16:9 footage box at the frame's full width; over it, as over the landscape footage box, the stamps, the stats, the effects, the chapters, the measure extras (the diet badge lower-left …) and the shelf (`deck.shelf`) at the picture's lower-left | +| the picture | the clip's 16:9 footage box at the frame's full width; over it, as over the landscape footage box, the stamps, the stats, the effects, the chapters, the measure extras (the diet badge lower-left …) and the shelf (`deck.shelf`) at the picture's lower-left -- each anchored in the picture INSIDE the safe area, never in the right 12 % | | the captions | under the picture, at most two lines (`render.vertical.captions.lines`), each word lit as it is said | | the instruments' panel | two columns: the dial the left column's height, the odometer and the trail down the right (the promise clock in the trail's cell, as in the landscape column); an instrument the panel has no room for is left out, never squashed | | the counters | the tally's cells, when the cut counts its claims (`render.chrome.factcheck`, `deck.counter`) | @@ -1717,7 +1717,8 @@ title, the dial large in a card, the odometer and NET under it (module `dial-fin Every module declares its vertical form (`vertical: {slot}` in `modules/<id>.mjs`: frame, panel, picture, shelf, finale, inline, segment, input). One the cut sets up that has none -- the posts popups and feed, the side panel -(threads, flips), the live chat, the landscape finale's page, the claim checks on the rail -- is LEFT OUT: the lint +(threads, flips), the live chat, the landscape finale's page and its diet runs (`runs-finale`), the claim checks on +the rail, the legacy chart band -- is LEFT OUT: the lint and the build say so (`popup-posts: no vertical form -- left out of the stacked vertical deck …`); the landscape cut keeps it. With the popups left out, a clip that carries posts is not held for them (the landscape cut's `posts.hold`: a frozen frame with nothing over it), and nothing moves the picture; every other second is the landscape cut's. @@ -1728,12 +1729,20 @@ preview. Present is the landscape one. A take's `--preview` of a vertical cut is A reel's **outro in 9:16 is the end card** (`outro.mjs`): over its title "EVERY CLIP, IN FULL", the archive's link as a large QR (`provenance.qrLink`, else `siteOrigin`) with "Scan or search", its host and the call to action beside it, the short's sources -- each clip's date, channel and the time it is from, three of them, then "+ N more in the -archive" -- and the site's name at the foot of the safe area. A short of a stacked deck cut cuts its pieces from the -built cut (deck and all), not from its bare segments. - -**720p.** A deck cut rendered 1280x720 (`render.width`/`height`) has its band scaled with the frame's height -- its -height, the title, the QR, the pips (`deck.mjs` `deckScale`) -- so `deck.footageScale` 0.82 fits as at 1080 (it was -refused: "at most 0.736") and the footage box no longer stands above the frame. 1080 is untouched. +archive" -- and the site's name at the foot of the safe area. Only a short that keeps the deck ends on it. + +**720p.** A deck cut rendered 1280x720 (`render.width`/`height`) has its band scaled with the frame's height +(`deck.mjs` `deckScale`, two thirds; floored there, and only ever down) -- its default height, title, QR and pips, and +the layout's own rows and margins: the marker band, the claim row, the track, the side padding, the tally's cells, the +section title -- so `deck.footageScale` 0.82 fits as at 1080 (it was refused: "at most 0.736"), the footage box no +longer stands above the frame, and markers, a two-line subtitle, a goalpost and a tally all stay inside the band. A +size the manifest writes in pixels (`deck.height`, `deck.qr.size`, `deck.title.size`, `deck.pip`) stays those pixels. +1080 is untouched. The QR's scan lint reads a code at 720p on the frame's short side. + +A short (`umtool vertical`) of a stacked deck cut declares the stacked deck's memory floor to the heavy slot +(`render-estimate.mjs` `VERTICAL_DECK_MIN_MB`, its measured 2.6 GB peak + 25 %), and its pieces are cut from the built +cut clear of its dissolves (each piece after the dissolve in and before the one out, never past its own segment) so +none plays twice. `--deck bare` is the bare short, byte for byte -- its outro the card it always was, not the end card. ## Takes: relabel, supersede, cancel, delete, fork as variant, compare diff --git a/umtool/lib/report/verticalCli.mjs b/umtool/lib/report/verticalCli.mjs @@ -98,6 +98,18 @@ export function knobsOfFlags(flags) { const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); +/** + * A short's 9:16 end card (outro.mjs) -- the archive's link as a QR and the short's sources, each clip's date, channel + * and time from the stacked deck's schedule -- or null: a short that keeps no deck (`--deck bare`, a cut without one) + * ends on the outro card it always did. + */ +export async function endCardOf({ render, knobs = {}, provenance = {}, timeline = [], schedule = null }) { + const V = await import("umtool-report-to-video/vertical"); + if (!V.stackedDeckWanted({ ...render, format: "vertical", vertical: { ...(render?.vertical ?? {}), ...knobs } })) return null; + const { endCardSources } = await import("umtool-report-to-video/outro"); + return { qrUrl: provenance.qrLink ?? provenance.siteOrigin ?? null, sources: endCardSources(timeline, schedule) }; +} + /** The heavy slot (report-to-video/heavy-gate.mjs), loaded at run time: `(cmd, fn) => …` with a declared estimate. */ async function heavySlot() { const gate = new URL("./heavy-gate.mjs", import.meta.resolve("umtool-report-to-video/package.json")).href; @@ -259,14 +271,11 @@ export async function verticalCommand(args, { reportsRoot = REPORTS_ROOT, log = const { wrapShort } = await import("umtool-report-to-video/reel-intro"); const RF = await import("umtool-report-to-video/reframe"); const slot = await heavySlot(); - // The 9:16 end card (outro.mjs): the archive's link as a QR, and the short's sources -- each clip's date, - // channel and time, from the stacked deck's schedule when it has one. - const { endCardSources } = await import("umtool-report-to-video/outro"); - const prov = takeManifest.provenance ?? {}; - const endCard = { - qrUrl: prov.qrLink ?? prov.siteOrigin ?? null, - sources: endCardSources(plan.timeline, reframe || landscape ? null : await readJson(path.join(outDir, `vertical-${name}-${tag}`, "schedule.json"))), - }; + // The 9:16 end card (outro.mjs) -- the stacked deck's only: a bare short's outro is the card it always was. + const endCard = await endCardOf({ + render: takeManifest.render ?? {}, knobs, provenance: takeManifest.provenance ?? {}, timeline: plan.timeline, + schedule: reframe || landscape ? null : await readJson(path.join(outDir, `vertical-${name}-${tag}`, "schedule.json")), + }); wrapped = await slot(["umtool", "vertical", r.project.id, "--take", take, ...(reel ? ["--reel", reel] : []), "(intro/outro)"], () => wrapShort({ file: outFile, takeDir, render: takeManifest.render ?? {}, manifest: takeManifest, introSpec, outro, xfade: typeof reelSettings.xfade === "number" ? reelSettings.xfade : 0.3, log: say, endCard, diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -7729,6 +7729,8 @@ export async function cliEstimateMb(manifestPath, opts = {}, env = process.env) xfade: !opts.noXfade, single: Boolean(opts.clipPreview || opts.short), batch, + // A `--vertical` build of a landscape manifest (`umtool vertical`), its knobs: a stacked deck's floor. + ...(opts.vertical ? { vertical: opts.verticalKnobs && typeof opts.verticalKnobs === "object" ? opts.verticalKnobs : true } : {}), }); } diff --git a/umtool/report-to-video/chrome-deck.mjs b/umtool/report-to-video/chrome-deck.mjs @@ -853,7 +853,10 @@ export function deckHtml(schedule, render, opts = {}) { // As written in two lines, the count gives the second line its room. const countSize = tb ? Math.round(tb.height * (labelLines > 1 ? 0.36 : 0.42)) : 0; const countBox = Math.round(countSize * 1.12); - const labelSize = written ? TALLY_WRITTEN.size : 13; + // A band off 1080 (deckLayout `scale`, a 720p frame's): its fixed sizes scaled with it; at 1080 the numbers as ever. + const ks = lay.scale ?? 1; + const zs = ks === 1 ? (v) => v : (v) => Math.round(v * ks); + const labelSize = zs(written ? TALLY_WRITTEN.size : 13); const labelBox = written ? TALLY_WRITTEN.lineBox : 17; const labelBlock = labelBox * labelLines; const cellTop = tb ? Math.round((tb.height - (countBox + 8 + labelBlock)) / 2) + 2 : 0; @@ -1058,21 +1061,21 @@ export function deckHtml(schedule, render, opts = {}) { .mstick { position: absolute; left: -1.5px; top: -14px; width: 3px; height: 20px; border-radius: 1.5px; background: var(--mc); } .mhead { position: absolute; left: 1.5px; top: -14px; width: 12px; height: 10px; background: var(--mc); clip-path: polygon(0% 0%, 100% 50%, 0% 100%); } - .mlabel { position: absolute; top: ${(band?.y ?? 3) + (staggered ? MARKER_ROW : 0) - tr.y}px; height: 20px; text-align: center; white-space: nowrap; - overflow: hidden; text-overflow: ellipsis; font-family: 'DeckSansBold', sans-serif; font-size: ${MARKER_LABEL_SIZE}px; - line-height: 20px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mc); + .mlabel { position: absolute; top: ${(band?.y ?? 3) + (staggered ? zs(MARKER_ROW) : 0) - tr.y}px; height: ${zs(20)}px; text-align: center; white-space: nowrap; + overflow: hidden; text-overflow: ellipsis; font-family: 'DeckSansBold', sans-serif; font-size: ${zs(MARKER_LABEL_SIZE)}px; + line-height: ${zs(20)}px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--mc); text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6); }` : ""}${markers.some((mk) => mk.level === 2 && mk.label && !mk.hide) ? ` /* A subsection's flag: shorter, its head smaller, its words smaller and quieter. */ .mflag.sub .mstick { top: -8px; height: 14px; width: 2px; left: -1px; } .mflag.sub .mhead { top: -8px; left: 1px; width: 8px; height: 7px; } - .mflag.sub .mlabel { font-size: ${MARKER_SUB_LABEL_SIZE}px; opacity: 0.72; }` : ""}${markers.some((mk) => !mk.label || mk.hide) ? ` + .mflag.sub .mlabel { font-size: ${zs(MARKER_SUB_LABEL_SIZE)}px; opacity: 0.72; }` : ""}${markers.some((mk) => !mk.label || mk.hide) ? ` /* An unlabelled marker: a short tick across the track, no words. */ .mtick { position: absolute; left: -1px; top: -6px; width: 2px; height: 12px; border-radius: 1px; background: var(--mc); opacity: 0.85; }` : ""}${markers.some((mk) => (!mk.label || mk.hide) && mk.level === 2) ? ` /* A subsection's tick: half as tall. */ .mflag.sub .mtick { top: -3px; height: 6px; opacity: 0.7; }` : ""}${staggered ? ` /* Staggered labels: row 1 a row above, its flag's stick up to it. */ .mflag.up .mlabel { top: ${band.y - tr.y}px; } - .mflag.up .mstick { top: ${band.y + 20 - tr.y}px; height: ${tr.y + 6 - (band.y + 20)}px; }` : ""}${stRow ? ` + .mflag.up .mstick { top: ${band.y + zs(20) - tr.y}px; height: ${tr.y + 6 - (band.y + zs(20))}px; }` : ""}${stRow ? ` /* The section title: the current section's name, one quiet line centred under the track; ellipsized, never wrapped. */ .stitle { position: absolute; left: ${stRow.x}px; top: ${stRow.y}px; width: ${stRow.width}px; height: ${stRow.height}px; diff --git a/umtool/report-to-video/chrome-story.mjs b/umtool/report-to-video/chrome-story.mjs @@ -15,7 +15,7 @@ // that fills as the cut plays: a row comes in on its first clip, its // outcome on the outcome's clip (else the end of its last evidence clip). // Each STATE of the ledger is its own block, shown over exactly its span. -import { deckGeometry, feedGeometry, pictureK } from "./deck.mjs"; +import { deckGeometry, feedGeometry, overlayBox, pictureK } from "./deck.mjs"; import { rgba } from "./chrome-deck.mjs"; import { compileCues, cuePageHtml, dateText, esc, joinSpans, r4, segmentSpans, spanEvents, INSTANT } from "./chrome-cues.mjs"; import { CHAPTER_DEFAULTS, PAIR_DEFAULTS, STATUS_DEFAULTS } from "./modules/story-settings.mjs"; @@ -24,7 +24,8 @@ const isObj = (v) => v !== null && typeof v === "object" && !Array.isArray(v); /** The footage box this cut's clips play in (the feed's when it is one). */ export function footageBox(render, { feed = false } = {}) { - const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage; + // The stacked vertical deck's picture inside the safe area (overlayBox); the footage box otherwise. + const f = overlayBox(render, { feed }); return { x: f.x, y: f.y, width: f.width, height: f.height }; } diff --git a/umtool/report-to-video/deck.mjs b/umtool/report-to-video/deck.mjs @@ -130,14 +130,20 @@ export function resolveDeck(render) { // The stacked deck (vertical-deck.mjs): the posts' popups have no vertical form -- not drawn, so no clip holds // for them (a frozen frame with nothing over it) and nothing moves the picture; there is no feed's column. if (stackedOn(render)) merged.posts = { ...merged.posts, show: false, shift: false, layout: "popup" }; - // A frame of another height than 1080 (a 720p render): the band's sizes scaled with it -- its height, the - // title, the QR, the pips -- so the footage fits above it as at 1080 (deckScale). 1080 is untouched. + // A frame shorter than 1080 (a 720p render): the band's DEFAULT sizes scaled with it -- its height, the title, + // the QR, the pips -- so the footage fits above it as at 1080 (deckScale; deckLayout scales its own rows and + // margins likewise). A size the manifest writes in pixels stays those pixels. 1080 is untouched. const k = deckScale(render); if (k !== 1) { - merged.height = Math.round(merged.height * k); - merged.title = { ...merged.title, size: Math.max(12, Math.round(merged.title.size * k)) }; - merged.qr = { ...merged.qr, size: Math.round(merged.qr.size * k) }; - merged.pip = { ...merged.pip, size: Math.max(2, Math.round(merged.pip.size * k)), activeSize: Math.max(4, Math.round(merged.pip.activeSize * k)) }; + const own = (key, sub = null) => (sub ? d?.[key]?.[sub] !== undefined : d?.[key] !== undefined); + if (!own("height")) merged.height = Math.round(merged.height * k); + if (!own("title", "size")) merged.title = { ...merged.title, size: Math.max(12, Math.round(merged.title.size * k)) }; + if (!own("qr", "size")) merged.qr = { ...merged.qr, size: Math.round(merged.qr.size * k) }; + merged.pip = { + ...merged.pip, + ...(own("pip", "size") ? {} : { size: Math.max(2, Math.round(merged.pip.size * k)) }), + ...(own("pip", "activeSize") ? {} : { activeSize: Math.max(4, Math.round(merged.pip.activeSize * k)) }), + }; } return merged; } @@ -692,49 +698,55 @@ export const BAND_TEXT_RESERVE = 0.36; export function deckLayout(render, { tally = null, schedule = null } = {}) { const { W, deck: rect } = deckGeometry(render); const d = resolveDeck(render); - const padX = DECK_PAD_X; + // Its rows and margins at the band's scale (deckScale: a 720p frame's two thirds; 1080 is 1 and every + // number below is the one it always was). + const k = deckScale(render); + const z = k === 1 ? (v) => v : (v) => Math.round(v * k); + const padX = z(DECK_PAD_X); // The markers' labels (`deck.markers`) stand in a band above the track: the // track moves down by it, and only when there is a marker to label, so a // deck without them lays out as it always did -- nor one whose markers are // all unlabelled (or `rail.labels: false`): ticks need no band. const marked = labelledMarkers(d).length > 0; const rows = marked && schedule ? markerRowsOf(schedule, render) : 1; - const markerBand = marked ? MARKER_BAND + (rows > 1 ? MARKER_ROW : 0) : 0; + const markerBand = marked ? z(MARKER_BAND) + (rows > 1 ? z(MARKER_ROW) : 0) : 0; // A goalpost's words (`deck.claims`, claims.mjs) stand in a row of their // own above the markers'; only with one, likewise. - const claimRow = hasGoalpost(d) ? CLAIM_ROW : 0; - const trackY = 16 + claimRow + markerBand; + const claimRow = hasGoalpost(d) ? z(CLAIM_ROW) : 0; + const trackY = z(16) + claimRow + markerBand; // The body is everything under the pip track: the text block and the QR are // both centred in it, so the title's optical centre and the code's agree // whatever the deck's height. 14 px clears the active pip's halo. - const bodyTop = trackY + 14; - const bodyH = rect.height - bodyTop - 8; + const bodyTop = trackY + z(14); + const bodyH = rect.height - bodyTop - z(8); // Under a marker band the code keeps clear of the active pip's halo and // inside the deck: it shrinks to the room left under the track if it must. const banded = markerBand + claimRow; - const qrSize = banded ? Math.min(d.qr.size, rect.height - (trackY + 12) - 2) : d.qr.size; + const qrSize = banded ? Math.min(d.qr.size, rect.height - (trackY + z(12)) - 2) : d.qr.size; let qrY = Math.round(bodyTop + (bodyH - qrSize) / 2); - if (banded) qrY = Math.min(rect.height - qrSize - 2, Math.max(qrY, trackY + 12)); + if (banded) qrY = Math.min(rect.height - qrSize - 2, Math.max(qrY, trackY + z(12))); const qr = d.qr.show ? { x: W - padX - qrSize, y: qrY, size: qrSize } : null; let textX = padX; - let textRight = qr ? qr.x - 48 : W - padX; + let textRight = qr ? qr.x - z(48) : W - padX; let tallyBox = null; if (tally?.length) { // A cell per verdict the cut uses: its count over its label. Beside the // QR's cell (whose plate starts 46 px before the code) on the right, or // ahead of the title on the left; 40 px of air to the text either way. // Past 8 series the cells narrow into one row's budget (design.mjs counterCell). - const { cell, gap } = counterCell(tally.length); + const cc = counterCell(tally.length); + const cell = z(cc.cell); + const gap = z(cc.gap); const width = tally.length * cell + (tally.length - 1) * gap; - const height = Math.min(bodyH - 8, 118); + const height = Math.min(bodyH - z(8), z(118)); const y = Math.round(bodyTop + (bodyH - height) / 2); if (resolveFactcheck(render).tally.position === "left") { tallyBox = { x: padX, y, width, height, cell, gap }; - textX = padX + width + 40; + textX = padX + width + z(40); } else { - const right = qr ? qr.x - 46 - 24 : W - padX; + const right = qr ? qr.x - z(46) - z(24) : W - padX; tallyBox = { x: right - width, y, width, height, cell, gap }; - textRight = tallyBox.x - 40; + textRight = tallyBox.x - z(40); } } // Line boxes, not font sizes: the title's box holds its descenders inside the @@ -757,14 +769,15 @@ export function deckLayout(render, { tally = null, schedule = null } = {}) { const st = resolveSectionTitle(render); let sectionTitle = null; if (st) { - const y = trackY + Math.ceil(d.pip.activeSize / 2) + 6; - const height = Math.round(st.size * 1.3); + const y = trackY + Math.ceil(d.pip.activeSize / 2) + z(6); + const stSize = z(st.size); + const height = Math.round(stSize * 1.3); let lo = padX; let hi = W - padX; - if (qr) hi = Math.min(hi, qr.x - 46 - 24); + if (qr) hi = Math.min(hi, qr.x - z(46) - z(24)); if (tallyBox) { - if (tallyBox.x < W / 2) lo = Math.max(lo, tallyBox.x + tallyBox.width + 24); - else hi = Math.min(hi, tallyBox.x - 24); + if (tallyBox.x < W / 2) lo = Math.max(lo, tallyBox.x + tallyBox.width + z(24)); + else hi = Math.min(hi, tallyBox.x - z(24)); } let half = Math.max(0, Math.floor(Math.min(W / 2 - lo, hi - W / 2))); titleY = Math.max(titleY, y + height + 2); @@ -776,16 +789,18 @@ export function deckLayout(render, { tally = null, schedule = null } = {}) { // width), so the two never meet. const over = titleY + block + BAND_FOOT - rect.height; if (over > 0) { - titleY = Math.max(trackY + Math.ceil(d.pip.activeSize / 2) + 4, titleY - over); + titleY = Math.max(trackY + Math.ceil(d.pip.activeSize / 2) + z(4), titleY - over); const reserve = Math.min(textRight - textX, Math.round(W * BAND_TEXT_RESERVE)); - lo = Math.max(lo, textX + reserve + 24); + lo = Math.max(lo, textX + reserve + z(24)); half = Math.max(0, Math.floor(Math.min(W / 2 - lo, hi - W / 2))); } - sectionTitle = { x: Math.round(W / 2 - half), y, width: 2 * half, height, size: st.size }; + sectionTitle = { x: Math.round(W / 2 - half), y, width: 2 * half, height, size: stSize }; } return { width: W, height: rect.height, + // Only off 1080 (a 720p band, deckScale): the page scales its own fixed sizes by it. + ...(k !== 1 ? { scale: k } : {}), pipTrack: { x0: padX, x1: W - padX, y: trackY }, text: { x: textX, @@ -805,9 +820,9 @@ export function deckLayout(render, { tally = null, schedule = null } = {}) { // Only with a tally, so a deck without claims lays out as it always did. ...(tallyBox ? { tally: tallyBox } : {}), // Only with markers, likewise: where their labels stand (deckMarkers). - ...(markerBand ? { markerBand: { y: 3 + claimRow, height: markerBand + 6, ...(rows > 1 ? { rows } : {}) } } : {}), + ...(markerBand ? { markerBand: { y: z(3) + claimRow, height: markerBand + z(6), ...(rows > 1 ? { rows } : {}) } } : {}), // Only with a goalpost: where its words stand (claimsLayout). - ...(claimRow ? { claimBand: { y: 3, height: claimRow } } : {}), + ...(claimRow ? { claimBand: { y: z(3), height: claimRow } } : {}), // Only with the section title on: its line under the track. ...(sectionTitle ? { sectionTitle } : {}), }; @@ -2881,7 +2896,7 @@ export function feedGeometry(render) { */ export function stampGeometry(render, { feed = false } = {}) { const { W } = deckGeometry(render); - const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage; + const f = overlayBox(render, { feed }); const k = pictureK(render, W); // `stamp.scale` sizes the region (the stamp is drawn to it), still inside the footage. const { position: pos, scale = 1 } = resolveFactcheck(render).stamp; @@ -2903,6 +2918,18 @@ export function stampGeometry(render, { feed = false } = {}) { export const pictureK = (render, W = render?.width ?? 1920) => (stackedOn(render) ? STACKED_PICTURE_K : W / 1920); /** + * The box what stands over the footage is anchored in: the footage box (the feed's when `feed`) -- or, in the + * stacked vertical deck, its picture inside the safe area (the picture is the frame's whole width; the right 12 % + * is the platform's buttons). + */ +export function overlayBox(render, { feed = false } = {}) { + const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage; + if (!stackedOn(render)) return f; + const a = stackedGeometry(render).safe; + return { x: a.x0, y: f.y, width: a.x1 - a.x0, height: f.height }; +} + +/** * Where the stats region sits in the frame (chrome-stats.mjs, stats.mjs): a * panel in the footage box -- the feed's when `feed`, else the deck's -- at * `stats.position`, `inset` clear of its edges: 48 px plus 150 a field wide @@ -2915,7 +2942,7 @@ export const pictureK = (render, W = render?.width ?? 1920) => (stackedOn(render */ export function statsGeometry(render, { feed = false } = {}) { const { W } = deckGeometry(render); - const f = feed ? feedGeometry(render).footage : deckGeometry(render).footage; + const f = overlayBox(render, { feed }); const k = pictureK(render, W); const cfg = resolveStats(render); const width = Math.min(even((48 + 150 * cfg.fields.length) * k), even(f.width)); diff --git a/umtool/report-to-video/measure-extras.mjs b/umtool/report-to-video/measure-extras.mjs @@ -25,7 +25,7 @@ // - DIET: the state's diet, re-stamped at each change of regime or diet // number; a null diet after one is "NO DIET" (the producer has applied the // off-scope rule: this only draws state.diet). -import { deckGeometry, feedGeometry, instrumentsGeometry, pictureK } from "./deck.mjs"; +import { deckGeometry, feedGeometry, instrumentsGeometry, overlayBox, pictureK } from "./deck.mjs"; import { chapterCover, chapterWindows } from "./chrome-story.mjs"; import { dietTagWidth, MEASURE_EXTRAS, MEASURE_POSITIONS, resolveMeasureExtra, SHELF_POSITION } from "./modules/measure-extras-settings.mjs"; import { resolveShelf } from "./modules/shelf-settings.mjs"; @@ -883,7 +883,7 @@ export function measureExtraGeometry(id, render, { feed = false } = {}) { if (slot) return { ...slot }; } const g = deckGeometry(render); - const f = feed ? feedGeometry(render).footage : g.footage; + const f = overlayBox(render, { feed }); // Over the footage at its design size scaled with the frame (pictureK: the stacked vertical deck's own). const pk = pictureK(render, g.W); const k = pk * (cfg.scale ?? 1); @@ -937,7 +937,7 @@ const overlapsSpan = (spans, from, to) => spans.some((sp) => sp.in < to - 1e-6 & export function anchorRect(id, render, anchor, size = 1, { feed = false } = {}) { const cfg = resolveMeasureExtra(id, render) ?? resolveMeasureExtra(id, { chrome: { deck: {} } }); const g = deckGeometry(render); - const f = feed ? feedGeometry(render).footage : g.footage; + const f = overlayBox(render, { feed }); const pk = pictureK(render, g.W); const k = pk * (cfg.scale ?? 1) * size; const box = measureBox(id, render); diff --git a/umtool/report-to-video/modules/index.mjs b/umtool/report-to-video/modules/index.mjs @@ -12,6 +12,7 @@ import { instrumentsGeometry } from "../deck.mjs"; import { verticalOn, verticalRender } from "../vertical.mjs"; import { leftOutWords, stackedOn } from "../vertical-deck.mjs"; import { resolveDial } from "../instruments.mjs"; +import { runsFinaleWanted } from "../chrome-runs-finale.mjs"; import chart from "./chart.mjs"; import shell from "./shell.mjs"; @@ -216,9 +217,13 @@ export function stackedLeftOut(manifest) { const out = []; const tl = Array.isArray(manifest?.timeline) ? manifest.timeline : []; for (const m of MODULES) { - // A legacy page the deck never draws (the chart band) is not the deck's to leave out. - if (verticalFormOf(m) || m.cached === false) continue; + if (verticalFormOf(m)) continue; let on = configured(m, render); + // The finale's diet runs: on with `deck.finale.dietRuns` and a finale to draw them in. + if (m.id === "runs-finale") on = !!runsFinaleWanted(render) && tl.some((e) => e?.layout === "finale"); + // The legacy chart band (`render.chart` under `render.chromeEngine`): drawn only without the deck, so a stacked + // deck says so only when the cut asks for it. + if (m.id === "chart") on = manifest?.render?.chromeEngine === "hyperframes" && !!manifest?.render?.chart; if (m.id === "popup-posts") on = Array.isArray(manifest?.posts) && manifest.posts.length > 0 && render?.chrome?.deck?.posts?.show !== false; if (m.id === "finale") on = tl.some((e) => e?.layout === "finale"); if (m.id === "feed") on = render?.chrome?.deck?.posts?.layout === "feed"; diff --git a/umtool/report-to-video/reframe.mjs b/umtool/report-to-video/reframe.mjs @@ -68,6 +68,34 @@ export async function normalizeLoudness(input, output, target, { log = () => {} * piece plays whole, else each segment's part cut and joined; then the * short's loudness. `{seconds, loudness}`. */ +/** + * Where each piece is cut from a stacked deck's BUILT cut (the build's schedule), or null when a piece is not in it. + * A segment overlaps its neighbours by the crossfade (deck.mjs scheduleFrom), so a piece keeps out of them -- the + * dissolve in, after its start + D, and the one out, before its end − D -- or every dissolve would play twice once + * the pieces are joined; and its `to` never runs past its own segment. Pure. + * + * @param {Array<{ id: string, from: number, to: number | null }>} pieces + * @param {{ segments?: Array<{ id: string, start: number, duration: number }>, transition?: number } | null} schedule + * @returns {Array<{ from: number, to: number }> | null} + */ +export function builtSpans(pieces, schedule) { + const segs = Array.isArray(schedule?.segments) ? schedule.segments : []; + const index = new Map(segs.map((s, i) => [s.id, i])); + if (!segs.length || !pieces.every((p) => index.has(p.id))) return null; + const D = Math.max(0, Number(schedule.transition) || 0); + return pieces.map((p) => { + const i = index.get(p.id); + const s = segs[i]; + const start = Number(s.start); + const dur = Number(s.duration); + const lo = i > 0 ? D : 0; + const hi = i < segs.length - 1 ? dur - D : dur; + const from = Math.min(Math.max(lo, Number(p.from) || 0), hi); + const to = Math.max(from, Math.min(hi, p.to === null || p.to === undefined ? hi : Number(p.to))); + return { from: Math.round((start + from) * 1000) / 1000, to: Math.round((start + to) * 1000) / 1000 }; + }); +} + export async function assembleShort({ pieces, segmentsDir, built, outFile, render, schedule = null, log = () => {} }) { const target = verticalKnobs(render).loudness; const whole = pieces.every((p) => !p.from && p.to === null); @@ -78,14 +106,14 @@ export async function assembleShort({ pieces, segmentsDir, built, outFile, rende const parts = []; // THE STACKED VERTICAL DECK (vertical-deck.mjs): its segments are the picture alone -- the deck is laid over the // built cut -- so a piece is cut from the built cut at its segment's place (the build's schedule), deck and all. - const placed = new Map((Array.isArray(schedule?.segments) ? schedule.segments : []).map((s) => [s.id, s])); - const fromBuilt = !!schedule && pieces.every((p) => placed.has(p.id)); + const span = builtSpans(pieces, schedule); pieces.forEach((p, i) => { - const at = fromBuilt ? Number(placed.get(p.id).start) : 0; - const end = p.to === null ? (fromBuilt ? at + Number(placed.get(p.id).duration) : null) : at + p.to; - inputs.push("-i", fromBuilt ? built : path.join(segmentsDir, `${p.id}.mp4`)); - const trim = end === null ? `trim=start=${f3(at + p.from)}` : `trim=start=${f3(at + p.from)}:end=${f3(end)}`; - const atrim = end === null ? `atrim=start=${f3(at + p.from)}` : `atrim=start=${f3(at + p.from)}:end=${f3(end)}`; + const b = span ? span[i] : null; + const a0 = b ? b.from : p.from; + const end = b ? b.to : p.to; + inputs.push("-i", b ? built : path.join(segmentsDir, `${p.id}.mp4`)); + const trim = end === null ? `trim=start=${f3(a0)}` : `trim=start=${f3(a0)}:end=${f3(end)}`; + const atrim = end === null ? `atrim=start=${f3(a0)}` : `atrim=start=${f3(a0)}:end=${f3(end)}`; 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]`); diff --git a/umtool/report-to-video/render-estimate.mjs b/umtool/report-to-video/render-estimate.mjs @@ -51,6 +51,9 @@ // Pure and dependency-free: the umtool app bundles takeRender.mjs, which // imports this, and build-video.mjs imports it too (no cycle). +// The vertical format's rules (common, pure and dependency-free as this file is). +import { stackedDeckWanted } from "yt-dlp-transcript-common/lib/report/vertical.mjs"; + /** The crossfade / overlay pass's own memory, with no segment open. */ export const RENDER_ENCODE_BASE_MB = 1700; /** Each segment the pass holds open (a decoder and its frames). */ @@ -199,16 +202,16 @@ export function manifestSegments(manifest) { * @param {{ xfade?: boolean, single?: boolean, batch?: number }} [o] * @returns {number | null} */ -export function manifestEstimateMb(manifest, env = process.env, { xfade = true, single = false, batch = XFADE_BATCH } = {}) { +export function manifestEstimateMb(manifest, env = process.env, { xfade = true, single = false, batch = XFADE_BATCH, vertical = null } = {}) { // A basic cut (render.mode, as resolved: a take's render manifest carries its preset laid) is one encode at a time. if (manifest?.render?.mode === "basic") return renderEstimateMb("basic", env); const crossfades = xfade && (manifest?.render?.transition ?? 0.5) !== 0; const segments = single || (manifest && !crossfades) ? 1 : manifestSegments(manifest); const mb = renderEstimateMb("render", env, { segments, batch }); - // A 9:16 cut that keeps its deck (render.format vertical with a deck, render.vertical.deck not "bare"): floored at - // its measured peak + margin -- unless an override says otherwise (0: declare nothing). - const r = manifest?.render; - const c = r?.chrome; - const stacked = r?.format === "vertical" && r?.vertical?.deck !== "bare" && !!c && typeof c === "object" && c.engine === "hyperframes" && c.layout === "deck"; - return stacked && mb > 0 && env.UMTOOL_RENDER_ESTIMATE_MB === undefined ? Math.max(mb, VERTICAL_DECK_MIN_MB) : mb; + // A 9:16 cut that keeps its deck (stackedDeckWanted: the manifest's render.format vertical, or a `--vertical` build + // of it -- `vertical`: true or its knobs, as `umtool vertical` asks): floored at its measured peak + margin -- + // unless an override says otherwise (0: declare nothing). + const own = manifest?.render ?? {}; + const r = vertical ? { ...own, format: "vertical", vertical: { ...(own.vertical ?? {}), ...(typeof vertical === "object" ? vertical : {}) } } : own; + return stackedDeckWanted(r) && mb > 0 && env.UMTOOL_RENDER_ESTIMATE_MB === undefined ? Math.max(mb, VERTICAL_DECK_MIN_MB) : mb; } diff --git a/umtool/report-to-video/vertical-deck.test.mjs b/umtool/report-to-video/vertical-deck.test.mjs @@ -7,7 +7,7 @@ import { } from "./vertical-deck.mjs"; import { verticalRender } from "./vertical.mjs"; import { - deckGeometry, deckLayout, deckSchedule, instrumentsGeometry, pictureK, resolveDeck, stampGeometry, validateChrome, + deckGeometry, deckLayout, deckSchedule, instrumentsGeometry, pictureK, resolveDeck, stampGeometry, statsGeometry, validateChrome, } from "./deck.mjs"; import { verticalKnobs, validateVerticalRender } from "yt-dlp-transcript-common/lib/report/vertical.mjs"; import { validateLook } from "yt-dlp-transcript-common/lib/report/look.mjs"; @@ -59,6 +59,21 @@ test("every zone of the stacked deck keeps inside the safe area; the picture is for (const [name, box] of [["rail", g.rail], ["captions", g.captions], ["panel", g.panel], ["counters", g.counters], ["source", g.source], ["card", g.post.card], ["post counters", g.post.counters], ["finale", g.finale.column]]) { assert.ok(inside(box, a), `${name} ${JSON.stringify(box)} inside ${JSON.stringify(a)}`); } + // What stands over the picture -- the stamps and the stats at every corner, the measure extras at every anchor -- + // keeps inside the safe area too (the picture itself is the frame's whole width). + for (const position of ["top-left", "top-right", "bottom-left", "bottom-right"]) { + const rr = stacked({ measure: {} }, { safe }); + const fc = { ...rr, chrome: { ...rr.chrome, factcheck: { stamp: { position } }, stats: { position } } }; + assert.ok(inside(stampGeometry(fc), a), `stamp ${position} ${JSON.stringify(stampGeometry(fc))}`); + assert.ok(inside(statsGeometry(fc), a), `stats ${position} ${JSON.stringify(statsGeometry(fc))}`); + } + for (const id of ["goals", "peak", "diet", "streak"]) { + for (const position of ["top-left", "top-right", "bottom-left", "bottom-right", "top-center", "bottom-center"]) { + const rr = { ...r, chrome: { ...r.chrome, deck: { ...r.chrome.deck, [id]: { position } } } }; + const box = measureExtraGeometry(id, rr); + assert.ok(inside(box, a), `${id} ${position} ${JSON.stringify(box)}`); + } + } // Nothing that must be read in the right band or the bottom band. for (const box of [g.rail, g.captions, g.panel, g.source, g.counters]) { assert.ok(box.x + box.width <= a.x1); @@ -233,6 +248,10 @@ test("what the stacked deck leaves out is said; every module that stands in it d assert.ok(words.some((w) => w.startsWith("popup-posts:"))); assert.ok(words.some((w) => w.startsWith("flips:"))); assert.deepEqual(stackedLeftOut({ ...m, render: { ...m.render, vertical: { deck: "bare" } } }), []); + // The finale's diet runs, with a finale to draw them in. + const runs = { ...m, render: { ...m.render, chrome: { ...m.render.chrome, deck: { finale: { dietRuns: true } } } }, timeline: [{ type: "clip", id: "n", layout: "finale" }] }; + assert.ok(stackedLeftOut(runs).some((w) => w.startsWith("runs-finale:"))); + assert.ok(!stackedLeftOut(m).some((w) => w.startsWith("chart:")), "the chart band only under its own legacy engine"); assert.deepEqual(stackedLeftOut({ ...m, render: landscape() }), []); }); @@ -325,3 +344,72 @@ test("with the tally's row the dial, the odometer and the trail still stand in t assert.ok(Math.abs(ig.trail.width / ig.trail.height - 600 / 138) < 0.1); assert.ok(ig.trail.y + ig.trail.height <= ig.column.y + ig.column.height); }); + +test("720p: markers (two rows), a two-line subtitle, a goalpost and a tally all fit inside the scaled band", () => { + const deck = { + footageScale: 0.7, subtitle: { lines: 2 }, sectionTitle: { first: "Opening" }, + markers: [{ after: "c1", label: "A long first section" }, { after: "c2", label: "Another long section" }, { after: "c3", label: "And a third one" }], + claims: [{ kind: "goalpost", label: "Pill test results", steps: [{ at: "c2", t: 1, said: "“3–5 weeks”", from: "2026-09-23", due: ["P3W", "P5W"] }] }], + }; + const r = { width: 1280, height: 720, fps: 30, chrome: { ...DECK, deck }, palette: { bg: "#0F1312", fg: "#EDF0EC" } }; + assert.deepEqual(validateChrome(r.chrome, r), []); + const g = deckGeometry(r); + assert.ok(g.footage.y >= 0 && g.footage.y + g.footage.height <= g.deck.y); + const lay = deckLayout(r, { tally: ["CORROBORATED", "CONTRADICTED", "UNVERIFIED"] }); + assert.equal(lay.scale, 2 / 3); + const t = lay.text; + const textBottom = t.subtitleY + (t.headBox ?? 0) + t.subtitleBox; + assert.ok(textBottom <= lay.height, `text bottom ${textBottom} in a ${lay.height} px band`); + assert.ok(lay.tally.y >= 0 && lay.tally.y + lay.tally.height <= lay.height, JSON.stringify(lay.tally)); + assert.ok(lay.tally.cell >= 80, "the tally's cells scaled, not squashed"); + assert.ok(lay.qr.y + lay.qr.size <= lay.height); + // A size written in pixels stays those pixels at 720. + assert.equal(resolveDeck({ ...r, chrome: { ...DECK, deck: { ...deck, height: 200, qr: { size: 120 } } } }).height, 200); + assert.equal(resolveDeck({ ...r, chrome: { ...DECK, deck: { ...deck, qr: { size: 120 } } } }).qr.size, 120); +}); + +test("a --vertical build of a landscape deck cut (umtool vertical) declares the stacked floor too; --deck bare does not", async () => { + const { mkdtemp, writeFile, rm } = await import("node:fs/promises"); + const { tmpdir } = await import("node:os"); + const path = await import("node:path"); + const { VERTICAL_DECK_MIN_MB, manifestEstimateMb } = await import("./render-estimate.mjs"); + const { cliEstimateMb } = await import("./build-video.mjs"); + const m = { render: { width: 1920, height: 1080, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }, timeline: [{ type: "clip", id: "a" }] }; + assert.ok(manifestEstimateMb(m, {}, { single: true, vertical: true }) >= VERTICAL_DECK_MIN_MB); + assert.equal(manifestEstimateMb(m, {}, { single: true, vertical: { deck: "bare" } }), manifestEstimateMb(m, {}, { single: true })); + const dir = await mkdtemp(path.join(tmpdir(), "vdeck-est-")); + try { + const file = path.join(dir, "m.json"); + await writeFile(file, JSON.stringify(m)); + assert.ok((await cliEstimateMb(file, { vertical: true, verticalKnobs: {}, short: false, clipPreview: false }, {})) >= VERTICAL_DECK_MIN_MB); + assert.ok((await cliEstimateMb(file, { vertical: true, verticalKnobs: { deck: "bare" } }, {})) < VERTICAL_DECK_MIN_MB || manifestEstimateMb(m, {}) >= VERTICAL_DECK_MIN_MB); + } finally { + await rm(dir, { recursive: true, force: true }); + } +}); + +test("a stacked short's pieces are cut from the built cut clear of its dissolves, never past their own segment", async () => { + const { builtSpans } = await import("./reframe.mjs"); + const schedule = { transition: 0.5, segments: [{ id: "a", start: 0, duration: 6 }, { id: "b", start: 5.5, duration: 8 }, { id: "c", start: 13, duration: 4 }] }; + assert.deepEqual(builtSpans([{ id: "a", from: 0, to: null }, { id: "b", from: 1, to: 20 }, { id: "c", from: 0, to: null }], schedule), [ + { from: 0, to: 5.5 }, { from: 6.5, to: 13 }, { from: 13.5, to: 17 }, + ]); + // A piece the build does not have: joined from the segments as before. + assert.equal(builtSpans([{ id: "z", from: 0, to: null }], schedule), null); + assert.equal(builtSpans([{ id: "a", from: 0, to: null }], null), null); +}); + +test("a bare short's outro is the card it always was: no end card, the same key", async () => { + const { endCardOf } = await import("../lib/report/verticalCli.mjs"); + const { outroKey } = await import("./outro.mjs"); + const render = { width: 1920, height: 1080, chrome: { engine: "hyperframes", layout: "deck", deck: {} } }; + const timeline = [{ type: "clip", id: "a", video: "v", start: 61, channelTitle: "Chan", date: "2026-01-12" }]; + const provenance = { siteOrigin: "https://jeralyzer.pages.dev" }; + assert.equal(await endCardOf({ render, knobs: { deck: "bare" }, provenance, timeline }), null); + assert.equal(await endCardOf({ render: { width: 1920, height: 1080 }, knobs: {}, provenance, timeline }), null); + assert.deepEqual(await endCardOf({ render, knobs: {}, provenance, timeline }), { qrUrl: "https://jeralyzer.pages.dev", sources: [{ date: "Jan 12", label: "Chan · 1:01" }] }); + // The card's key without an end card is the one it always was (v1, no `end`): pinned. + const brand = { name: "Jeralyzer", lead: "Jer", ink: "#5fc4a6" }; + assert.equal(outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand }), outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand, end: null })); + assert.equal(outroKey({ width: 1080, height: 1920, title: "T", text: "X", brand }), "ccb58d2be90ba1171c1e"); // main 195bd7d8 +});