commit 7ba7293f24c7be8b3c2cc7198c6698e508a8f50f
parent fac655eba798ac8197b02d73cfd1c75dedfd56b3
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 5 Nov 2026 16:52:18 -0500
umtool: every post item encoded in limited range -- the stage no longer jumps a shade at a cut (operator, 5 Nov: "the background brightens basically exactly at the 37m mark during the transition")
Not a layout: every card page is palette.bg and the card a box. ffmpeg 7.1+ negotiates the output range over the
whole graph, so a post item with a JPEG input (an attachment, a picture) came out FULL range (yuvj420p, page
#12100c at Y=16) while every other segment is limited (Y=30). The master is those end to end and a player reads one
range: mid-21's page went rgb(16,17,9) -> rgb(31,30,26) at 2219.67, out of the item with the JPEG into the lone card.
- color-range.mjs: LIMITED_RANGE (`-color_range tv`, which converts, not just tags) and isFullRange (an ffprobe).
- post-render.mjs: the pin after the encode args (not a key term); a cached or pooled segment whose key matches but
that probes full range is rebuilt -- no key bumped, so only the full-range segments (and the chunks holding them)
are made again.
- post-combo-render.mjs: the combo pass pinned the same.
- color-range.test.mjs: the pin in both argvs; a lone card and a card with a JPEG encode to the same page bytes.
- knobs.md (A post item), CHANGELOG.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
7 files changed, 129 insertions(+), 4 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## [Unreleased]
+- **umtool: the background no longer changes shade between post items.** In a render, the page behind a post's card brightened at the cut from a post with a JPEG picture to a plain text post (the Mr. Obvious cut, at 37:00). ffmpeg had encoded the item with the picture in full range, every other item in limited range, and a player reads one range for the whole video. Every post item and combo badge is now encoded in limited range, so the page is the palette's background in every item; the items built full range before are rebuilt on the next render, and nothing else is.
- **umtool: a report video can end on a video of the project, full frame, with its own sound.** A meme the subject posted (the Puss in Boots clip of the Mr. Obvious cut) could not be played as itself: `image` is a still and a clip is a corpus window inside the deck. A `video` timeline entry plays a project file's span (`from`, `to`; absent: the file's end) as the whole frame (`fit: contain`, pillarboxed on black, or `cover`), with NOTHING drawn over it -- no deck, header, QR, rail, counters, captions or any overlay layer, in the render and in Play. The item before it (its chrome too) fades to black and the video fades up (`enter`, 0.5 s each; `"cut"` opts out), without shortening the video; as the last entry the cut ends on its final frame (no end fade). Its sound is levelled like a clip's, with an optional bass boost before the level (`audio.bass`, dB). `umtool timeline <p> [--take <t>] add-video <src> --from 32.26 --bass 8` adds one; `set-video <id> key=value` sets its knobs.
- **`posts reread --pause "@71.2=0.45"`: a pause at a time of the take.** A read whose word timings drift (a script word said as several -- "45" as "forty-five") put a word-named pause inside the next word. `@<seconds>` names the time instead; the cut is the quietest point within 0.15 s of it, kept on later re-cuts.
- **umtool: a slur can be masked by its first and last letter, so its form is told apart.** The slur filter's pill showed one mask per slur for every form ("n*****" for the "-a" form as for the "-er" one). `umtool posts slurs <p> edges <word>` (a slur's word, id or any form names it; `--off` takes it back) now masks every form of that slur as its first letter, stars and its last letter, in the case the post wrote it -- "n***a", "n****s", "f****t", "f*****s", "N***A" (`render.posts.slurs.edges`). The one mask per word is what the card's pill, Play, the bench, a chapter line, a caption and `posts slurs ls` show (`ls` says `edges: …`, by mask); the Cut tab's Options → Reads and voices → Slur filter has **Edge mask** and **First letter only** beside a word. A cut without `edges` renders exactly as before; the read's stand-in ("n-word") is unchanged.
diff --git a/umtool/docs/knobs.md b/umtool/docs/knobs.md
@@ -656,6 +656,11 @@ rule). Made by `umtool posts reel` (or `umtool new <p> --from-posts <slug>`, `um
its knobs are one writer, `updatePostItem` (`lib/report/manifest.mjs`), refused in the build's words (`validatePostItem`).
`null` / `off` clears a knob. Its bench is `/projects/<p>/post/<id>` (the Cut tab's row **bench**, Play's **Edit this post**).
+The stage is the palette's bg in every layout: the page behind the cards is `palette.bg`, edge to edge, and the card a
+box on it. Every post item is encoded in LIMITED range (`-color_range tv`, `color-range.mjs`): ffmpeg made one with a
+JPEG attachment full range (`yuvj420p`), and in the master its page decoded a shade apart from the next item's -- the
+background jumped at the cut. A segment built full range before the pin is rebuilt by its probe; no key moved.
+
| Knob | In umtool | From a terminal | Route |
|---|---|---|---|
| `hold` — the item's whole length in seconds (1–120; absent: the pacing rule, the item is its read) | post bench, **hold** | `umtool posts set-item <p> <item> hold=12` (`hold=off`) | `POST /api/report/post-item {project, op: "set", id, patch: {hold}, token}` |
diff --git a/umtool/report-to-video/build-video.mjs b/umtool/report-to-video/build-video.mjs
@@ -6836,7 +6836,7 @@ export async function buildVideo({ manifestPath, opts = {}, out, only, fetchOnly
render, outDir, manifestDir,
box: df ? { width: df.box.width, height: df.box.height } : { width: render.width, height: render.height },
place: df ? df.place : [`fps=${render.fps}`],
- encode: encodeArgs(render), exec: execFileP, ffmpeg: FFMPEG, emit: (ev, f) => EMIT(ev, f),
+ encode: encodeArgs(render), exec: execFileP, ffmpeg: FFMPEG, ffprobe: FFPROBE, emit: (ev, f) => EMIT(ev, f),
// The authors' pictures (post-avatars.mjs), as files of the project.
avatars: avatarUrls(manifest, (src) => path.resolve(manifestDir, src)),
redaction: POST_REDACTION,
diff --git a/umtool/report-to-video/color-range.mjs b/umtool/report-to-video/color-range.mjs
@@ -0,0 +1,33 @@
+// THE COLOUR RANGE of an encode (operator, 5 Nov: "the background brightens
+// basically exactly at the 37m mark during the transition"). ffmpeg 7.1+
+// negotiates the output's range across the whole filter graph: one JPEG input
+// (an attachment, a picture, an avatar) makes a post item's segment FULL range
+// (`yuvj420p`, pc), though its cards are PNGs and `-pix_fmt yuv420p` is asked.
+// Every other segment is limited (tv, or untagged, which players read as tv),
+// and the master is those segments end to end: a player reads one range for
+// the whole file, so the page's #12100c is Y=16 in one item and Y=30 in the
+// next -- the stage jumps a shade at the cut. Pinning `-color_range tv` makes
+// ffmpeg convert (not just tag), so every segment's page decodes to the same
+// colour. The pin rides AFTER the encode args, never in them: it is not a key
+// term (a limited-range segment comes out byte-identical), and a cached
+// segment that came out full range is rebuilt by its probe (isFullRange).
+//
+// Plain node; the probe's runner is a parameter.
+
+/** The output options that pin an encode to limited (tv) range, converting. */
+export const LIMITED_RANGE = Object.freeze(["-color_range", "tv"]);
+
+/**
+ * Is `file`'s video stream FULL range (`pc`, e.g. `yuvj420p`)? `exec`:
+ * execFile-promise style (`{ stdout }`). False when the probe fails or says
+ * anything else -- a probe never breaks a build, it only asks for a rebuild.
+ */
+export async function isFullRange(file, { exec, ffprobe = "ffprobe" }) {
+ try {
+ const r = await exec(ffprobe, ["-v", "error", "-select_streams", "v:0", "-show_entries", "stream=color_range,pix_fmt", "-of", "json", file]);
+ const s = JSON.parse(String(r?.stdout ?? "{}"))?.streams?.[0];
+ return !!s && (s.color_range === "pc" || /^yuvj/.test(String(s.pix_fmt ?? "")));
+ } catch {
+ return false;
+ }
+}
diff --git a/umtool/report-to-video/color-range.test.mjs b/umtool/report-to-video/color-range.test.mjs
@@ -0,0 +1,73 @@
+// color-range.mjs (operator, 5 Nov: "the background brightens basically exactly at the 37m mark during the
+// transition"): a post item with a JPEG attachment came out FULL range (yuvj420p) while every other segment is
+// limited, so the page -- #12100c in both -- decoded a shade apart in the master. The pin converts; the probe finds
+// the old ones to rebuild.
+import assert from "node:assert/strict";
+import { execFile, execFileSync } from "node:child_process";
+import { mkdtempSync, rmSync } from "node:fs";
+import { tmpdir } from "node:os";
+import path from "node:path";
+import { promisify } from "node:util";
+import { after, test } from "node:test";
+import { LIMITED_RANGE, isFullRange } from "./color-range.mjs";
+import { comboPassArgs } from "./post-combo-render.mjs";
+import { postItemPlan, postLayout } from "./post-item.mjs";
+import { postSegmentArgs } from "./post-render.mjs";
+
+const exec = promisify(execFile);
+const ROOT = mkdtempSync(path.join(tmpdir(), "color-range-"));
+after(() => rmSync(ROOT, { recursive: true, force: true }));
+const box = { width: 640, height: 360 };
+const BG = "0x12100c";
+const encode = ["-c:v", "libx264", "-preset", "ultrafast", "-pix_fmt", "yuv420p", "-r", "30"];
+const post = (media) => ({ type: "post", id: "p1", post: "c-x/1", platform: "x", author: "A", handle: "a", date: "2026-10-30T04:00:00Z", text: "I should shower", ...(media ? { media } : {}) });
+/** The raw (unconverted) luma and chroma at the frame's top-left corner: the page. */
+const cornerYuv = (file) => {
+ const d = execFileSync("ffmpeg", ["-v", "error", "-ss", "0.5", "-i", file, "-frames:v", "1", "-f", "rawvideo", "-pix_fmt", "yuv420p", "-"], { maxBuffer: 1 << 24 });
+ const W = box.width, H = box.height;
+ return [d[2 * W + 2], d[W * H + 1], d[W * H + (W * H) / 4 + 1]];
+};
+const segment = (e, files, name, { pin = true } = {}) => {
+ const out = path.join(ROOT, `${name}.mp4`);
+ let argv = postSegmentArgs({ entry: e, box, plan: postItemPlan(e), layout: postLayout(e, box), cards: { read: path.join(ROOT, "card.png") }, files, render: { fps: 30 }, outPath: out, encode });
+ if (!pin) argv = argv.filter((a, i) => !(a === "-color_range" || argv[i - 1] === "-color_range"));
+ execFileSync("ffmpeg", argv);
+ return out;
+};
+
+test("the pin rides after the encode args (not a key term) in the post item's encode and the combo pass", () => {
+ const e = post();
+ const argv = postSegmentArgs({ entry: e, box, plan: postItemPlan(e), layout: postLayout(e, box), cards: { read: "/c.png" }, files: [], render: { fps: 30 }, outPath: "/o.mp4", encode });
+ const at = argv.indexOf("-color_range");
+ assert.ok(at > argv.indexOf("libx264"), "after the encode");
+ assert.deepEqual(argv.slice(at, at + 2), [...LIMITED_RANGE]);
+ const combo = comboPassArgs({ plain: "/p.mp4", frames: "/f%04d.png", fps: 30, at: 1, x: 0, y: 0, encode, outPath: "/o.mp4" });
+ assert.deepEqual(combo.slice(combo.indexOf("-color_range"), combo.indexOf("-color_range") + 2), [...LIMITED_RANGE]);
+});
+
+test("a lone text card and a card with a JPEG attachment share the page colour: both limited range (ffmpeg)", async () => {
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", `color=c=${BG}:s=${box.width}x${box.height}`, "-frames:v", "1", path.join(ROOT, "card.png")]);
+ const jpg = path.join(ROOT, "pic.jpg");
+ execFileSync("ffmpeg", ["-v", "error", "-y", "-f", "lavfi", "-i", "testsrc=s=320x180", "-frames:v", "1", jpg]);
+ const pic = [{ src: "m/pic.jpg", kind: "image", width: 320, height: 180 }];
+ const lone = segment(post(), [], "lone");
+ const side = segment(post(pic), [jpg], "side");
+ const before = segment(post(pic), [jpg], "side-unpinned", { pin: false });
+ // What the bug was: without the pin, ffmpeg makes the JPEG item full range -- its page Y 16, the lone card's 30.
+ // (ffmpeg 7.1+'s negotiation; an ffmpeg that keeps it limited has nothing to show here.)
+ if (await isFullRange(before, { exec })) assert.notEqual(cornerYuv(before)[0], cornerYuv(lone)[0]);
+ // Pinned: both limited, the page the same bytes (within a level of the encoder's rounding).
+ assert.equal(await isFullRange(lone, { exec }), false);
+ assert.equal(await isFullRange(side, { exec }), false);
+ const [a, b] = [cornerYuv(lone), cornerYuv(side)];
+ for (let k = 0; k < 3; k++) assert.ok(Math.abs(a[k] - b[k]) <= 1, `page yuv: lone ${a}, with a JPEG ${b}`);
+ assert.ok(Math.abs(a[0] - 29) <= 1, `#12100c in limited range is Y≈29 (got ${a[0]})`);
+});
+
+test("the probe: full range only for pc / yuvj; a failed probe is not full range", async () => {
+ assert.equal(await isFullRange("/nope.mp4", { exec }), false);
+ const fake = (stdout) => async () => ({ stdout });
+ assert.equal(await isFullRange("x", { exec: fake(JSON.stringify({ streams: [{ pix_fmt: "yuvj420p" }] })) }), true);
+ assert.equal(await isFullRange("x", { exec: fake(JSON.stringify({ streams: [{ pix_fmt: "yuv420p", color_range: "tv" }] })) }), false);
+ assert.equal(await isFullRange("x", { exec: fake(JSON.stringify({ streams: [{ pix_fmt: "yuv420p" }] })) }), false);
+});
diff --git a/umtool/report-to-video/post-combo-render.mjs b/umtool/report-to-video/post-combo-render.mjs
@@ -22,6 +22,7 @@ import path from "node:path";
import { fileURLToPath, pathToFileURL } from "node:url";
import { COMBO_TIMING, comboBadgeHtml, comboFrame, comboPlace, comboStart, comboTransform } from "./post-combo.mjs";
import { panelEntry, postItemPlan, postLayout, stepBoxes } from "./post-item.mjs";
+import { LIMITED_RANGE } from "./color-range.mjs";
const HERE = path.dirname(/* turbopackIgnore: true */ fileURLToPath(import.meta.url));
const r3 = (v) => Math.round(v * 1000) / 1000;
@@ -83,6 +84,8 @@ export function comboPassArgs({ plain, frames, fps, at, x, y, sfx = null, encode
"-filter_complex", parts.join(";"),
"-map", "[v]", "-map", sfx ? "[a]" : "0:a",
...encode,
+ // Limited range, as the item under it (color-range.mjs).
+ ...LIMITED_RANGE,
...(sfx ? [] : ["-c:a", "copy"]),
outPath,
];
diff --git a/umtool/report-to-video/post-render.mjs b/umtool/report-to-video/post-render.mjs
@@ -25,6 +25,7 @@ import { redactEntry, redactionOn, shownLine, termsFor } from "./post-redact.mjs
import { bleepFilters, slursOn, takeBleeps } from "./post-slurs.mjs";
import { blurFilters, blurOn, censorEntry, labelFilter } from "./post-censor.mjs";
import { sceneEntry } from "./post-media-scene.mjs";
+import { LIMITED_RANGE, isFullRange } from "./color-range.mjs";
import { CAPTION_OUT, CAPTION_SLIDE, captionCss, captionInnerHtml, captionPlan, measureCaptionWords, mountCaptions, placeCaption, setCaptionState, slideDir } from "./post-caption.mjs";
import { clockCss, clockFace, clockFrameTimes, clockHtml, clockPlan, clockStateAt, measureClockPlace, mountClock, setClockState } from "./post-clock.mjs";
import { POST_PROGRESS_DRAW_V, measureProgressPlace, mountProgress, progressCss, progressFilters, progressHeight, progressPlan, setProgressState } from "./post-progress.mjs";
@@ -419,6 +420,8 @@ export function postSegmentArgs({ entry, box, plan, layout, cards, files, render
"-filter_complex", parts.join(";"),
"-map", "[v]", "-map", "[a]",
...encode,
+ // Limited range, converted: a JPEG input would make the segment full range (color-range.mjs).
+ ...LIMITED_RANGE,
"-t", num(T),
outPath,
];
@@ -1382,7 +1385,7 @@ export const postSegmentKey = (fields) => createHash("sha256").update(JSON.strin
* attachment the anchor's, the scene's earlier messages above its card -- not
* drawn when `scene` is). Returns the segment's path.
*/
-export async function buildPostSegment(entry, { render, outDir, manifestDir, box, place = [], encode = [], exec, ffmpeg = "ffmpeg", emit = () => {}, avatars = {}, redaction = null, prev = null, scene = null, mediaScene = null, join = null, joinFrom = null }) {
+export async function buildPostSegment(entry, { render, outDir, manifestDir, box, place = [], encode = [], exec, ffmpeg = "ffmpeg", ffprobe = "ffprobe", emit = () => {}, avatars = {}, redaction = null, prev = null, scene = null, mediaScene = null, join = null, joinFrom = null }) {
// A channel's markup may censor an attachment for every project (post-censor.mjs); the item's own blur wins.
entry = censorEntry(entry, redaction);
// In a media scene (post-media-scene.mjs) the shared attachment is the anchor's -- its markup laid on too.
@@ -1465,7 +1468,14 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box
const had = await readFile(record, "utf8").then((t) => JSON.parse(t), () => null);
// The render pool (render-pool.mjs): this item, by this key, built by any take of any project.
const pool = await poolFor(outDir);
- if (had?.key === key && (await stat(seg).catch(() => null))) {
+ // A segment encoded FULL range (before the pin, color-range.mjs) is rebuilt though its key matches: its page is a
+ // shade off every other item's in the master. Only those -- the key is not bumped, so no other segment moves.
+ const fullRange = async (f) => {
+ const yes = await isFullRange(f, { exec, ffprobe });
+ if (yes) emit("note", { message: `${entry.id}: its segment is full range (yuvj420p) — rebuilt in limited range, as every other segment is` });
+ return yes;
+ };
+ if (had?.key === key && (await stat(seg).catch(() => null)) && !(await fullRange(seg))) {
emit("note", { message: `${entry.id}: post item unchanged — its segment kept` });
// (One the pool has not got -- built before it, or linked in by --from -- is filed now: the item as
// post-render made it, which a combo badge's pass keeps beside it as `.plain.mp4`.)
@@ -1477,7 +1487,7 @@ export async function buildPostSegment(entry, { render, outDir, manifestDir, box
}
return seg;
}
- if (pool && (await poolFetch(pool, "post", key, { "seg.mp4": seg, "post.json": record }))) {
+ if (pool && (await poolFetch(pool, "post", key, { "seg.mp4": seg, "post.json": record })) && !(await fullRange(seg))) {
emit("note", { message: `${entry.id}: post item from the render pool (key ${key.slice(0, 12)})` });
return seg;
}