# KORGI W6 — movie delivery receipt **Actor:** Helios (Cursor on Icarus). Not Loom. **Owner:** Mitchell Burns **Date:** 2026-09-13 **Branch:** `cursor/w6-movie-export-0101` **Worktree:** `/Users/icarus/.cursor/worktrees/korgi-w6-movie-export-20260913` **Remote:** `gdrive` only (`/Users/icarus/Projects/korgi-gdrive.git`). No origin. No FF `main`. No KORGI Railway. Trunk zip/tgz not overwritten. ## Context snapshot | Field | Value | |---|---| | `plan_branch` | `cursor/w6-movie-export-0101` | | `tip` | `a510023eb5268f00280707ffead0e3aee53220e1` | | `base` / `master_sha` | `4d355a5994467bbe64dc28b9b5817037e25a02ce` (W0 freeze; `4d355a5`) | | `sync_method` | bootstrap (isolated worktree from freeze tip); this follow-up stays on the same branch | | `colliding_prs` | W1 `cursor/w1-durable-host-0101`, W2 host/auth, W5 `cursor/w5-audio-import-0101` in flight. This chip did not edit `host/*`, `auth/*`, `wav.ts`, `actions/types.ts`, `evaluate-frame.ts`, or freeze docs. | | `blocking_owner_items` | Full-song solo MV (Mitchell). W1 envelope land. | | `non_claims` | See below. | Cheap gates below were run on `a510023eb5268f00280707ffead0e3aee53220e1`. A later docs-only stamp on this branch does not change encoder/mux/job bytes. Container/job work from `64b4b66` stands (WebM DocType, `V_VP9` + `A_OPUS`, cluster clamp, durable interrupt/resume, `parseWebmStrict` vs Packet F PCM). This follow-up replaces skip-all intra DC and the click/silence codebook as the **product** encode path. ## Encoder that actually shipped In-process **`korgi_movie.wasm`** (W5 pattern: wasm in-tree, no user-facing FFmpeg). | Piece | What | |---|---| | Wrapper | `crates/korgi-movie/korgi_movie.c` | | Video | libvpx VP9 encoder **and** decoder. Profile 0, 4:2:0, `VP9E_SET_LOSSLESS`, keyframe-only (`VPX_EFLAG_FORCE_KF`) | | Audio | libopus 48 kHz, 20 ms (`960` samples), `OPUS_APPLICATION_AUDIO`, 96 kbps | | Ship | `src/lib/korgi/native/korgi_movie.wasm` (Node tests) and `public/korgi-movie/korgi_movie.wasm` (Studio fetch) | | Glue | `src/lib/korgi/movie-wasm.ts` — `WebAssembly.Instance` + tiny `wasi_snapshot_preview1` stub (fd_*/path_open/proc_exit; **no filesystem**). Calls `_initialize`. | | Rebuild | `scripts/build-korgi-movie-wasm.sh` (wasi-sdk clang + prebuilt `libvpx.a`/`libopus.a`). libvpx WASI `setjmp` is the in-tree stub `crates/korgi-movie/include-stubs/setjmp.h` (happy path never longjmps; errors trap). | | Size | ~2.1 MiB wasm | TypeScript skip-all intra DC remains **`encodeVp9KeyframeSkipAllProbe`**. Click/silence codebook remains **`encodeOpusClickSilenceProbe` / `OPUS_PROBE_*`**. Product `encodeVp9Keyframe` / `encodeOpusPcm16` / `exportMovieWithSound` / `encodeMovieFromProject` do **not** call those probes. ## Pixel-check method Not a codec-spike DC field. 1. Packet B fixture: `drawingForEvaluatedFrame` + `renderFrame` at frame **0** (A1) and frame **2** (A2), 32×18 destination composite. 2. Product `encodeVp9Keyframe` (libvpx wasm) of each RGBA. 3. **Independent decode** of the bitstream via `korgi_vp9_decode_rgba` (libvpx decoder in the same wasm — round-trip through the compressed payload, not encoder internals). 4. Gates in `src/lib/korgi/export-pixels.test.ts`: - decoded unique RGB **> 1** (not a uniform DC block) - frame 0 payload ≠ skip-all probe; frame 0 ≠ frame 2 - **luma MAE ≤ 2** vs renderer using the same JPEG-Y (`(77R+150G+29B+128)>>8`) as the C converter - A1 shirt sample luma > empty; A2 shirt sample luma > empty **Near-exact (documented):** VP9 profile 0 is 4:2:0. Luma is lossless-matched (MAE ~0–0.2 on Packet B). Chroma is subsampled, so reconstructed **RGB is not bit-identical**. Alpha is flattened to 255 (VP9 profile 0 has no alpha). Host `ffmpeg` may decode `docs/oss/w6-export/w6-ffmpeg-8x8.webm` as extra evidence; it is **not** the product encoder and not required for the pixel gate. ## Sound-check method `src/lib/korgi/opus-pcm.test.ts` + export-job / mux tests: 48 kHz PCM click bed → `encodeOpusPcm16` (libopus wasm) → `decodeOpusPacketsToPcm16` → `clickTimesInPcm16` on **decoded PCM**. Packets are not the TOC `0xbc` codebook. Opus pre-skip (~312 samples / 6.5 ms) is inside the 40 ms click-time window. ## Codec spike (this host) | Probe | Result | |---|---| | Node | v22.23.1 | | `VideoEncoder` / `AudioEncoder` | **absent** | | Product video | in-process libvpx wasm `V_VP9` (lossless profile 0 keyframes of `renderFrame` RGBA) | | Product audio | in-process libopus wasm `A_OPUS` of project PCM (WAV 48 kHz until W5 rebase) | | FFmpeg on Icarus | present. **Not a product encoder.** Host-only fixture decode. LEDGER: skip FFmpeg. | | `ffmpegNotProduct` | `true` | | WebCodecs | optional browser fast path when `VideoEncoder` exists **and** there is no Opus track | | MP4 adapter | `src/lib/korgi/mp4-adapter.ts` status `unverified` | Bool coder goldens (skip-all probe only) unchanged: empty `0000`, skip+DC `6000`, alt64 `2aaaaaaaaaaaaaaa8000`. ## Container labeling | Path | DocType | Video | Audio | Reader | |---|---|---|---|---| | Product movie | `webm` | `V_VP9` | `A_OPUS` + OpusHead | `parseWebmStrict` | | Packet F probe | `matroska` | uncompressed dummy | `A_PCM/INT/LIT` | `parseMatroskaPcm`; **rejected** by `parseWebmStrict` | | PCM as WebM | refused | — | `muxProductWebm` throws | do not label PCM as ordinary WebM | Cluster law unchanged: SimpleBlock timecodes are signed int16 relative to Cluster Timestamp. New cluster before overflow (`MUX_TIMECODE_LIMIT_MS = 30000`, clamp at 32767). Do not “fix” by removing the clamp. 34s and 90s files use **≥2 clusters**. ## Job durability `submitExportJob` writes status `request` (pin + `projectJson` + asset bytes + **libopus** packets) **before** picture encode. IndexedDB `korgi-export-jobs` in the browser; `memoryExportStore` in tests. Pin: `documentFingerprint`, `journalSeq`, `takeRevision` (takes + celColumns), `audioRevision`, start/end. Flow: request → running (per-frame checkpoint of libvpx keyframes) → artifact. `interruptAfter` stops mid-encode; a **fresh** store hydrated from JSON (no original-tab memory) `resumeExportJob`s to artifact. Closing a tab does not discard a submitted request. Browser WebCodecs is an optional fast path, not the only route. Not a second production document. Until W1 lands, mux/job call current `executeAction` / `drawingForEvaluatedFrame` / `projectFromPersisted`. ## Studio / GUI Export movie is always enabled. `startDeskMovie` passes `assetBytes` + `journalSeq`. Frames go through `drawingForEvaluatedFrame` + `renderFrame` then libvpx wasm. Imported clips mix via `parseWav` (W5 import path; this chip does not edit `wav.ts`). **GUI was not driven.** Headless `exportMovieWithSound` / `encodeMovieFromProject` and mux/job/pixel tests are the proof. Do not claim a live Studio click. ## Tests (this tip; do not sum historical packet greens) ```bash npx tsc --noEmit node --experimental-strip-types --test \ src/lib/korgi/mux-webm-av.test.ts \ src/lib/korgi/evaluate-frame.test.ts \ src/lib/korgi/export-job.test.ts \ src/lib/korgi/export-pixels.test.ts \ src/lib/korgi/opus-pcm.test.ts \ src/lib/korgi/vp9-bool.test.ts \ src/lib/korgi/vp9-encode.test.ts \ src/lib/stage-render.test.ts ``` | # | Case | Result | |---|---|---| | 1 | 10s WebM-strict VP9+Opus; picture from `renderFrame`; clicks from decoded Opus PCM | pass (`w6-10s-vp9-opus.webm`) | | 2 | ≥34s cluster rollover | pass; `maxAbsMs > 32767`; ≥2 clusters; relative int16 in range | | 3 | 90s synthetic soundtrack duration | pass; duration ≥ 89000; decoded-PCM clicks at 45s and 89s | | 4 | Seek begin/mid/end | pass; all independent keyframes (headless `playbackAnchors`, not a GUI player) | | 5 | Audio presence / duration / sync | pass; OpusHead; libopus packets of real PCM (not codebook TOC) | | 6 | Worker interrupt/resume | pass; JSON dump into a fresh store; artifact WebM-strict; decoded Opus clicks | | — | Pixel: frame 0 + later frame vs `renderFrame` luma; not DC | pass (`export-pixels.test.ts`) | | — | Opus from 48 kHz click PCM, not click TOC | pass (`opus-pcm.test.ts`) | | — | `importWav` 48 kHz → headless export | pass | | — | Packet F PCM remains Matroska | pass; not the product movie | | — | Product mux refuses PCM | pass | | — | ffmpeg decode 8×8 product WebM when present | pass on this host | ## Files (this follow-up) **New:** `crates/korgi-movie/korgi_movie.c`, `crates/korgi-movie/include-stubs/setjmp.h`, `scripts/build-korgi-movie-wasm.sh`, `src/lib/korgi/movie-wasm.ts`, `src/lib/korgi/native/korgi_movie.wasm`, `public/korgi-movie/korgi_movie.wasm`, `export-pixels.test.ts`, `opus-pcm.test.ts`. **Edited:** `vp9-encode.ts`, `vp9-encode.test.ts`, `opus-encode.ts`, `export-job.ts`, `export-job.test.ts`, `mux-webm-av.test.ts`, this receipt, regenerable `docs/oss/w6-export/*.webm`. **Did not edit:** `src/lib/korgi/host/*`, `actions/types.ts`, `mcp/server.ts`, `evaluate-frame.ts` (called only), `src/lib/auth/*`, `wav.ts`, freeze docs (`ASTRA_DESIGN.md`, contract, handback JSON). ## non_claims - Full-song solo MV still needs Mitchell. **10s is not acceptance.** 90s is a synthetic click bed, not a song. - VP9 RGB is **near-exact** (4:2:0 + opaque flatten), not bit-identical RGBA. Luma vs `renderFrame` is the pixel gate. - PCM Packet F is **not** the product movie. - MP4 / H.264 / AAC / ProRes / FFmpeg-in-product: not claimed. MP4 adapter stays `unverified`. - GUI click in Studio was not driven this chip. - W1 durable host envelope is not this tip. No second document. W5 audio import is not rebased here; WAV 48 kHz PCM is enough. - No PixelLab spend. No Railway. No `main` fast-forward. No trunk zip overwrite. No origin. - Do not add Packet A–F historical greens to this chip. Helios, Icarus, 2026-09-13.