commit 9e69d6247fb55c91902ecc718394f14ec4911186
parent f70fb8a92dddb9e230da61c5a9b54d1023de2332
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Sat, 14 Nov 2026 08:42:07 -0500
compact-saved-videos: only scenes make a lower kind of picture, and every chunk is compared with the others
Review of f70fb8a92: a SHORT PERIODIC defect (2 s of every 8 s at 0.93, a
broken setting or a per-GOP fault) manufactured its own "lower kind of
picture" and passed the luma floor. Now only scene structure counts:
- frames count toward a lower state only in runs of at least
wholeFileLowerRunSeconds (8 s, longer than one 5 s GOP) below the split,
for Otsu's split (taken again without the first split's short runs) and
for the 20 % block share; shorter runs are judged by their stretch;
- at least 3 such runs, a tenth of the file;
- a run with an edge on a chunk join never counts (a scene edge lands within
two frames of a 10-minute join about 0.03 % of the time; a bad chunk next
to a real lower stretch merges with it at one end only), and when most
runs are such the state is refused (lowerStateRefused on the pointer).
Every chunk is now compared with the others (checks.chunkMeans): its mean on
Y, U and V must reach the other chunks' median - max(wholeFileChunkSigmaK (4)
x their robust spread, wholeFileChunkMargin (0.02)). A chunk below it fails
unless the source explains the drop: most of it is the file's lower kind of
picture AND its mean reaches what that mix predicts less the margin, or
neither of its joins shows the drop (the 5 s inside score within half the
drop of the 5 s outside: a bad chunk changes level at its joins, a harder
scene across chunks changes level where the scene changes). "after-verify"
needs the luma, colour and per-chunk records.
Tested with the defaults: every r6 periodic case fails again; 1, 2, 4 and 6
bad chunks of 35 at 0.96, 0.94 and 0.92 fail (they passed before), as do two
adjacent ones, the last one, and bad chunks inside 20 s switching;
alternation every 10, 20, 60 and 90 s, a webcam opening or closing the file,
the 20/30/45 % stretches and a game hour or three game segments across
chunks pass; 1 s dips fail; the defect table fails as before.
Co-Authored-By: Claude <noreply@anthropic.com>
Diffstat:
10 files changed, 416 insertions(+), 48 deletions(-)
diff --git a/OPERATING.md b/OPERATING.md
@@ -1212,15 +1212,32 @@ pnpm ops compaction-markers --json '{"clear":{"slug":"example","id":"<videoId>"}
cannot see a hue shift or chroma-only noise. The relative floor is LOCAL: each frame is judged against the
`wholeFileWindowSeconds` (120) around it, the lower of the floors of the half-window before and the half-window
after (median − max(8 × 1.4826 × the median absolute deviation, 0.03)). So a stream that alternates a webcam
- and a screen share is judged stretch by stretch, and a few bad frames cannot widen their own floor. When the
- file keeps coming back to a lower-scoring kind of picture (at least a tenth of its frames, scoring below the
- other kind's floor; the pointer's `lowerState`), a half-window that is a fifth or more that kind takes its floor
- from those frames alone. So a stream switching between a share and a webcam every 20 s passes. A degraded
- stretch longer than the window looks steady to that floor. It is caught instead by the absolute per-frame floor,
- the tile grid, the mean floor, and the VMAF excerpts, laid at least one every window across the file. At 640×360 the
- comparison costs about 5–6× a plain decode of both files; its per-frame cost is fixed (about 4 ms at 256 px), so
- it adds roughly 35 minutes to a 5-hour 30 fps stream (an estimate). `"after-verify"` drops only when the pointer
- records both the luma and the colour comparison;
+ and a screen share is judged stretch by stretch, and a few bad frames cannot widen their own floor.
+
+ When the file keeps coming back to a lower-scoring kind of picture, a half-window that is a fifth or more that
+ kind takes its floor from those frames alone (the pointer's `lowerState`). So a stream switching between a share
+ and a webcam every 20 s passes. Only scenes count as such a kind:
+ - runs of at least `wholeFileLowerRunSeconds` (8) below the split, so a fault of a few seconds every GOP, or every
+ few seconds, never passes as one;
+ - at least 3 such runs, together at least a tenth of the file, scoring below the other kind's floor;
+ - no run beginning or ending on a chunk join. That is a bad chunk's signature, and when most runs are such, the
+ kind is refused (`lowerStateRefused`).
+
+ A degraded stretch longer than the window looks steady to that floor. It is caught instead by the absolute
+ per-frame floor, the tile grid, the mean floor, the VMAF excerpts (at least one every window across the file),
+ and the per-chunk comparison below. At 640×360 the comparison costs about 5–6× a plain decode of both files.
+ Its per-frame cost is fixed (about 4 ms at 256 px), so it adds roughly 35 minutes to a 5-hour 30 fps stream (an
+ estimate);
+ - EVERY CHUNK AGAINST THE OTHERS (`checks.chunkMeans`): each chunk's mean, grey, U and V, must reach the other
+ chunks' median − max(`wholeFileChunkSigmaK` (4) × their robust spread, `wholeFileChunkMargin` (0.02)). A chunk
+ below it fails unless the source explains the drop:
+ - most of the chunk is the file's lower kind of picture, and its mean reaches what that mix predicts, less the
+ margin; or
+ - neither of its joins shows the drop: the 5 s just inside the chunk score within half the drop of the 5 s just
+ outside. A bad encode of a chunk changes level at its joins; a harder scene that runs across chunks (a game hour
+ in a talk stream) changes level where the scene changes.
+
+ `"after-verify"` drops only when the pointer records the luma, the colour and the per-chunk comparison;
- VMAF on 2-second excerpts across every chunk join, inside every chunk, and at `qualitySamples` (12) more spread
through the file: mean at least `vmafMinMean` (90), none below `vmafMinSample` (85). SSIM where this ffmpeg has
no libvmaf. Frames are paired by number on one clock;
@@ -1233,13 +1250,20 @@ pnpm ops compaction-markers --json '{"clear":{"slug":"example","id":"<videoId>"}
undone: a failure after it is reported as one, with the original kept.
- **What verification does not guarantee.** It catches every planted defect we have tried, but a copy can pass and
still be slightly worse than its source in these places:
- - a long, evenly softer stretch of about 90 s or more (it becomes its own neighbourhood), unless it falls below the
- absolute or mean floor, the tile floor or a VMAF excerpt;
+ - a long, evenly softer stretch of about 90 s or more (it becomes its own neighbourhood) that does not begin or
+ end at a chunk join, unless it falls below the absolute or mean floor, the tile floor or a VMAF excerpt;
+ - a whole chunk less than `wholeFileChunkMargin` (0.02) below the others (more on a stream whose chunks vary), or a
+ chunk that drops 5 s or more after its join and recovers 5 s or more before the next. Most chunks equally bad
+ move the median with them;
- a change to less than about 0.5% of the frame for a few seconds;
- a slight defect within about 40 s of a scene change into a lower-scoring kind of picture;
- in a file that keeps returning to a lower-scoring kind of picture, a stretch of about 35 s or more, or any dip
while the two kinds switch quickly, that stays above that kind's floor.
+ A harder chunk the source does not explain fails the copy. That is a chunk below the others with a level change at
+ its join: a scene change into a harder picture that lands within 5 s of a join, in a kind the file does not keep
+ returning to. The original stays active and the log names the chunk. That failure is safe; a pass would not be.
+
A verified copy is a close copy, not an identical one. That is why `dropOriginal` stays `"keep"`.
- **The original.** `dropOriginal` is `"keep"` by default: every original stays until a person drops it. Under
`"after-verify"` a separate step, after the swap, reads the re-encode back from disk (fsynced, dropped from the
diff --git a/SETTINGS.md b/SETTINGS.md
@@ -656,6 +656,9 @@ Compacting a saved video (`pnpm ops compact-saved-videos`, controller/compactSav
| `wholeFileChromaMin` | `0.9` | THE COLOUR, every frame: the whole-file comparison also scores the U and V planes (SSIM), which the grey comparison and VMAF do not see — a hue shift, chroma-only noise. No frame's lower plane may fall below this. Default 0.9 (a good crf-36 SVT-AV1 copy of a detailed test pattern: lowest 0.991). |
| `wholeFileChromaMean` | `0.97` | The colour planes' mean must reach this. Default 0.97 (good copy: 0.9986). |
| `wholeFileWindowSeconds` | `120` | The NEIGHBOURHOOD the relative floor is taken over: each frame is judged against the frames in the half-window just before it and just after it (the lower of their two floors), so a stream alternating two kinds of picture (a webcam, a screen share) is judged stretch by stretch, not by the file's dominant mode. A short defect inside a steady stretch has that stretch on both sides and falls below it. A degraded stretch longer than the window looks steady to it: such a stretch is caught by the absolute per-frame floor, the tile grid, the mean floor, and the VMAF excerpts, one at least every window across the whole file. Default 120 s; 5–3600. |
+| `wholeFileLowerRunSeconds` | `8` | A file that keeps coming back to a lower-scoring kind of picture (a webcam between screen shares) judges a neighbourhood that is a fifth or more that kind by those frames alone. Only SCENES count toward that kind: runs of at least this many seconds below the split, at least 3 of them, at least a tenth of the file, and none beginning or ending on a chunk join (a bad chunk's signature). Shorter runs are judged by the stretch around them, so a fault of a few seconds every GOP never passes as a kind of picture. Default 8 (longer than one 5 s GOP, with margin); 1–600. |
+| `wholeFileChunkSigmaK` | `4` | EVERY CHUNK AGAINST THE OTHERS: each chunk's mean (grey, U and V) must reach the other chunks' median − max(this × their robust spread, wholeFileChunkMargin). A chunk below it fails unless the source explains it: most of it is the file's recurring lower kind of picture, or its joins show no drop (a harder scene runs across chunks; a bad chunk changes level at its joins). Default 4. |
+| `wholeFileChunkMargin` | `0.02` | The least the per-chunk floor sits under the other chunks' median. Default 0.02. |
| `availabilityMaxAgeDays` | `7` | How fresh the platform check must be for a video to count as still on its platform: an availability record written by a real check (not a backfill), public or unlisted, at most this many days old. Anything else counts as gone, and its original waits for a person's review. Default 7. |
| `dropOriginal` | `"keep"` | "keep" (the default in this slice): every original stays until a person drops it. "after-verify": once every check passed and the pointer names the compacted copy, a separate step reads that copy back from disk (size, sha256, container, length) and then drops the original — except for a video gone from its platform (availability not public or unlisted, or unknown), whose original waits for a person's review (`get compaction-review`, `review-compacted-original`, then `drop-saved-alternate` with `confirmOriginal`); only when the verification included the whole-file comparison. There is no backup of the store: after such a drop the compacted copy is the only copy. |
@@ -692,6 +695,9 @@ Default:
"wholeFileChromaMin": 0.9,
"wholeFileChromaMean": 0.97,
"wholeFileWindowSeconds": 120,
+ "wholeFileLowerRunSeconds": 8,
+ "wholeFileChunkSigmaK": 4,
+ "wholeFileChunkMargin": 0.02,
"availabilityMaxAgeDays": 7,
"dropOriginal": "keep"
}
diff --git a/common/controller/compactSavedVideos.test.ts b/common/controller/compactSavedVideos.test.ts
@@ -872,6 +872,10 @@ test("F2: a GOOD SVT-AV1 crf-36 encode of a detailed 640x360 fixture passes ever
assert.ok(w.worstTile && w.worstTile.min >= settings.wholeFileTileMin + 0.1 && w.worstTile.longestBelow === 0, JSON.stringify(w));
// The colour planes too (measured 0.991 at their lowest).
assert.ok(w.chroma && w.chroma.min >= settings.wholeFileChromaMin + 0.05 && w.chroma.mean >= settings.wholeFileChromaMean + 0.02, JSON.stringify(w.chroma));
+ // Every chunk against the others (review G2): recorded, none below.
+ const m = (await loadSavedVideo(fx.videoDir))!.compacted!.checks.chunkMeans!;
+ assert.ok(m && m.count >= 3 && m.worst === null && m.margin === settings.wholeFileChunkMargin, JSON.stringify(m));
+ assert.equal(w.lowerRunSeconds, settings.wholeFileLowerRunSeconds);
});
});
diff --git a/common/controller/compactSavedVideos.ts b/common/controller/compactSavedVideos.ts
@@ -473,6 +473,17 @@ export async function planCompaction(opts: {
type ChunkState = ChunkPlan & { file: string; bytes?: number; done: boolean };
+// Each chunk's first frame in the copy: the chunks' expected frames, summed.
+function chunkStartFrames(chunks: { expectedFrames: number }[]): number[] {
+ const out: number[] = [];
+ let at = 0;
+ for (const c of chunks) {
+ out.push(at);
+ at += c.expectedFrames;
+ }
+ return out;
+}
+
type CompactState = {
version: typeof STATE_VERSION;
sourceFile: string;
@@ -1072,6 +1083,10 @@ async function verify(o: {
chromaMinFrame: s.wholeFileChromaMin,
chromaMeanFloor: s.wholeFileChromaMean,
windowFrames: Math.round(s.wholeFileWindowSeconds * outFps),
+ lowerRunFrames: Math.round(s.wholeFileLowerRunSeconds * outFps),
+ chunkStarts: chunkStartFrames(state.chunks),
+ chunkSigmaK: s.wholeFileChunkSigmaK,
+ chunkMargin: s.wholeFileChunkMargin,
});
checks.wholeFile = {
fps: outFps,
@@ -1088,7 +1103,9 @@ async function verify(o: {
windowSeconds: s.wholeFileWindowSeconds,
worstLocalMargin: round(v.worstLocalMargin, 4),
worstLocalAt: round(v.worstLocalAt / outFps, 3),
- ...(v.lowerState ? { lowerState: { floor: round(v.lowerState.floor, 4), share: round(v.lowerState.share, 3) } } : {}),
+ lowerRunSeconds: s.wholeFileLowerRunSeconds,
+ ...(v.lowerState ? { lowerState: { floor: round(v.lowerState.floor, 4), share: round(v.lowerState.share, 3), runs: v.lowerState.runs } } : {}),
+ ...(v.lowerStateRefused ? { lowerStateRefused: v.lowerStateRefused } : {}),
relativeFloor: round(v.relativeFloor, 4),
chroma: {
mean: round(v.chroma.mean, 4),
@@ -1113,6 +1130,17 @@ async function verify(o: {
}
: {}),
};
+ if (v.chunks) {
+ checks.chunkMeans = {
+ count: v.chunks.count,
+ sigmaK: v.chunks.sigmaK,
+ margin: v.chunks.margin,
+ worst: v.chunks.worst
+ ? { chunk: v.chunks.worst.index, plane: v.chunks.worst.plane, mean: round(v.chunks.worst.mean, 4), centre: round(v.chunks.worst.centre, 4), floor: round(v.chunks.worst.floor, 4) }
+ : null,
+ exempt: v.chunks.exempt.map((x) => ({ chunk: x.index, plane: x.plane, why: x.why })),
+ };
+ }
if (!v.ok) fail(`the whole-file comparison: ${v.why}`);
log(
`${tag}: whole file SSIM ${v.mean.toFixed(4)} mean over ${cmp.frames.length} frames, lowest ${v.min.toFixed(4)} at ${(v.minAt / outFps).toFixed(2)} s; ` +
@@ -1282,8 +1310,10 @@ async function afterSwap(o: {
log(`${tag}: dropOriginal is "keep": the original ${original.file} stays until a person drops it.`);
return { dropped: false, review: state() };
}
- if (!pointer.compacted?.checks.wholeFile || !pointer.compacted.checks.wholeFile.chroma) {
- log(`${tag}: the verification has no whole-file luma AND colour comparison: "after-verify" does not drop the original ${original.file}.`);
+ if (!pointer.compacted?.checks.wholeFile || !pointer.compacted.checks.wholeFile.chroma || !pointer.compacted.checks.chunkMeans) {
+ log(
+ `${tag}: the verification has no whole-file luma, colour AND per-chunk comparison: "after-verify" does not drop the original ${original.file}.`,
+ );
return { dropped: false, review: state() };
}
if (!presence.onPlatform) {
diff --git a/common/lib/compactMedia-server.ts b/common/lib/compactMedia-server.ts
@@ -889,8 +889,12 @@ export type WholeFileVerdict = {
worstLocalMargin: number;
worstLocalAt: number;
windowFrames: number;
- // The file's recurring lower kind of picture, when it has one (review F-a).
+ // The file's recurring lower kind of picture, when it has one (review F-a),
+ // and why a candidate was refused (review G1).
lowerState: LowerState | null;
+ lowerStateRefused?: string;
+ // Every chunk against the others (review G2); null without chunk starts.
+ chunks: ChunkVerdict | null;
worstTile: TileSummary | null;
chroma: { mean: number; min: number; minAt: number; plane: "U" | "V" };
};
@@ -921,18 +925,18 @@ function floorOf(f: Float32Array, k: number, margin: number): { median: number;
// webcam has a floor that flips with whichever is the majority (and, split
// evenly, a median between the two and a floor far too low). So when the file
// has a RECURRING LOWER KIND of picture (`lowerState`), a neighbourhood holding
-// at least LOWER_STATE_BLOCK_SHARE of its frames at that kind's level takes its
+// at least LOWER_STATE_BLOCK_SHARE of its frames in that kind's runs takes its
// floor from THOSE frames alone: the frames in the same state. A second's dip
-// inside a steady stretch is under that share and keeps the stretch's floor.
+// inside a steady stretch is in no run and keeps the stretch's floor.
export function localFloors(f: Float32Array, windowFrames: number, k: number, margin: number, lower?: LowerState | null): Float32Array {
const out = new Float32Array(f.length);
const half = Math.max(8, Math.floor(windowFrames / 2));
const lowCount = new Uint32Array(f.length + 1);
- for (let i = 0; i < f.length; i += 1) lowCount[i + 1] = lowCount[i] + (lower && f[i] < lower.threshold ? 1 : 0);
+ for (let i = 0; i < f.length; i += 1) lowCount[i + 1] = lowCount[i] + (lower?.mask[i] ? 1 : 0);
const blockFloor = (s: number, e: number) => {
const block = f.subarray(s, e);
if (!lower || lowCount[e] - lowCount[s] < LOWER_STATE_BLOCK_SHARE * (e - s)) return floorOf(block, k, margin).floor;
- return floorOf(block.filter((x) => x < lower.threshold), k, margin).floor;
+ return floorOf(block.filter((_, j) => lower.mask[s + j] === 1), k, margin).floor;
};
if (f.length <= windowFrames) {
out.fill(blockFloor(0, f.length));
@@ -976,26 +980,39 @@ export function localFloors(f: Float32Array, windowFrames: number, k: number, ma
return out;
}
-// A RECURRING LOWER KIND OF PICTURE: the file's frames split in two where the
-// two groups are most distinct (Otsu's split on the scores), each group at
-// least LOWER_STATE_FILE_SHARE of the file, and the lower group's median below
-// the upper group's own floor (else the upper floor already admits it). Its
-// floor is the lower group's median − max(k · its robust spread, margin).
-// None for a file of one kind of picture, or one whose lower scores are a
-// defect shorter than a tenth of it.
-export type LowerState = { threshold: number; floor: number; share: number };
+// A RECURRING LOWER KIND OF PICTURE (review F-a, bounded by review G1). Only
+// SCENE STRUCTURE qualifies: frames count only in RUNS of at least
+// `minRunFrames` below the split (longer than one 5 s GOP, with margin, so a
+// per-GOP or periodic fault of a few seconds never forms a state). The split is
+// Otsu's on the scores, taken twice: the second time without the frames of the
+// first split's short runs. The state then needs
+// - its runs' frames at least LOWER_STATE_FILE_SHARE of the file, and the
+// frames above the split at least as many;
+// - at least LOWER_STATE_MIN_RUNS separate runs;
+// - its frames' median below the upper frames' own floor (else the upper
+// floor already admits them);
+// - a run with an edge on a CHUNK JOIN (within CHUNK_EDGE_FRAMES of an
+// interior join) is a bad chunk's signature, not a scene's — a scene
+// change lands within two frames of a 10-minute join about 0.03% of the
+// time, and a bad chunk next to a real lower stretch merges with it at one
+// end only: such a run never counts, and when most runs are such, the
+// state is refused.
+// Its floor is its frames' median − max(k · their robust spread, margin).
+export type LowerState = { threshold: number; floor: number; share: number; runs: number; mask: Uint8Array };
export const LOWER_STATE_FILE_SHARE = 0.1;
export const LOWER_STATE_BLOCK_SHARE = 0.2;
-export function lowerState(f: Float32Array, k: number, margin: number): LowerState | null {
- const n = f.length;
- const lo = Math.ceil(LOWER_STATE_FILE_SHARE * n);
- if (n < 32 || lo >= n - lo) return null;
- const s = Float64Array.from(f).sort();
+export const LOWER_STATE_MIN_RUNS = 3;
+export const CHUNK_EDGE_FRAMES = 2;
+
+function otsuThreshold(values: Float32Array, minSide: number): number | null {
+ const n = values.length;
+ if (n < 2 * minSide || minSide < 1) return null;
+ const s = Float64Array.from(values).sort();
const sum = new Float64Array(n + 1);
for (let i = 0; i < n; i += 1) sum[i + 1] = sum[i] + s[i];
let best = -1;
- let at = lo;
- for (let j = lo; j <= n - lo; j += 1) {
+ let at = minSide;
+ for (let j = minSide; j <= n - minSide; j += 1) {
const d = sum[j] / j - (sum[n] - sum[j]) / (n - j);
const between = j * (n - j) * d * d;
if (between > best) {
@@ -1003,10 +1020,62 @@ export function lowerState(f: Float32Array, k: number, margin: number): LowerSta
at = j;
}
}
- const low = Float32Array.from(s.subarray(0, at));
- const upper = floorOf(Float32Array.from(s.subarray(at)), k, margin);
- if (medianOf(low) >= upper.floor) return null;
- return { threshold: (s[at - 1] + s[at]) / 2, floor: floorOf(low, k, margin).floor, share: at / n };
+ return (s[at - 1] + s[at]) / 2;
+}
+
+// The runs of frames below `threshold`, [from, to).
+function runsBelow(f: Float32Array, threshold: number): [number, number][] {
+ const out: [number, number][] = [];
+ let start = -1;
+ for (let i = 0; i <= f.length; i += 1) {
+ const low = i < f.length && f[i] < threshold;
+ if (low && start < 0) start = i;
+ else if (!low && start >= 0) {
+ out.push([start, i]);
+ start = -1;
+ }
+ }
+ return out;
+}
+
+export function lowerState(
+ f: Float32Array,
+ k: number,
+ margin: number,
+ o: { minRunFrames: number; chunkStarts?: number[] } = { minRunFrames: 1 },
+): { state: LowerState | null; refused?: string } {
+ const n = f.length;
+ const minSide = Math.ceil(LOWER_STATE_FILE_SHARE * n);
+ if (n < 32) return { state: null };
+ const minRun = Math.max(1, Math.round(o.minRunFrames));
+ const long = (t: number) => runsBelow(f, t).filter(([a, b]) => b - a >= minRun);
+ const t1 = otsuThreshold(f, minSide);
+ if (t1 === null) return { state: null };
+ const keep1 = new Uint8Array(n).fill(1);
+ for (const [a, b] of runsBelow(f, t1)) if (b - a < minRun) keep1.fill(0, a, b);
+ const t = otsuThreshold(f.filter((_, i) => keep1[i] === 1), Math.min(minSide, Math.floor(n / 4))) ?? t1;
+ const joins = new Set<number>((o.chunkStarts ?? []).filter((x) => x > 0 && x < n));
+ const onJoin = (x: number) => {
+ for (let d = -CHUNK_EDGE_FRAMES; d <= CHUNK_EDGE_FRAMES; d += 1) if (joins.has(x + d)) return true;
+ return false;
+ };
+ const all = long(t);
+ const aligned = joins.size ? all.filter(([a, b]) => onJoin(a) || onJoin(b)) : [];
+ const runs = all.filter((r) => !aligned.includes(r));
+ if (all.length && aligned.length * 2 > all.length) {
+ return { state: null, refused: `${aligned.length} of its ${all.length} runs begin or end on a chunk join (a bad chunk's signature)` };
+ }
+ const mask = new Uint8Array(n);
+ let count = 0;
+ for (const [a, b] of runs) {
+ mask.fill(1, a, b);
+ count += b - a;
+ }
+ const upper = f.filter((x) => x >= t);
+ if (count < minSide || upper.length < minSide || runs.length < LOWER_STATE_MIN_RUNS) return { state: null };
+ const low = f.filter((_, i) => mask[i] === 1);
+ if (medianOf(low) >= floorOf(upper, k, margin).floor) return { state: null };
+ return { state: { threshold: t, floor: floorOf(low, k, margin).floor, share: count / n, runs: runs.length, mask } };
}
export function robustSpread(f: Float32Array): { median: number; sd: number } {
@@ -1030,6 +1099,15 @@ export function judgeWholeFile(
chromaMeanFloor: number;
// The neighbourhood's length in frames (settings wholeFileWindowSeconds × fps).
windowFrames?: number;
+ // The shortest run below the split that counts toward a lower state, in
+ // frames (wholeFileLowerRunSeconds × fps). Default: 8 s.
+ lowerRunFrames?: number;
+ // Each chunk's first frame in the copy (the first is 0). With them, the
+ // lower state refuses runs on chunk joins and every chunk is compared with
+ // the others (`chunks`).
+ chunkStarts?: number[];
+ chunkSigmaK?: number;
+ chunkMargin?: number;
},
): WholeFileVerdict {
const f = c.frames;
@@ -1047,7 +1125,8 @@ export function judgeWholeFile(
const { median, sd } = robustSpread(f);
const relativeFloor = median - Math.max(t.sigmaK * sd, t.sigmaMinMargin);
const windowFrames = Math.max(16, Math.round(t.windowFrames ?? f.length));
- const lower = lowerState(f, t.sigmaK, t.sigmaMinMargin);
+ const lowerResult = lowerState(f, t.sigmaK, t.sigmaMinMargin, { minRunFrames: t.lowerRunFrames ?? 8 * t.fps, chunkStarts: t.chunkStarts });
+ const lower = lowerResult.state;
const local = localFloors(f, windowFrames, t.sigmaK, t.sigmaMinMargin, lower);
let worstLocalMargin = Infinity;
let worstLocalAt = 0;
@@ -1081,7 +1160,14 @@ export function judgeWholeFile(
}
const chroma = { mean: u.length ? cSum / u.length : 0, min: cMin, minAt: cMinAt, plane: cPlane };
const at = (i: number) => `${(i / t.fps).toFixed(2)} s`;
- const base = { mean, median, sd, min, minAt, relativeFloor, worstLocalMargin, worstLocalAt, windowFrames, lowerState: lower, worstTile, chroma };
+ const chunks =
+ t.chunkStarts && f.length === t.expectedFrames && u.length === f.length && v.length === f.length
+ ? judgeChunks({ Y: f, U: u, V: v }, t.chunkStarts, lower, { sigmaK: t.chunkSigmaK ?? 4, margin: t.chunkMargin ?? 0.02, fps: t.fps })
+ : null;
+ const base = {
+ mean, median, sd, min, minAt, relativeFloor, worstLocalMargin, worstLocalAt, windowFrames,
+ lowerState: lower, ...(lowerResult.refused ? { lowerStateRefused: lowerResult.refused } : {}), worstTile, chroma, chunks,
+ };
if (f.length !== t.expectedFrames || u.length !== t.expectedFrames || v.length !== t.expectedFrames) {
return { ...base, ok: false, why: `the comparison saw ${f.length} of the copy's ${t.expectedFrames} frames (colour: ${u.length}): it ends early or skips` };
}
@@ -1110,5 +1196,97 @@ export function judgeWholeFile(
return { ...base, ok: false, why: `the colour (${cPlane} plane) of a frame at ${at(cMinAt)} scores ${cMin.toFixed(3)} (no frame may fall below ${t.chromaMinFrame})` };
}
if (chroma.mean < t.chromaMeanFloor) return { ...base, ok: false, why: `the colour's mean is ${chroma.mean.toFixed(3)} (needs ${t.chromaMeanFloor})` };
+ if (chunks && !chunks.ok) return { ...base, ok: false, why: chunks.why };
return { ...base, ok: true };
}
+
+// EVERY CHUNK AGAINST THE OTHERS (review G2). A stretch longer than the local
+// window is its own neighbourhood, so a whole chunk evenly worse (a bad encode
+// of one chunk) passed the frame floors. Each chunk's mean, on Y, U and V, is
+// held to the other chunks' median − max(sigmaK × their robust spread, margin).
+// A chunk below it fails UNLESS the source explains the drop:
+// - most of its frames are in the file's recurring lower kind of picture
+// (`lowerState`, whose runs on chunk joins never count) AND its mean
+// reaches what that mix predicts — its share of each kind times that
+// kind's median, less the margin — so a bad chunk flanked by the lower
+// kind on both sides is not explained by it; or
+// - neither of its joins shows the drop: the frames just inside the chunk
+// score within half the drop of the frames just outside. A bad chunk
+// changes level AT its joins; a harder scene that runs across chunks
+// (a game segment in a talk stream) changes level where the scene changes.
+// One chunk: nothing to compare. Two: each against the other.
+export type ChunkVerdict = {
+ ok: boolean;
+ why?: string;
+ count: number;
+ sigmaK: number;
+ margin: number;
+ // The lowest chunk mean relative to its floor (not exempt), on any plane.
+ worst: { index: number; plane: "Y" | "U" | "V"; mean: number; centre: number; floor: number } | null;
+ exempt: { index: number; plane: "Y" | "U" | "V"; why: "lower state" | "no step at its joins" }[];
+};
+export const CHUNK_JOIN_SECONDS = 5;
+
+export function judgeChunks(
+ planes: { Y: Float32Array; U: Float32Array; V: Float32Array },
+ chunkStarts: number[],
+ lower: LowerState | null,
+ o: { sigmaK: number; margin: number; fps: number },
+): ChunkVerdict {
+ const n = planes.Y.length;
+ const starts = [...new Set(chunkStarts.filter((x) => x >= 0 && x < n))].sort((a, b) => a - b);
+ if (starts[0] !== 0) starts.unshift(0);
+ const spans = starts.map((a, i) => [a, i + 1 < starts.length ? starts[i + 1] : n] as const);
+ const out: ChunkVerdict = { ok: true, count: spans.length, sigmaK: o.sigmaK, margin: o.margin, worst: null, exempt: [] };
+ if (spans.length < 2) return out;
+ const meanOf = (p: Float32Array, a: number, b: number) => {
+ let x = 0;
+ for (let i = a; i < b; i += 1) x += p[i];
+ return b > a ? x / (b - a) : 0;
+ };
+ for (const plane of ["Y", "U", "V"] as const) {
+ const p = planes[plane];
+ const means = spans.map(([a, b]) => meanOf(p, a, b));
+ // The two kinds' typical scores on this plane, when the file has a lower state.
+ const lowMedian = lower ? medianOf(p.filter((_, i) => lower.mask[i] === 1)) : 0;
+ const upMedian = lower ? medianOf(p.filter((_, i) => lower.mask[i] === 0)) : 0;
+ spans.forEach(([a, b], ci) => {
+ const others = Float32Array.from(means.filter((_, j) => j !== ci));
+ const r = robustSpread(others);
+ const floor = r.median - Math.max(o.sigmaK * r.sd, o.margin);
+ const gap = means[ci] - floor;
+ if (gap >= 0) return;
+ let lowFrames = 0;
+ if (lower) for (let i = a; i < b; i += 1) lowFrames += lower.mask[i];
+ const m = lowFrames / (b - a);
+ if (lower && m >= 0.5 && means[ci] >= m * lowMedian + (1 - m) * upMedian - o.margin) {
+ out.exempt.push({ index: ci, plane, why: "lower state" });
+ return;
+ }
+ const drop = r.median - means[ci];
+ const w = Math.max(1, Math.min(Math.round(CHUNK_JOIN_SECONDS * o.fps), Math.floor((b - a) / 4)));
+ const stepAt = (join: number, inside: [number, number]) => {
+ const outside: [number, number] = join === a ? [Math.max(0, a - w), a] : [b, Math.min(n, b + w)];
+ return meanOf(p, outside[0], outside[1]) - meanOf(p, inside[0], inside[1]) >= drop / 2;
+ };
+ const step = (ci > 0 && stepAt(a, [a, Math.min(b, a + w)])) || (ci < spans.length - 1 && stepAt(b, [Math.max(a, b - w), b]));
+ if (!step) {
+ out.exempt.push({ index: ci, plane, why: "no step at its joins" });
+ return;
+ }
+ if (!out.worst || gap < out.worst.mean - out.worst.floor) {
+ out.worst = { index: ci, plane, mean: means[ci], centre: r.median, floor };
+ }
+ });
+ }
+ if (out.worst) {
+ const wst = out.worst;
+ const [a, b] = spans[wst.index];
+ out.ok = false;
+ out.why =
+ `chunk ${wst.index + 1} of ${spans.length} (${(a / o.fps).toFixed(1)}–${(b / o.fps).toFixed(1)} s) scores ${wst.mean.toFixed(4)} on ${wst.plane}, ` +
+ `below the other chunks' floor ${wst.floor.toFixed(4)} (their median ${wst.centre.toFixed(4)} − max(${o.sigmaK}·robust spread, ${o.margin})), ` +
+ "and the drop begins or ends at its chunk join";
+ }
+ return out;
+}
diff --git a/common/lib/savedVideo.ts b/common/lib/savedVideo.ts
@@ -175,10 +175,25 @@ export type SavedVideoCompactedChecks = {
// The file's recurring lower kind of picture, when it has one (review
// F-a): its floor and its share of the frames. A neighbourhood holding at
// least a fifth of its frames at that level took its floor from them alone.
- lowerState?: { floor: number; share: number };
+ lowerState?: { floor: number; share: number; runs?: number };
+ // Only runs of at least this many seconds count toward it, and why a
+ // candidate was refused (runs on chunk joins: review G1).
+ lowerRunSeconds?: number;
+ lowerStateRefused?: string;
// THE COLOUR (review D1): SSIM on the U and V planes, every frame.
chroma?: { mean: number; min: number; worstAt: number; plane: string; minFloor: number; meanFloor: number };
};
+ // EVERY CHUNK AGAINST THE OTHERS (review G2): each chunk's mean on Y, U and
+ // V held to the other chunks' median − max(sigmaK × spread, margin); the
+ // worst chunk below it that the source does not explain (null: none), and
+ // the chunks below it the source explains and why.
+ chunkMeans?: {
+ count: number;
+ sigmaK: number;
+ margin: number;
+ worst: { chunk: number; plane: string; mean: number; centre: number; floor: number } | null;
+ exempt: { chunk: number; plane: string; why: string }[];
+ };
// Every stream but the video, and the chapters: what the source holds and
// the copy holds ("audio:aac", "subtitle:mov_text", "chapters:3", …).
streams?: { source: string[]; result: string[] };
@@ -507,8 +522,16 @@ function parseCompacted(raw: unknown): SavedVideoCompacted | null {
...(typeof w.worstLocalMargin === "number" ? { worstLocalMargin: w.worstLocalMargin } : {}),
...(typeof w.worstLocalAt === "number" ? { worstLocalAt: w.worstLocalAt } : {}),
...(w.lowerState && typeof w.lowerState === "object" && typeof obj(w.lowerState).floor === "number" && typeof obj(w.lowerState).share === "number"
- ? { lowerState: { floor: obj(w.lowerState).floor as number, share: obj(w.lowerState).share as number } }
+ ? {
+ lowerState: {
+ floor: obj(w.lowerState).floor as number,
+ share: obj(w.lowerState).share as number,
+ ...(typeof obj(w.lowerState).runs === "number" ? { runs: obj(w.lowerState).runs as number } : {}),
+ },
+ }
: {}),
+ ...(typeof w.lowerRunSeconds === "number" ? { lowerRunSeconds: w.lowerRunSeconds } : {}),
+ ...(typeof w.lowerStateRefused === "string" ? { lowerStateRefused: w.lowerStateRefused } : {}),
...(w.chroma && typeof w.chroma === "object"
? (() => {
const c = obj(w.chroma);
@@ -536,6 +559,21 @@ function parseCompacted(raw: unknown): SavedVideoCompacted | null {
}
: {}),
...(Array.isArray(c.avOffset) ? { avOffset: pair(c.avOffset) } : {}),
+ ...(c.chunkMeans && typeof c.chunkMeans === "object"
+ ? (() => {
+ const m = obj(c.chunkMeans);
+ const w = m.worst && typeof m.worst === "object" ? obj(m.worst) : null;
+ return {
+ chunkMeans: {
+ count: num(m.count),
+ sigmaK: num(m.sigmaK),
+ margin: num(m.margin),
+ worst: w ? { chunk: num(w.chunk), plane: strOr(w.plane), mean: num(w.mean), centre: num(w.centre), floor: num(w.floor) } : null,
+ exempt: Array.isArray(m.exempt) ? m.exempt.map((x) => ({ chunk: num(obj(x).chunk), plane: strOr(obj(x).plane), why: strOr(obj(x).why) })) : [],
+ },
+ };
+ })()
+ : {}),
},
chunks: num(r.chunks),
};
diff --git a/common/lib/savedVideoCompaction.test.ts b/common/lib/savedVideoCompaction.test.ts
@@ -226,11 +226,11 @@ test("E1: a good copy with two kinds of picture passes; a short defect in either
}
// Five-minute stretches alternating all hour long.
assert.equal(judgeWholeFile({ frames: make(0, true), tiles: [], chromaU: ones, chromaV: ones }, t).ok, true);
- // The whole-file floor of the round before rejected the 20% case; judged as
- // one neighbourhood it now passes too, on the webcam's own floor (F-a).
+ // Judged as one neighbourhood (the whole-file floor of the round before),
+ // the 20% case fails: one stretch is one run, not a recurring kind (G1).
const whole = judgeWholeFile({ frames: make(0.2), tiles: [], chromaU: ones, chromaV: ones }, { ...t, windowFrames: n });
- assert.equal(whole.ok, true, whole.why);
- assert.ok(whole.lowerState && Math.abs(whole.lowerState.share - 0.2) < 0.01, JSON.stringify(whole.lowerState));
+ assert.equal(whole.ok, false);
+ assert.equal(whole.lowerState, null);
});
// F-a: fast switching. A share (0.995) and a webcam (0.96) every 20 s fill each
@@ -270,3 +270,70 @@ test("F-a: a good copy switching every 20, 60 or 90 s passes; a short dip still
plain.fill(0.95, 1000 * fps, 1020 * fps);
assert.equal(judge(plain).ok, false);
});
+
+// G1: only SCENE STRUCTURE makes a lower kind of picture. A periodic fault of a
+// few seconds (a broken setting, a per-GOP fault) used to manufacture its own
+// lower state and pass; runs under 8 s never count, and a run on a chunk join
+// never counts. G2: every chunk against the others.
+test("G: a periodic short fault fails, a bad chunk fails, real scene structure passes", async () => {
+ const { judgeWholeFile } = await import("./compactMedia-server");
+ const fps = 30;
+ const jitter = (i: number) => (((i * 7919) % 11) - 5) * 0.0004;
+ const base = { minFrame: 0.9, meanFloor: 0.97, sigmaK: 8, sigmaMinMargin: 0.03, tileRunFrames: 2, fps, chromaMinFrame: 0.9, chromaMeanFloor: 0.97, windowFrames: 120 * fps };
+ const CH = 300 * fps; // 5-minute chunks
+ const make = (seconds: number, at: (t: number) => number) => Float32Array.from({ length: seconds * fps }, (_, i) => at(i / fps) + jitter(i));
+ const judge = (f: Float32Array, o: { u?: Float32Array; chunks?: boolean } = {}) => {
+ const ones = new Float32Array(f.length).fill(0.99);
+ const chunkStarts = Array.from({ length: Math.ceil(f.length / CH) }, (_, k) => k * CH);
+ return judgeWholeFile({ frames: f, tiles: [], chromaU: o.u ?? ones, chromaV: ones }, { ...base, expectedFrames: f.length, ...(o.chunks === false ? {} : { chunkStarts }) });
+ };
+ const H = 3600;
+ // The reviewer's periodic faults (one kind of picture): every one fails again.
+ for (const [on, period, lvl] of [[2, 8, 0.95], [2, 8, 0.93], [3, 10, 0.93], [2, 8, 0.91], [1, 4, 0.94]] as const) {
+ const v = judge(make(H, (t) => (t % period < on ? lvl : 0.995)));
+ assert.equal(v.ok, false, `${on}/${period} at ${lvl}`);
+ assert.equal(v.lowerState, null);
+ }
+ // Good copies: alternation every 10/20/60/90 s, a webcam opening or closing
+ // the file, a 20/30/45% webcam stretch, a game hour across several chunks.
+ for (const p of [10, 20, 60, 90]) {
+ const v = judge(make(H, (t) => (Math.floor(t / p) % 2 ? 0.96 : 0.995)));
+ assert.equal(v.ok, true, `alternating ${p} s: ${v.why}`);
+ assert.ok(v.chunks && v.chunks.worst === null);
+ }
+ assert.equal(judge(make(H, (t) => (t >= H - 50 ? 0.96 : 0.995))).ok, true);
+ assert.equal(judge(make(H, (t) => (t < 50 ? 0.96 : 0.995))).ok, true);
+ for (const share of [0.2, 0.3, 0.45]) assert.equal(judge(make(H, (t) => (t >= 1000 && t < 1000 + share * H ? 0.96 : 0.995))).ok, true, `${share}`);
+ const game = judge(make(4 * H, (t) => (t >= 4410 && t < 8010 ? 0.975 : 0.995)));
+ assert.equal(game.ok, true, game.why);
+ assert.ok(game.chunks!.exempt.some((x) => x.why === "no step at its joins"));
+ // 1 s dips still fail.
+ assert.equal(judge(make(H, (t) => (t >= 300 && t < 301 ? 0.95 : 0.995))).ok, false);
+ assert.equal(judge(make(H, (t) => (t >= 1022 && t < 1023 ? 0.92 : Math.floor(t / 20) % 2 ? 0.96 : 0.995))).ok, false);
+ // Bad chunks (20 chunks, one kind of picture): 1, 2, 4, 6 at 0.96/0.94/0.92 fail on the chunk check.
+ for (const lvl of [0.96, 0.94, 0.92]) {
+ for (const bad of [1, 2, 4, 6]) {
+ const at = new Set(Array.from({ length: bad }, (_, k) => 2 + k * 3));
+ const v = judge(make(20 * 300, (t) => (at.has(Math.floor(t / 300)) ? lvl : 0.995)));
+ assert.equal(v.ok, false, `${bad} at ${lvl}`);
+ assert.match(v.why!, /^chunk (3|6|9|12|15|18) of 20 .* on Y, below the other chunks' floor/);
+ // Without the chunk joins (the round before): a stretch longer than the window passed.
+ if (lvl !== 0.92) assert.equal(judge(make(20 * 300, (t) => (at.has(Math.floor(t / 300)) ? lvl : 0.995)), { chunks: false }).ok, true);
+ }
+ }
+ // Six bad chunks would be a tenth of the file in 3+ runs — a lower state of
+ // their own — but their runs sit on chunk joins: refused.
+ const six = judge(make(20 * 300, (t) => ([2, 5, 8, 11, 14, 17].includes(Math.floor(t / 300)) ? 0.96 : 0.995)));
+ assert.match(six.lowerStateRefused ?? "", /chunk join/);
+ // A chunk worse only in colour fails on that plane.
+ const f = make(20 * 300, () => 0.995);
+ const u = Float32Array.from({ length: f.length }, (_, i) => (Math.floor(i / CH) === 7 ? 0.965 : 0.99));
+ const c = judge(f, { u });
+ assert.equal(c.ok, false);
+ assert.match(c.why!, /^chunk 8 of 20 .* on U/);
+ // Bad chunks inside fast switching: the bad run merges with a webcam run at
+ // one end and sits on the join at the other — not a scene; it fails.
+ const alt = judge(make(20 * 300, (t) => (Math.floor(t / 300) === 6 ? 0.93 : Math.floor(t / 20) % 2 ? 0.96 : 0.995)));
+ assert.equal(alt.ok, false);
+ assert.match(alt.why!, /^chunk 7 of 20/);
+});
diff --git a/common/lib/savedVideoCompaction.ts b/common/lib/savedVideoCompaction.ts
@@ -56,6 +56,9 @@ export type SavedVideoCompactionSettings = {
wholeFileChromaMin: number;
wholeFileChromaMean: number;
wholeFileWindowSeconds: number;
+ wholeFileLowerRunSeconds: number;
+ wholeFileChunkSigmaK: number;
+ wholeFileChunkMargin: number;
availabilityMaxAgeDays: number;
dropOriginal: CompactionDropOriginal;
};
@@ -88,6 +91,9 @@ export const DEFAULT_SAVED_VIDEO_COMPACTION_SETTINGS: SavedVideoCompactionSettin
wholeFileChromaMin: 0.9,
wholeFileChromaMean: 0.97,
wholeFileWindowSeconds: 120,
+ wholeFileLowerRunSeconds: 8,
+ wholeFileChunkSigmaK: 4,
+ wholeFileChunkMargin: 0.02,
availabilityMaxAgeDays: 7,
dropOriginal: "keep",
};
@@ -125,6 +131,11 @@ export const SAVED_VIDEO_COMPACTION_SETTINGS_FIELD_DOCS: FieldDocs<SavedVideoCom
wholeFileChromaMean: "The colour planes' mean must reach this. Default 0.97 (good copy: 0.9986).",
wholeFileWindowSeconds:
"The NEIGHBOURHOOD the relative floor is taken over: each frame is judged against the frames in the half-window just before it and just after it (the lower of their two floors), so a stream alternating two kinds of picture (a webcam, a screen share) is judged stretch by stretch, not by the file's dominant mode. A short defect inside a steady stretch has that stretch on both sides and falls below it. A degraded stretch longer than the window looks steady to it: such a stretch is caught by the absolute per-frame floor, the tile grid, the mean floor, and the VMAF excerpts, one at least every window across the whole file. Default 120 s; 5–3600.",
+ wholeFileLowerRunSeconds:
+ "A file that keeps coming back to a lower-scoring kind of picture (a webcam between screen shares) judges a neighbourhood that is a fifth or more that kind by those frames alone. Only SCENES count toward that kind: runs of at least this many seconds below the split, at least 3 of them, at least a tenth of the file, and none beginning or ending on a chunk join (a bad chunk's signature). Shorter runs are judged by the stretch around them, so a fault of a few seconds every GOP never passes as a kind of picture. Default 8 (longer than one 5 s GOP, with margin); 1–600.",
+ wholeFileChunkSigmaK:
+ "EVERY CHUNK AGAINST THE OTHERS: each chunk's mean (grey, U and V) must reach the other chunks' median − max(this × their robust spread, wholeFileChunkMargin). A chunk below it fails unless the source explains it: most of it is the file's recurring lower kind of picture, or its joins show no drop (a harder scene runs across chunks; a bad chunk changes level at its joins). Default 4.",
+ wholeFileChunkMargin: "The least the per-chunk floor sits under the other chunks' median. Default 0.02.",
availabilityMaxAgeDays:
"How fresh the platform check must be for a video to count as still on its platform: an availability record written by a real check (not a backfill), public or unlisted, at most this many days old. Anything else counts as gone, and its original waits for a person's review. Default 7.",
dropOriginal:
@@ -172,6 +183,9 @@ export function sanitizeSavedVideoCompaction(value: unknown): SavedVideoCompacti
wholeFileChromaMin: clampNum(r.wholeFileChromaMin, d.wholeFileChromaMin, 0, 1),
wholeFileChromaMean: clampNum(r.wholeFileChromaMean, d.wholeFileChromaMean, 0, 1),
wholeFileWindowSeconds: clampNum(r.wholeFileWindowSeconds, d.wholeFileWindowSeconds, 1, 3600),
+ wholeFileLowerRunSeconds: clampNum(r.wholeFileLowerRunSeconds, d.wholeFileLowerRunSeconds, 1, 600),
+ wholeFileChunkSigmaK: clampNum(r.wholeFileChunkSigmaK, d.wholeFileChunkSigmaK, 1, 100),
+ wholeFileChunkMargin: clampNum(r.wholeFileChunkMargin, d.wholeFileChunkMargin, 0, 1),
availabilityMaxAgeDays: clampNum(r.availabilityMaxAgeDays, d.availabilityMaxAgeDays, 0, 365),
dropOriginal: (COMPACTION_DROP_ORIGINAL as readonly unknown[]).includes(r.dropOriginal)
? (r.dropOriginal as CompactionDropOriginal)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -37,8 +37,12 @@
robust spread over each frame's own two-minute neighbourhood (`wholeFileWindowSeconds`), so a stream alternating
two kinds of picture passes; a VMAF excerpt is laid at least every window. A file that keeps coming back to a
lower-scoring kind of picture (`lowerState` in the pointer) judges a neighbourhood that is a fifth or more that
- kind by those frames alone, so switching every 20 s passes too; a frame closing the file is judged by the last
- window. A negative plane score is read as one. Clearing a marker never removes one written after the check.
+ kind by those frames alone, so switching every 20 s passes too; only scenes count as such a kind (runs of 8 s
+ or more, `wholeFileLowerRunSeconds`, at least 3, none on a chunk join), so a fault of a few seconds every GOP
+ still fails. Every chunk is compared with the others (grey, U, V; `checks.chunkMeans`): a chunk evenly worse
+ than the rest fails unless the source explains it, and "after-verify" needs that record too. A frame closing
+ the file is judged by the last window. A negative plane score is read as one. Clearing a marker never removes
+ one written after the check.
- **ROLLBACK: do not roll the editor back past this release while `pnpm ops get kept-originals` lists anything.**
An older editor does not know `"keptAs": "original"` / `"former-original"`, would treat them as ordinary
alternates, and could prune or drop the only original.
diff --git a/settings.json.example b/settings.json.example
@@ -176,6 +176,9 @@
"wholeFileChromaMin": 0.9,
"wholeFileChromaMean": 0.97,
"wholeFileWindowSeconds": 120,
+ "wholeFileLowerRunSeconds": 8,
+ "wholeFileChunkSigmaK": 4,
+ "wholeFileChunkMargin": 0.02,
"availabilityMaxAgeDays": 7,
"dropOriginal": "keep"
},