Archilyzer · Source

archilyzer

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

commit c9bfba728e760fe8a1f0da8371a2f1f8d7c88c1c
parent 56a608b6a7ad1ce5948764f883a7d1c4d0bbbecd
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 19 Oct 2026 17:19:05 -0400

Merge branch 'main' into r36/e2e-fixes

Diffstat:
Meditor/CHANGELOG.md | 2+-
Mplans/FACTS.md | 13++++++++-----
Mumtool/docs/report-video.md | 23+++++++++++++----------
Mumtool/e2e/create.spec.ts | 2+-
Mumtool/lib/projects/scaffold.mjs | 5+++--
Mumtool/lib/report/manifest.mjs | 2+-
Mumtool/lib/report/room.test.mjs | 4++--
Mumtool/report-to-video/build-video.mjs | 2+-
Mumtool/report-to-video/transition.mjs | 112++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------------
Mumtool/report-to-video/transition.test.mjs | 51+++++++++++++++++++++++++++++++++------------------
10 files changed, 143 insertions(+), 73 deletions(-)

diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -4,7 +4,7 @@ - **The clip editor can ask an assistant to label and rank the clip finder's proposals — optionally.** A **Suggest** button in the clip editor's side column asks the model your generation settings choose (the local model, the Claude API, or a Claude Code session through `/gen`) to name each proposal in at most six words, say in one line what makes it land, and rank them; the labels show on every clip and unused proposal, and **Sort by the assistant's rank** orders both lists by them. Labels made before the clips were proposed again are marked stale, not hidden. Nothing in the cut changes: the labels are suggestions. Without a model, or with no labels, the clip editor works as before. From a shell: `pnpm ops report-draft '{"task":"clips-suggest","project":"<dir>","dryRun":true}'` shows how many proposals and what it would cost first. - **Ask the assistant about a clip, and apply what it suggests with one click.** On a comment in the clip editor, **Ask the assistant** has the model read your comment, the clip's words and the clips around it, and reply in the thread (badged "agent"). When it suggests a concrete edit — new edges, a merge with the next clip, or leaving the clip out — the reply shows an **Apply** button; nothing changes until you click it, and Apply does exactly what the clip editor's own buttons do. The editor needs `UMTOOL_URL` set to post the reply. - **Room at a report video's clip edges: a join no longer eats the end of a sentence.** With `render.room` (the Build tab's Look panel: **Room at the clips' edges**, Tail and Head), each clip's sound runs on past its cut to the first pause in its words — never more than 2.5 s — and fades there, then its picture keeps going, muted, for the length of the join, so the transition plays over quiet video; the clip after it starts the same length early, muted, when its first word comes straight away, so that word is not faded in under the join either. The words come from the project's word timings, else the transcript, else the sound's own silences. Captions stop where the sound does, and even loudness measures only what is heard. A clip cut from a downloaded window has only as much room as the window holds (the check says so; a saved whole video has plenty). The clip editor shades each clip's muted tail and head on the strip and has **Room at its edges** to turn it off for one clip. Highlights of a channel on no site now start with it on, and with 0.4 s blur slides. A manifest without `render.room` renders exactly as before. Needs a restart of umtool. -- **A report video's clips can blur-slide into each other.** `render.transitionStyle: "blurslide"` (the Look panel's Join: **blur slide**) slides the next clip in from the left while both sides of the cut are smeared sideways and lightly grained, for the join's length. A dip, a THEN/NOW wipe and a whip keep their own look. +- **A report video's clips can blur-slide into each other.** `render.transitionStyle: "blurslide"` (the Look panel's Join: **blur slide**) is a quick, eased push: the next clip settles in from the left while the last nudges out, smeared along the motion with a light grain on the seam's frames. `render.slide` tunes it (`travel`, `blur`, `grain`); highlights of a channel on no site start with 0.22 s pushes. A dip, a THEN/NOW wipe and a whip keep their own look. - **Find clips: the clip finder from one button on the video page.** A video page's **Find clips** runs the whole chain umtool's clip finder needs, as one job: it saves the source video, transcribes the recording, makes its word timings (kept beside the transcript as `words.json`, so a second project from the same recording reuses them), fetches the stream's chat replay (YouTube), finds who speaks when, and then asks umtool to find the narrated-video segments and propose the clips. Each step whose output is already on disk is skipped, and the job's log says which ran and which were skipped. When it is done the panel links the umtool project and lists the segments it found, each with **Find clips in this part**. A target length can be given. When the workers are paused or the backfill lane is held, the step that needs them stops with a sentence saying so, and **Run while paused** runs this one video past them. The button is off, with a line saying why, when the editor has no `UMTOOL_URL`. The same from a terminal: `pnpm ops find-clips --json '{"slug","id"}'` (a `dryRun` lists what each step would do). Needs a restart of the editor. - **Transcribe one video while the workers are paused.** With the transcription workers paused, the video page's Transcribe row offers **Transcribe now (workers paused)**: that one transcription runs on a worker the pause alone switched off, and the pause stays on — the worker is paused again when it finishes. A worker you drained, disabled by hand or that is marked degraded is never used, and the lanes stay held. `pnpm ops transcribe` and `transcribe-one` take `"whilePaused": true`. - **Fetch a stream's chat replay on its own.** Media tools → **Fetch live chat** on a video page (`pnpm ops fetch-chat`) fetches the video's live chat and nothing else, paced like every YouTube request and on the platform's download queue, into the chat cues the index and the clip finder read. A video on another platform says there is no chat fetcher for it, as does a chat already fetched or a video that was never live. diff --git a/plans/FACTS.md b/plans/FACTS.md @@ -11018,14 +11018,17 @@ parsed to 0 cues, indexing the video textless) is CLOSED by `200a3105` (transcri lengths, unchanged. - **Lint** `roomWindowWarnings`: a clip whose `cutEnd + maxS + D + 0.1 > end + fetchPad` (or head before `start − fetchPad`) is warned "a fetched source clamps it"; room with `transition: 0` is warned "room does nothing". -- **Seed** `SITELESS_LOOK` = `{headerHeight: 0, footerHeight: 0, qr: false, transition: 0.4, transitionStyle: +- **Seed** `SITELESS_LOOK` = `{headerHeight: 0, footerHeight: 0, qr: false, transition: 0.22, transitionStyle: "blurslide", loudness: {target: -16}, room: {tail: true, head: true}}` (was 0.5 / fadeblack, no room). - **Clip editor**: op `room {clip, room: false | {tail?, head?} | null}` (updateClip "trim" edit, cut untouched; null deletes); view `clips[].room` (as written), `clips[].roomEdges` (`{tail, head}` or null), `room {tail, head, minGap, maxS, join}` (join = render.transition ?? 0.5, 0 in a montage). The strip draws `[data-strip-room="head"|"tail"]` from `roomShade` (the rule on the unsnapped cut; no words → nominal D + 0.1 tail); toggle `[data-clip-room]`. Look panel: `[data-look-room-tail]`, `[data-look-room-head]`. -- **The blur slide** (`transitionStyle: "blurslide"`, orchestrator's commit a012e9ff): xfade `slideright`; each - segment's last/first D s (only at a plain join: not a dip, wipe or whip) get `gblur=sigma=10:sigmaV=0.6` over D, - `gblur=sigma=16:sigmaV=0.6` over the D/2 nearest the seam, `noise=alls=7:allf=t+u` over D (`BLUR_SLIDE`, - `blurSlideEdges`, `enable=` windows in the segment's own `t`). +- **The blur slide** (`transitionStyle: "blurslide"`; the operator's "way quicker, tactile, subtle" revision replaced + a012e9ff's full-width slideright + gblur): xfade `transition=custom:expr='…'` from `pushExpr(render, D)` — P 1→0; + ease-out cubic e; A sampled at X − travel·W·e, B at X + travel·W·(1−e); 5 taps (1,2,3,2,1)/9 spaced + blur·3·travel/(D·fps)/2·W·(1−t)² ; smoothstep crossfade over t∈[0.1,0.7]; per plane via `PLANE` (a0/a1/a2, b0/b1/b2 — + a0 alone is luma). `render.slide {travel 0–0.5 (0.08), blur 0–2 (0.5), grain 0–20 (3)}` (`SLIDE_DEFAULTS`, + `validateSlide` inside `validateTransitionStyle`; `slide` is a LOOK_KEY). Grain: `noise=alls=<grain>:allf=t+u` on the + D/2 nearest the seam of each plain-join edge (`blurSlideEdges`, the segment's own `t`). diff --git a/umtool/docs/report-video.md b/umtool/docs/report-video.md @@ -1088,7 +1088,7 @@ YouTube `&t=<s>s`, Twitch `?t=<h>h<m>m<s>s`, Rumble `?start=<s>`, anything else `t=<s>`), and a moved clip's link follows it (a link you wrote stays). The seed writes `provenance.channel` from the metadata and the look chosen for a one-video cut: `render` `headerHeight: 0, footerHeight: 0, qr: false, -transition: 0.4, transitionStyle: "blurslide", loudness: {target: -16}, room: +transition: 0.22, transitionStyle: "blurslide", loudness: {target: -16}, room: {tail: true, head: true}` (lane E; before it, 0.5 s `"fadeblack"`). With every clip linked, an empty `siteOrigin` is not a blocking decision. @@ -1261,7 +1261,7 @@ render is byte for byte what it was), validated by the build and by the lint | clip `vertical` | `{crop: [x, y, w, h], aspect?}` | Fractions of the source picture: the box a vertical short is cut from, 9:16 on the source (`aspect` = the source's width / height, 16/9 when absent; within 3 %). Absent: the centred full-height box. | A site-less, one-video cut made by the clip finder starts with -`headerHeight: 0, footerHeight: 0, qr: false, transition: 0.4, +`headerHeight: 0, footerHeight: 0, qr: false, transition: 0.22, transitionStyle: "blurslide", loudness: {target: -16}, room: {tail: true, head: true}` (lane B's seed, with lane E's join and room). @@ -1344,14 +1344,17 @@ stops; **Room at its edges** turns this clip's room off (`room: false`) or on again. The Look panel's **Room at the clips' edges** sets `render.room`. **The blur slide** (`render.transitionStyle: "blurslide"`, the Join menu's -"blur slide"): the next clip slides in from the left (xfade `slideright`) while -both sides of the seam are smeared sideways and grained — each clip's last and -first `render.transition` seconds get a horizontal Gaussian blur (σ 10 across -the whole edge, and σ 16 more in the half nearest the seam, so ≈ 19 at it; -vertical σ 0.6, so it reads as motion, not focus) and a light temporal noise -(strength 7) — in the clip's own time, so a batched build's joins get it too -(`transition.mjs` `BLUR_SLIDE`). A dip, a THEN/NOW wipe and a whip keep their -own look. With room at both edges the slide runs over muted picture. +"blur slide"): a quick, eased push — the outgoing clip nudges right by +`render.slide.travel` of the width while the next settles in from the left +(cubic ease-out: fast, then a soft landing), the two crossfading under a +smoothstep; the picture is smeared along the motion by five taps spaced by the +moment's speed (most at the start, none as it lands), and the frames nearest +the seam take a light temporal grain. One xfade custom expression +(`transition.mjs` `pushExpr`) plus the grain on each clip's edge, in the clip's +own time. `render.slide` = `{travel: 0.08, blur: 0.5, grain: 3}` by default +(travel 0–0.5 of the width, blur 0–2, grain 0–20; 0 turns either off); the +length is `render.transition` (the seed's 0.22 s). A dip, a THEN/NOW wipe and a +whip keep their own look. With room at both edges the slide runs over muted picture. ## Operator notes, timed notes and the generated-manifest guard diff --git a/umtool/e2e/create.spec.ts b/umtool/e2e/create.spec.ts @@ -287,7 +287,7 @@ test("Find clips from the editor (release 36): mode new with the worker token sc // A channel on no site: each clip links its YouTube page at its second; the site-less look. const m = manifestOf("p36-find"); expect(m.provenance.channel).toBe("Synth Two"); - expect(m.render).toMatchObject({ headerHeight: 0, footerHeight: 0, qr: false, transition: 0.4, transitionStyle: "blurslide", loudness: { target: -16 }, room: { tail: true, head: true } }); + expect(m.render).toMatchObject({ headerHeight: 0, footerHeight: 0, qr: false, transition: 0.22, transitionStyle: "blurslide", loudness: { target: -16 }, room: { tail: true, head: true } }); for (const c of m.timeline) expect(c.citeUrl).toBe(`https://www.youtube.com/watch?v=two001&t=${c.cite}s`); const done = async (id: string) => (await (await request.get(`/api/report/clips?job=${id}`)).json()).state; await expect.poll(() => done(made.jobId), { timeout: 60_000 }).toBe("done"); diff --git a/umtool/lib/projects/scaffold.mjs b/umtool/lib/projects/scaffold.mjs @@ -19,10 +19,11 @@ export const SEEDS = ["chapters", "frames", "phrase", "reactions"]; /** * The render keys a site-less, one-video reactions cut starts with (release 36: the operator's choice on the first - * case; lane E: 0.4 s blur slides with room at each clip's edges, so a join never eats the end of a sentence). + * case; lane E: blur slides with room at each clip's edges, so a join never eats the end of a sentence; 0.22 s, the + * operator's "way quicker"). */ export const SITELESS_LOOK = Object.freeze({ - headerHeight: 0, footerHeight: 0, qr: false, transition: 0.4, transitionStyle: "blurslide", + headerHeight: 0, footerHeight: 0, qr: false, transition: 0.22, transitionStyle: "blurslide", loudness: Object.freeze({ target: -16 }), room: Object.freeze({ tail: true, head: true }), }); diff --git a/umtool/lib/report/manifest.mjs b/umtool/lib/report/manifest.mjs @@ -937,7 +937,7 @@ export class ChromeRefused extends Error { // --------------------------------------------------------------------------- /** The render keys the Look panel writes, in its order. */ -export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room"]); +export const LOOK_KEYS = Object.freeze(["headerHeight", "footerHeight", "qr", "transition", "transitionStyle", "loudness", "captions", "room", "slide"]); /** The look keys of a render block as written (absent keys left out). */ export function lookOf(render) { diff --git a/umtool/lib/report/room.test.mjs b/umtool/lib/report/room.test.mjs @@ -33,8 +33,8 @@ async function project(render = {}) { } const read = async (dir) => JSON.parse(await readFile(path.join(dir, MANIFEST_NAME), "utf8")); -test("the site-less seed's look: 0.4 s blur slides with room at both edges, and the build's validators take it", () => { - assert.equal(SITELESS_LOOK.transition, 0.4); +test("the site-less seed's look: 0.22 s blur slides with room at both edges, and the build's validators take it", () => { + assert.equal(SITELESS_LOOK.transition, 0.22); assert.equal(SITELESS_LOOK.transitionStyle, "blurslide"); assert.deepEqual(SITELESS_LOOK.room, { tail: true, head: true }); assert.deepEqual(validateLook({ render: { ...SITELESS_LOOK }, timeline: [] }), []); diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -4109,7 +4109,7 @@ export function xfadeGraph(durs, D, joins = null, render = null, { joined = fals const wipe = !dip && !!joins?.[i - 1]?.wipe; // A whip cut (fx.mjs `whip`): the NOW clip slides in as the last slides out. const whip = !dip && !wipe && !!joins?.[i - 1]?.whip; - const vx = dip ? "transition=custom:expr='A'" : wipe ? "transition=wipeleft" : whip ? "transition=slideleft" : `transition=${xfadeTransitionOf(render)}`; + const vx = dip ? "transition=custom:expr='A'" : wipe ? "transition=wipeleft" : whip ? "transition=slideleft" : `transition=${xfadeTransitionOf(render, D)}`; const ax = dip ? "c1=nofade:c2=nofade" : "c1=tri:c2=tri"; parts.push(`${vlab}${ins[i].v}xfade=${vx}:duration=${D}:offset=${off.toFixed(3)}[v${i}]`); parts.push(`${alab}${ins[i].a}acrossfade=d=${D}:${ax}[a${i}]`); diff --git a/umtool/report-to-video/transition.mjs b/umtool/report-to-video/transition.mjs @@ -5,52 +5,100 @@ // The length is still `render.transition`; a THEN/NOW wipe, a whip and a // teaser's dip keep their own look. -// "blurslide" is not an xfade name: the next clip slides in from the left -// (xfade `slideright`) while both sides of the seam are smeared sideways and -// grained -- each clip's last and first `render.transition` seconds get a -// horizontal blur (stronger in the half nearest the seam) and a light temporal -// noise, in the clip's own time, so a batched build's joins get it too. +// "blurslide" is not an xfade name: a quick, eased push. The outgoing clip +// nudges right by `render.slide.travel` of the width while the next settles in +// from the left (cubic ease-out: it moves fast and lands softly), the two +// crossfading under a smoothstep; the picture is smeared along the motion by +// five taps spaced by the moment's speed (most at the start, none as it lands), +// and the frames nearest the seam take a light temporal grain. One xfade +// custom expression (`pushExpr`) plus the grain on each clip's edge. export const TRANSITION_STYLES = Object.freeze(["fade", "fadeblack", "fadewhite", "dissolve", "blurslide"]); /** The style a plain join uses (`render.transitionStyle`, default "fade"). */ export const transitionStyleOf = (render) => render?.transitionStyle ?? "fade"; -/** The xfade transition name for a plain join. */ -export const xfadeTransitionOf = (render) => (transitionStyleOf(render) === "blurslide" ? "slideright" : transitionStyleOf(render)); +// The push's knobs (`render.slide`): travel = fraction of the width the +// pictures move; blur = motion-smear strength (0 none, 1 = a frame's travel); +// grain = noise strength on the seam's frames (0 none). +export const SLIDE_DEFAULTS = Object.freeze({ travel: 0.08, blur: 0.5, grain: 3 }); +const SLIDE_BOUNDS = Object.freeze({ travel: [0, 0.5], blur: [0, 2], grain: [0, 20] }); -// The blur slide's smear and grain: sigma across the whole edge, more in the -// half nearest the seam (they compound: ~sqrt(10² + 16²) ≈ 19 at the seam), -// vertical sigma kept tiny so it reads as motion, not focus. -export const BLUR_SLIDE = Object.freeze({ sigma: 10, seamSigma: 16, sigmaV: 0.6, noise: 7 }); +/** The push's knobs, the defaults filled in. */ +export function slideOf(render) { + const s = render?.slide && typeof render.slide === "object" ? render.slide : {}; + const out = {}; + for (const k of Object.keys(SLIDE_DEFAULTS)) out[k] = Number.isFinite(s[k]) ? s[k] : SLIDE_DEFAULTS[k]; + return out; +} /** - * The filters a blur slide puts on one input `d` seconds long, joined over `D` - * seconds: on its tail when a plain join follows it, on its head when one - * precedes it. "" when the style is not "blurslide", `D` is 0, or neither edge - * is a plain join (a dip, a wipe and a whip keep their own look). + * The push as an xfade custom expression, for a join `D` seconds long at `fps`. + * P runs 1 -> 0 over the join; a0/a1/a2 and b0/b1/b2 read the two inputs' + * planes (each plane's own W), so it works on any planar format. */ -export function blurSlideEdges(d, D, render, { tail = false, head = false } = {}) { - if (transitionStyleOf(render) !== "blurslide" || !(D > 0) || (!tail && !head)) return ""; - const win = (full) => { - const w = full ? D : D / 2; - const parts = []; - if (tail) parts.push(`gte(t,${(d - w).toFixed(3)})`); - if (head) parts.push(`lt(t,${w.toFixed(3)})`); - return parts.join("+"); - }; - const b = BLUR_SLIDE; +export function pushExpr(render, D) { + const { travel, blur } = slideOf(render); + const frames = Math.max(1, D * (render?.fps ?? 30)); + // Tap spacing at peak speed (fraction of W): ease-out cubic's speed at the + // start is 3x the mean, a frame's mean travel is travel / frames. + const k = (blur * 3 * travel) / frames / 2; + const pl = (c, x) => `if(eq(PLANE,0),${c}0(${x},Y),if(eq(PLANE,1),${c}1(${x},Y),${c}2(${x},Y)))`; + const A = (o) => pl("a", `X-ld(2)${o}`); + const B = (o) => pl("b", `X+ld(3)${o}`); + const taps = (f) => (k > 0 ? `(${f("-2*ld(4)")}+2*${f("-ld(4)")}+3*${f("")}+2*${f("+ld(4)")}+${f("+2*ld(4)")})/9` : f("")); return [ - `gblur=sigma=${b.sigma}:sigmaV=${b.sigmaV}:enable='${win(true)}'`, - `gblur=sigma=${b.seamSigma}:sigmaV=${b.sigmaV}:enable='${win(false)}'`, - `noise=alls=${b.noise}:allf=t+u:enable='${win(true)}'`, - ].join(","); + "st(0,1-P)", + "st(1,1-pow(1-ld(0),3))", + `st(2,${travel}*W*ld(1))`, + `st(3,${travel}*W*(1-ld(1)))`, + `st(4,${k.toFixed(5)}*W*pow(1-ld(0),2))`, + "st(5,clip((ld(0)-0.1)/0.6,0,1))", + "st(5,ld(5)*ld(5)*(3-2*ld(5)))", + `${taps(A)}*(1-ld(5))+${taps(B)}*ld(5)`, + ].join(";"); +} + +/** The xfade transition for a plain join `D` seconds long. */ +export const xfadeTransitionOf = (render, D = render?.transition ?? 0.5) => + transitionStyleOf(render) === "blurslide" ? `custom:expr='${pushExpr(render, D)}'` : transitionStyleOf(render); + +/** + * The grain a blur slide puts on one input `d` seconds long, joined over `D` + * seconds: the half-join nearest the seam on its tail when a plain join follows + * it, on its head when one precedes it. "" when the style is not "blurslide", + * `D` is 0, the grain is 0, or neither edge is a plain join (a dip, a wipe and + * a whip keep their own look). + */ +export function blurSlideEdges(d, D, render, { tail = false, head = false } = {}) { + const { grain } = slideOf(render); + if (transitionStyleOf(render) !== "blurslide" || !(D > 0) || !(grain > 0) || (!tail && !head)) return ""; + const w = D / 2; + const parts = []; + if (tail) parts.push(`gte(t,${(d - w).toFixed(3)})`); + if (head) parts.push(`lt(t,${w.toFixed(3)})`); + return `noise=alls=${Math.round(grain)}:allf=t+u:enable='${parts.join("+")}'`; } /** @param {{ render?: { transitionStyle?: unknown } }} manifest */ export function validateTransitionStyle(manifest) { const s = manifest?.render?.transitionStyle; - if (s === undefined || s === null) return []; + const slide = validateSlide(manifest); + if (s === undefined || s === null) return slide; return typeof s === "string" && TRANSITION_STYLES.includes(s) - ? [] - : [`render.transitionStyle: ${JSON.stringify(s)} is not one of ${TRANSITION_STYLES.join(", ")}`]; + ? slide + : [`render.transitionStyle: ${JSON.stringify(s)} is not one of ${TRANSITION_STYLES.join(", ")}`, ...slide]; +} + +/** `render.slide`: absent, or an object of the push's knobs within bounds. */ +export function validateSlide(manifest) { + const s = manifest?.render?.slide; + if (s === undefined || s === null) return []; + if (typeof s !== "object" || Array.isArray(s)) return ["render.slide must be an object {travel?, blur?, grain?}"]; + const errs = []; + for (const [k, v] of Object.entries(s)) { + const b = SLIDE_BOUNDS[k]; + if (!b) errs.push(`render.slide.${k} is not a key (travel, blur, grain)`); + else if (!Number.isFinite(v) || v < b[0] || v > b[1]) errs.push(`render.slide.${k} must be a number from ${b[0]} to ${b[1]}`); + } + return errs; } diff --git a/umtool/report-to-video/transition.test.mjs b/umtool/report-to-video/transition.test.mjs @@ -6,7 +6,7 @@ import test from "node:test"; import { xfadeGraph } from "./build-video.mjs"; import { execFileSync } from "node:child_process"; import { createHash } from "node:crypto"; -import { TRANSITION_STYLES, blurSlideEdges, transitionStyleOf, validateTransitionStyle, xfadeTransitionOf } from "./transition.mjs"; +import { SLIDE_DEFAULTS, TRANSITION_STYLES, blurSlideEdges, pushExpr, slideOf, transitionStyleOf, validateSlide, validateTransitionStyle, xfadeTransitionOf } from "./transition.mjs"; const RENDER = { width: 1920, height: 1080, fps: 30, transition: 0.5, audioRate: 48000, audioChannels: 2 }; const xfades = (g) => g.parts.filter((p) => p.includes("xfade=")); @@ -42,21 +42,36 @@ test("validateTransitionStyle: xfade's names only", () => { assert.equal(validateTransitionStyle({ render: { transitionStyle: 3 } }).length, 1); }); -test("transitionStyle: blurslide slides the next clip in from the left over smeared, grained edges", () => { - const R = { ...RENDER, transition: 0.4, transitionStyle: "blurslide" }; - assert.equal(xfadeTransitionOf(R), "slideright"); - const g = xfadeGraph([10, 12, 4], 0.4, null, R); - assert.deepEqual(xfades(g), [ - "[p0e][p1e]xfade=transition=slideright:duration=0.4:offset=9.600[v1]", - "[v1][p2e]xfade=transition=slideright:duration=0.4:offset=21.200[v2]", - ]); - // The first clip's tail only, the middle one's head and tail, the last one's head only -- in each clip's own time. +test("transitionStyle: blurslide is a quick eased push (one custom xfade) with grain on the seam's frames", () => { + const R = { ...RENDER, transition: 0.22, transitionStyle: "blurslide" }; + const g = xfadeGraph([10, 12, 4], 0.22, null, R); + const x = xfades(g); + assert.equal(x.length, 2); + assert.ok(x[0].startsWith("[p0e][p1e]xfade=transition=custom:expr='st(0,1-P);")); + assert.ok(x[0].endsWith("':duration=0.22:offset=9.780[v1]")); + assert.ok(x[0].includes(`st(2,${SLIDE_DEFAULTS.travel}*W*ld(1))`)); + assert.match(x[0], /a1\(X-ld\(2\)/); // every plane read, not just luma + // Grain on the half-join nearest the seam, each clip in its own time. const edge = (i) => g.parts.find((p) => p.endsWith(`[p${i}e]`)); - assert.match(edge(0), /^\[0:v\]setpts=PTS-STARTPTS,gblur=sigma=10:sigmaV=0.6:enable='gte\(t,9.600\)',gblur=sigma=16:sigmaV=0.6:enable='gte\(t,9.800\)',noise=alls=7:allf=t\+u:enable='gte\(t,9.600\)'\[p0e\]$/); - assert.match(edge(1), /enable='gte\(t,11.600\)\+lt\(t,0.400\)'/); - assert.match(edge(2), /enable='lt\(t,0.400\)'/); - assert.doesNotMatch(edge(2), /gte/); - assert.ok(g.parts.includes("[p0a][p1a]acrossfade=d=0.4:c1=tri:c2=tri[a1]")); + assert.equal(edge(0), "[0:v]setpts=PTS-STARTPTS,noise=alls=3:allf=t+u:enable='gte(t,9.890)'[p0e]"); + assert.match(edge(1), /enable='gte\(t,11.890\)\+lt\(t,0.110\)'/); + assert.match(edge(2), /enable='lt\(t,0.110\)'/); + assert.ok(g.parts.includes("[p0a][p1a]acrossfade=d=0.22:c1=tri:c2=tri[a1]")); + // The knobs: no grain -> no edge filters; no blur -> one tap per side. + const g0 = xfadeGraph([10, 12], 0.22, null, { ...R, slide: { grain: 0, blur: 0 } }); + assert.ok(!g0.parts.some((p) => p.includes("noise="))); + assert.equal((pushExpr({ ...R, slide: { blur: 0 } }, 0.22).match(/a0\(/g) ?? []).length, 1); + assert.deepEqual(slideOf({ slide: { travel: 0.2 } }), { ...SLIDE_DEFAULTS, travel: 0.2 }); + assert.equal(xfadeTransitionOf({ transitionStyle: "fadeblack" }, 0.5), "fadeblack"); +}); + +test("validateSlide: travel/blur/grain within bounds, nothing else", () => { + assert.deepEqual(validateSlide({ render: {} }), []); + assert.deepEqual(validateSlide({ render: { slide: { travel: 0.1, blur: 1, grain: 0 } } }), []); + assert.equal(validateSlide({ render: { slide: { travel: 0.9 } } }).length, 1); + assert.equal(validateSlide({ render: { slide: { speed: 2 } } }).length, 1); + assert.equal(validateSlide({ render: { slide: 3 } }).length, 1); + assert.equal(validateTransitionStyle({ render: { transitionStyle: "blurslide", slide: { grain: 99 } } }).length, 1); }); test("transitionStyle: blurslide leaves a dip, a wipe and a whip alone, and every other style untouched", () => { @@ -64,15 +79,15 @@ test("transitionStyle: blurslide leaves a dip, a wipe and a whip alone, and ever const g = xfadeGraph([10, 12, 4], 0.5, [{ wipe: true }, null, null], R); assert.match(xfades(g)[0], /transition=wipeleft/); assert.doesNotMatch(g.parts.find((p) => p.endsWith("[p0e]")) ?? "", /gte/); - assert.match(g.parts.find((p) => p.endsWith("[p1e]")), /enable='gte\(t,11.500\)'/); + assert.match(g.parts.find((p) => p.endsWith("[p1e]")), /enable='gte\(t,11.750\)'/); assert.equal(blurSlideEdges(10, 0.5, { transitionStyle: "fadeblack" }, { tail: true }), ""); assert.equal(blurSlideEdges(10, 0, { transitionStyle: "blurslide" }, { tail: true }), ""); for (const s of ["fade", "fadeblack", "fadewhite", "dissolve"]) { - assert.ok(!xfadeGraph([10, 12], 0.5, null, { ...RENDER, transitionStyle: s }).parts.some((p) => p.includes("gblur"))); + assert.ok(!xfadeGraph([10, 12], 0.5, null, { ...RENDER, transitionStyle: s }).parts.some((p) => p.includes("noise=") || p.includes("custom"))); } }); -test("transitionStyle: blurslide renders in ffmpeg; frames outside the seam are a plain slide's, inside they differ", () => { +test("transitionStyle: blurslide renders in ffmpeg; frames outside the seam are untouched, inside they differ", () => { const run = (style) => { const R = { ...RENDER, width: 320, height: 180, transition: 0.4, transitionStyle: style }; const g = xfadeGraph([1.5, 1.5], 0.4, null, R);