Archilyzer · Source

archilyzer

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

commit 00a3f3076de565fef48f133798d16d40d6416282
parent db859363542eab5171b8b1036e41cc3f5b962ab1
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Mon, 19 Oct 2026 15:04:48 -0400

report-to-video: render.transitionStyle "blurslide" -- the next clip slides in from the left over horizontally blurred, lightly grained edges (each clip's last/first join length, in its own time; dips, wipes and whips keep their look)

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

Diffstat:
Mumtool/components/projects/report/LookPanel.tsx | 2+-
Mumtool/report-to-video/build-video.mjs | 15++++++++++++---
Mumtool/report-to-video/transition.mjs | 40++++++++++++++++++++++++++++++++++++++--
Mumtool/report-to-video/transition.test.mjs | 56+++++++++++++++++++++++++++++++++++++++++++++++++++++++-
4 files changed, 106 insertions(+), 7 deletions(-)

diff --git a/umtool/components/projects/report/LookPanel.tsx b/umtool/components/projects/report/LookPanel.tsx @@ -23,7 +23,7 @@ type Look = { }; type View = { look: Look; deck: boolean; montage: boolean; styles: string[]; errors: string[]; token: string | null }; -const STYLE_WORDS: Record<string, string> = { fade: "crossfade", fadeblack: "dip to black", fadewhite: "dip to white", dissolve: "dissolve" }; +const STYLE_WORDS: Record<string, string> = { fade: "crossfade", fadeblack: "dip to black", fadewhite: "dip to white", dissolve: "dissolve", blurslide: "blur slide" }; type Draft = { header: boolean; diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs @@ -164,7 +164,7 @@ import { readDraftsReview } from "./drafts-review.mjs"; import { applyMontageRulings, readMontageRulings, rulingsLines } from "./montage-rulings.mjs"; import { validateDrafted, validatePublish } from "yt-dlp-transcript-common/lib/report/drafted.mjs"; import { validateAssist } from "yt-dlp-transcript-common/lib/clips/assist.mjs"; -import { transitionStyleOf, validateTransitionStyle } from "./transition.mjs"; +import { blurSlideEdges, validateTransitionStyle, xfadeTransitionOf } from "./transition.mjs"; // The look of a highlights cut (release 36 lane C): render.captions, // render.loudness, a clip's vertical crop and the short made from it -- pure, // in look.mjs. Every hook below runs only when its key is set. @@ -3977,7 +3977,16 @@ export function xfadeGraph(durs, D, joins = null, render = null, { joined = fals const len = d.toFixed(6); const a = `[p${i}a]`; parts.push(`${c.a}apad=whole_dur=${len},atrim=end=${len},asetpts=PTS-STARTPTS${a}`); - return { v: c.v, a }; + // A blur slide smears and grains each side of a plain seam (transition.mjs). + const special = (k) => !!(joins?.[k]?.dip || (!joined && (joins?.[k]?.wipe || joins?.[k]?.whip))); + const edges = blurSlideEdges(d, D, render, { + tail: i < durs.length - 1 && !special(i), + head: i > 0 && !special(i - 1), + }); + if (!edges) return { v: c.v, a }; + const v = `[p${i}e]`; + parts.push(`${c.v}setpts=PTS-STARTPTS,${edges}${v}`); + return { v, a }; }); let vlab = ins[0].v; let alab = ins[0].a; @@ -3995,7 +4004,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=${transitionStyleOf(render)}`; + const vx = dip ? "transition=custom:expr='A'" : wipe ? "transition=wipeleft" : whip ? "transition=slideleft" : `transition=${xfadeTransitionOf(render)}`; 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,11 +5,47 @@ // The length is still `render.transition`; a THEN/NOW wipe, a whip and a // teaser's dip keep their own look. -export const TRANSITION_STYLES = Object.freeze(["fade", "fadeblack", "fadewhite", "dissolve"]); +// "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. +export const TRANSITION_STYLES = Object.freeze(["fade", "fadeblack", "fadewhite", "dissolve", "blurslide"]); -/** The xfade transition name for a plain join. */ +/** 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 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 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). + */ +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; + 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(","); +} + /** @param {{ render?: { transitionStyle?: unknown } }} manifest */ export function validateTransitionStyle(manifest) { const s = manifest?.render?.transitionStyle; diff --git a/umtool/report-to-video/transition.test.mjs b/umtool/report-to-video/transition.test.mjs @@ -4,7 +4,9 @@ import assert from "node:assert/strict"; import test from "node:test"; import { xfadeGraph } from "./build-video.mjs"; -import { TRANSITION_STYLES, transitionStyleOf, validateTransitionStyle } from "./transition.mjs"; +import { execFileSync } from "node:child_process"; +import { createHash } from "node:crypto"; +import { TRANSITION_STYLES, blurSlideEdges, transitionStyleOf, 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=")); @@ -39,3 +41,55 @@ test("validateTransitionStyle: xfade's names only", () => { assert.equal(validateTransitionStyle({ render: { transitionStyle: "spin" } }).length, 1); 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. + 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]")); +}); + +test("transitionStyle: blurslide leaves a dip, a wipe and a whip alone, and every other style untouched", () => { + const R = { ...RENDER, transitionStyle: "blurslide" }; + 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.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"))); + } +}); + +test("transitionStyle: blurslide renders in ffmpeg; frames outside the seam are a plain slide's, 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); + const src = (c) => ["-f", "lavfi", "-i", `testsrc2=s=320x180:r=30:d=1.5,hue=h=${c}`]; + const tone = ["-f", "lavfi", "-i", "sine=f=440:d=1.5:sample_rate=48000"]; + const args = ["-v", "error", ...src(0), ...src(120), ...tone, ...tone, + "-filter_complex", [...g.parts.map((p) => p.replace("[0:a]", "[2:a]").replace("[1:a]", "[3:a]"))].join(";"), + "-map", g.vlab, "-map", g.alab, "-f", "framemd5", "-"]; + return execFileSync("ffmpeg", args, { encoding: "utf8" }).split("\n").filter((l) => /^0,/.test(l)).map((l) => l.split(",").pop().trim()); + }; + const plain = run("fade"); + const blur = run("blurslide"); + assert.equal(blur.length, Math.round((1.5 + 1.5 - 0.4) * 30)); + // Frame 10 (0.33 s) is before the window and frame 70 after it: untouched by the blur, same as any style. + const md5 = (s) => createHash("md5").update(s).digest("hex"); + assert.equal(md5(blur[10]), md5(plain[10])); + assert.equal(md5(blur[70]), md5(plain[70])); + // Frame 40 (1.33 s) is mid-seam: blurred, grained and slid, not a dissolve. + assert.notEqual(blur[40], plain[40]); +});