Archilyzer · Source

archilyzer

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

commit b4fe08e1ae246ba973d626843f9d436a5ffacb78
parent 16d7fa8670a3fdbc29b2178fc94e72008f09a351
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed,  4 Nov 2026 19:15:12 -0500

umtool: test -- a chunked hard-cut master has no drift: the segments' pictures summed, each segment exactly the master's frames at its schedule's frame, its own tone playing just after its first frame (where the stream-copied concat, each file placed by its longer stream, is still playing the one before)

lane/join-continuity measured mid-7's master 0.33-0.385 s late on its
schedule by the end, from the concat demuxer; the chunked path lays every
segment frame-exact and pins its sound to its picture.

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

Diffstat:
Mumtool/report-to-video/chunked-encode.test.mjs | 31++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/umtool/report-to-video/chunked-encode.test.mjs b/umtool/report-to-video/chunked-encode.test.mjs @@ -367,7 +367,7 @@ function linkedSequence(dir, files, keys = null) { const R10 = { width: 64, height: 36, fps: 10, transition: 0, audioRate: 48000, audioChannels: 2, preset: "ultrafast", crf: 0, palette: { bg: "#101820" } }; -test("a chunked hard-cut deck build is the hard-cut concat and its overlay pass, frame for frame; the sound pinned to the picture", { skip: !have }, async () => { +test("a chunked hard-cut deck build is the hard-cut concat and its overlay pass, frame for frame, with NO drift: each segment at its own frame, its sound with it", { skip: !have }, async () => { const fps = 10; const dir = mkdtempSync(path.join(tmpdir(), "chunked-hc-")); const events = []; @@ -411,6 +411,35 @@ test("a chunked hard-cut deck build is the hard-cut concat and its overlay pass, assert.deepEqual(got.map((h, f) => (h === want[f] ? null : f)).filter((f) => f != null), [], "every frame is the overlay pass's"); // The sound pinned to the picture: as long as the cut, every segment's at its own frame. assert.ok(Math.abs(audioSeconds(chunked) - N / fps) < 0.03, `the sound runs the cut (${audioSeconds(chunked)} vs ${N / fps})`); + // NO DRIFT (lane/join-continuity: mid-7's master ran 0.33-0.385 s late on its schedule by the end, + // the concat demuxer placing each file by its longer stream). The master is the segments' + // pictures summed, frame for frame; each segment's first frame is at its schedule's frame and + // its own tone is playing just after it -- where the copied concat had the one before still. + const starts = lens.map((_, i) => lens.slice(0, i).reduce((a, b) => a + b, 0)); + // (Without the deck -- whose overlay converts every pixel through RGB -- the lossless master is the + // segments' own frames, exactly.) + const bareDir = path.join(dir, "bare"); + mkdirSync(bareDir); + const bare = path.join(bareDir, "bare.mp4"); + await chunkedConcat({ segments, render: R10, outPath: bare, workDir: bareDir, hardCut: true }); + const master = frameMd5(bare); + assert.equal(master.length, lens.reduce((a, b) => a + b, 0), "the master is the sum of the segments' pictures"); + segments.forEach((f, i) => { + assert.deepEqual(master.slice(starts[i], starts[i] + lens[i]), frameMd5(f), `segment ${i} is the master's frames ${starts[i]}-${starts[i] + lens[i] - 1}, exactly`); + }); + const toneAt = (file, at) => { + const r = spawnSync("ffmpeg", ["-v", "error", "-ss", String(at), "-t", "0.2", "-i", file, "-map", "0:a", "-ac", "1", "-ar", "48000", "-f", "s16le", "-"], { maxBuffer: 1 << 24 }); + const pcm = new Int16Array(r.stdout.buffer, r.stdout.byteOffset, r.stdout.length >> 1); + let z = 0; + for (let k = 1; k < pcm.length; k += 1) if ((pcm[k - 1] < 0) !== (pcm[k] < 0)) z += 1; + return z / 2 / (pcm.length / 48000); + }; + starts.forEach((s, i) => { + const hz = toneAt(chunked, s / fps + 0.05); + assert.ok(Math.abs(hz - (300 + 100 * i)) < 40, `segment ${i}'s sound starts with its picture (${hz.toFixed(0)} Hz, want ${300 + 100 * i})`); + }); + // (The copied concat, for contrast, is still playing segment 2's tone where segment 3's picture starts.) + assert.ok(Math.abs(toneAt(copied, starts[3] / fps + 0.05) - 600) >= 40, "the copy drifted"); const record = JSON.parse(readFileSync(path.join(dir, CHUNKS_DIR, CHUNKS_RECORD), "utf8")); // Anchored at each segment's start, a long one cut every 24 frames from it. assert.deepEqual(record.chunks.map((c) => [c.a, c.b]), [[0, 25], [25, 49], [49, 65], [65, 89], [89, 98], [98, 122], [122, 128]]);