Skip to content

Agent Skill for 15–90 s motion graphics, promo and character videos: reference analysis, seven stage gates, Remotion and HyperFrames engines.

Unify video verification and clarify the public skill README (#11)

Unclejobs4ecc008845c7
diff --git a/README.ko.md b/README.ko.md
index 063c3b6..74d5970 100644
--- a/README.ko.md
+++ b/README.ko.md
@@ -6,7 +6,7 @@
![레퍼런스를 재고, 7단계 게이트를 거쳐, 같은 목표값으로 mp4를 판정하는 흐름](docs/assets/hero.ko.png)
-15~90초 모션 그래픽, 홍보 영상, 캐릭터 영상을 만드는 Agent Skill이에요. 에이전트가 7단계로 작업하고, 단계마다 스크립트가 결과를 검사해요. 통과해야 다음 단계로 넘어가요.
+15~90초 모션 그래픽, 홍보 영상, 캐릭터 영상을 만드는 Agent Skill이에요. 에이전트가 7단계로 작업하고, 단계마다 스크립트가 결과를 검사해요. 통과해야 다음 단계로 넘어가요. 마지막에는 완성본을 잰 결과를 표 하나로 보여 주고, 화면과 소리는 사람이 직접 확인해요.
Codex, Claude Code 등 Agent Skills를 읽는 런타임에서 쓸 수 있어요.
@@ -48,6 +48,13 @@ Node.js 24 이상, ffmpeg, Python 3, Bash가 필요해요. Windows에서는 WSL
종료 코드 `0`이면 다음 단계로 가요. `1`이면 `qa/gate-<단계>.txt`에 적힌 줄을 고치고 다시 돌려요. 클립 1초 뒤에 얼굴이 달라지는 것처럼 눈으로만 볼 수 있는 문제도 있어요. 이런 항목은 사람이 프레임 스트립을 보고 검토 기록을 남겨야 통과해요.
+## 결과를 검증하는 방법
+
+`scripts/verify.sh`가 최종 믹스까지 들어간 완성본을 검사하고, 값싼 검사부터 표 하나로 보여 줘요. 표는 영상 옆 `qa/VERIFY.md`에도 남아요. [명령, 기준과 검증 범위](docs/verification.md).
+- **기계가 재는 것**: 모든 프레임이 디코딩되는지, 프레임률과 해상도가 맞는지, 소리와 화면 길이가 같은지, 평균 음량이 −14 LUFS 근처이고 가장 큰 소리가 −1 dBTP 아래인지 봐요. Remotion 작업이면 장면이 바뀔 때 화면 요소가 끊기지 않고 이어지는지(carry)도 재요. 촬영 영상 위에 그래픽을 얹는 계획을 주면 두 그래픽 사이로 원본이 비치지 않는지, 카드가 9초를 넘지 않는지도 봐요.
+- **사람이 보는 것**: 숫자로 판단할 수 없는 컷 타이밍, 잘린 글자, 달라진 얼굴, 믹스 소리예요. 표에는 이걸 볼 컨택트 시트(영상 전체를 작은 프레임으로 늘어놓은 한 장)와 마지막 프레임이 나와요. 이 줄은 늘 LOOK이고 PASS가 되지 않아요. 최종 게이트는 검수 기록을 남겨야 통과해요.
+- **새 검사는 처음엔 경고만 해요**(`observe`). 실제 작업에서 써 본 뒤에야 진행을 막는 검사(`enforce`)로 바꿔요.
+
## 데모 돌려 보기
Remotion으로 5초짜리 타이포그래피 영상을 렌더해요. 30초쯤 걸려요.
diff --git a/README.md b/README.md
index 62dc75f..fdd7b36 100644
--- a/README.md
+++ b/README.md
@@ -6,7 +6,7 @@
![Measure the reference, pass seven gated stages, judge the mp4 against the same targets](docs/assets/hero.png)
-An Agent Skill for 15–90 second motion graphics, promo and character videos. The agent works in seven stages. After each stage a script checks the output, and the next stage waits until it passes.
+An Agent Skill for 15–90 second motion graphics, promo and character videos. The agent works in seven stages. After each stage a script checks the output, and the next stage waits until it passes. At the end, one table shows what was measured in the finished file; a person still looks at the picture and listens to the sound.
Works in Codex, Claude Code and other runtimes that read Agent Skills.
@@ -48,6 +48,13 @@ The agent asks six questions first: where the video goes, length and aspect rati
Exit code `0` means move on. Exit code `1` means fix the lines listed in `qa/gate-<stage>.txt` and run the gate again. Some things only eyes can judge, such as a face drifting a second into a clip. Those pass only after someone looks at the frame strips and writes a review.
+## How results are verified
+
+`scripts/verify.sh` checks the finished video, final mix included, and prints one table, cheapest checks first. It saves the table as `qa/VERIFY.md` beside the video. [Commands, limits and coverage](docs/verification.md).
+- **The machine measures the file**: every frame decodes, frame rate and size are right, sound and picture have the same length, average loudness is near −14 LUFS and the loudest peak stays under −1 dBTP. For a Remotion production it also checks that something on screen carries over each scene change instead of a bare jump. Given a plan for graphics laid over filmed footage, it checks that the footage never flashes between two graphics and that no card stays over 9 seconds.
+- **A person checks what numbers can't**: cut timing, clipped text, a face that changes, how the mix sounds. For this the table links a contact sheet (small frames across the whole video) and the last frame. Those rows say LOOK, never PASS, and the final gate waits for a written review.
+- **New checks only warn at first** (`observe`). They block a run (`enforce`) only after they have been tried on real work.
+
## Try the demo
This renders a 5-second typography clip with Remotion. It takes about 30 seconds.
diff --git a/docs/runtimes.md b/docs/runtimes.md
index 8e1ee90..cae4eff 100644
--- a/docs/runtimes.md
+++ b/docs/runtimes.md
@@ -73,7 +73,7 @@ For a personal Codex installation, set `SKILL_ROOT="$HOME/.agents/skills/motion-
- Image/video/music/voice generation requires separately available services or tools. A web subscription does not imply API access. If tools are absent, the agent provides prompts and target filenames; the user generates and supplies the files.
- If the runtime cannot view frame strips or contact sheets, the user must inspect them and provide actual review results. Never manufacture a `REVIEWED` record from measurements alone. Scripts cannot judge character deformation in later frames.
- Use the provided `STORY.md` template's Korean field names and table headings: the current gate reads those names. Fill values in the user's language. For a non-Korean character description, include `#RRGGBB` codes alongside color names so the current color check can recognize them.
-- Remotion is a company-size licensed package (organizations of four or more employees need a Company License); HyperFrames is Apache-2.0. Voice automation (`vo.mjs`) needs the user's own composio CLI connection and spends their credits. Whisper transcription integration in `verify.sh` remains unverified. Check external service pricing and license terms immediately before work, as described in `NOTICE.md` and the licensing reference.
+- Remotion is a company-size licensed package (organizations of four or more employees need a Company License); HyperFrames is Apache-2.0. Voice automation (`vo.mjs`) needs the user's own composio CLI connection and spends their credits. The verifier does not run Whisper automatically; transcript comparison remains a separate task. Check external service pricing and license terms immediately before work, as described in `NOTICE.md` and the licensing reference.
## Known limitations
@@ -84,6 +84,8 @@ For a personal Codex installation, set `SKILL_ROOT="$HOME/.agents/skills/motion-
## Verification scope
+The current verification command, observe/enforce modes and synthetic test coverage are in [verification.md](verification.md). The media gate is shared by both engines; a copied Remotion engine needs `--skill-root` (or exported `SKILL_ROOT`) to locate it. The historical installer/render checks below were not repeated for the verification update.
+
Checks on 2026-10-25 (macOS, Node.js 24.20.0, Python 3.14.8), run on a `git archive` export of the committed branch so no local `node_modules` could ride along:
- `npx [email protected] add <local export> --skill motion-video-production --agent codex claude-code -y` exited 0 into a project path containing a space. All 76 skill files arrived in `.agents/skills/motion-video-production` (the same file list as the source, 45 of them under `engines/`), with Claude Code as a symlink. Only these two `--agent` identifiers were run; runtime discovery inside the apps was not re-checked for this version.
diff --git a/docs/verification.md b/docs/verification.md
new file mode 100644
index 0000000..4ddd7c9
--- /dev/null
+++ b/docs/verification.md
@@ -0,0 +1,57 @@
+# How results are verified
+
+The stage gate remains the source of truth. The Remotion pipeline's `verify.mjs` adds one ordered table around it, not another implementation of frame counts or loudness. It also works on HyperFrames output. No render, dependency install, transcription or paid call runs during verification.
+
+## Run
+
+From any directory, using the actual installed skill path:
+
+```bash
+bash "$SKILL_ROOT/scripts/verify.sh" "$PROJECT_ROOT/out/final.mp4" --project "$PROJECT_ROOT"
+# Inspect the LOOK images and play the cuts and audio. Record the actual review, then:
+python3 "$SKILL_ROOT/harness/gate.py" final "$PROJECT_ROOT"
+```
+
+From a copied Remotion engine:
+
+```bash
+npm run verify -- --production productions/carry-demo --video renders/carry-demo/final.mp4 --skill-root "$SKILL_ROOT"
+```
+
+The video must already exist and include the final mix. `--project` reads the expected length, fps and dimensions from that project's `edit.json`. `--production` reads its declared `track.ts` for carry and media expectations. When both are given, the project's edit contract wins for media. Without either, frame count is compared only to the stream header; target resolution and fps are SKIP. That cannot detect a shortened file whose header also changed.
+
+## The table
+
+| Order | Checks | Default |
+|---|---|---|
+| 0 | Engine tests, including synthetic timeline cases | enforce |
+| 1 | Carry (something on screen survives each scene change); optional overlay joins, card holds and chapter bridges | carry enforce; new timeline checks observe |
+| 2 | Decoded frames, audio stream, resolution, fps, audio/video length | existing gate checks enforce; new nominal/average rate comparison observe |
+| 3 | Integrated loudness and true peak | existing gate checks enforce |
+| 4 | Optional picture samples near joins, compared with bare footage | observe |
+| 5 | Contact sheet (at most 60 tiles) and last frame | LOOK, never PASS |
+
+New checks start in **observe**: a failure becomes WARN without changing the exit code. Promote them only after checking false positives on representative work. Modes and new thresholds live in `skills/motion-video-production/engines/remotion/pipeline/verify-limits.json`. Existing media calculations and audio limits stay in `harness/gate.py`: −14 ±1.5 LUFS, true peak ≤ −1 dBTP, A/V difference ≤0.1 s. Existing `GATE_LUFS`, `GATE_LUFS_TOL` and `GATE_TP_MAX` overrides still apply. One loudness target applies to every video; there are no per-format profiles.
+
+An enforced failure exits 1 and stops after its cost tier; `--all` continues through all tiers. Invalid inputs exit 2. WARN and SKIP are not proof that a check passed. `qa/VERIFY.md` beside the video records the command, commit, table, and video mtime/size. Re-run after re-encoding. It does not replace `qa/review.md`: the final gate still requires a real, fresh human review.
+
+`--plan <json>` enables pure overlay checks: no exposed gap under 2 s, cards at most 9 s, no source pause stacked with a held card, and chapter bridges at least 3.5 s. `--src <footage.mp4>` additionally compares join windows in a one-chapter plan at 344×216 gray, warning above 18 dB PSNR. See the installed [plan schema and commands](../skills/motion-video-production/references/verification.md). Actual compositor rows are preferable; a calculated plan only verifies a render if the compositor uses those same rows.
+
+## What remains human or unmeasured
+
+Inspect text clipping, overlaps, identity drift and the final frame. Play the cuts and listen to the mix. Whether a shot fits the words or the music feels balanced is not a numerical verdict. Never write a review for frames or audio you did not inspect. After three failed fix attempts on the same check, report what was tried and what still fails.
+
+Picture sampling does not cover every frame. Windows crossing inserted source pauses are skipped and counted; multiple chapters need separate one-chapter checks. Cropping or retiming the source invalidates the comparison. Nominal/average frame-rate comparison is not a full timestamp scan. Short-shot detection, section-by-section music levels and render determinism are not included.
+
+The previous shell verifier's informational checksum repeats, edge RGB samples and automatic Whisper call are no longer run. Check moving repeats in playback/strips and compare a separate transcript to the script when needed.
+
+## Test the checks
+
+No npm install is needed:
+
+```bash
+bash skills/motion-video-production/harness/selftest.sh
+(cd skills/motion-video-production/engines/remotion && npm test)
+```
+
+Selftest includes the existing synthetic media defects, timeline editor tests, skill path/name checks, engine tests and small generated-video tests of the table/wrapper and copied engine. Fixtures contain no real production media. A synthetic selftest is not end-to-end validation of a generated video or of every supported agent runtime.
diff --git a/skills/motion-video-production/SKILL.md b/skills/motion-video-production/SKILL.md
index 1721a38..ea5b333 100644
--- a/skills/motion-video-production/SKILL.md
+++ b/skills/motion-video-production/SKILL.md
@@ -140,7 +140,7 @@ python3 "$SKILL_ROOT/harness/gate.py" <단계> "$PROJECT_ROOT"
- 목소리는 대사를 먼저 생성하고 길이를 잰 뒤 타이밍을 정합니다(`pipeline/vo.mjs`, `pipeline/vo-assemble.mjs`, composio CLI. `references/providers.md`). 크레딧이 드므로 생성 전에 사용자에게 알립니다.
- 음악은 `node pipeline/score.mjs productions/<id>`의 기본 스코어로 시작하거나, `templates/MUSIC_BRIEF.md`로 워커에게 맡깁니다.
- 믹스와 mux는 `bash "$SKILL_ROOT/scripts/mix-mux.sh" <picture.mp4> <fps> <초> <music.wav> <vo.wav|-> <out.mp4>`로 합니다. 프레임 수가 맞을 때만 mux하고, 대사가 나올 때 음악을 낮춥니다.
-- 최종 확인은 `bash "$SKILL_ROOT/scripts/verify.sh" <mp4>`(`PRODUCTION=productions/<id>`를 주면 carry 검사도 함께)로 하고, 생성된 컨택트 시트를 직접 봅니다. 레퍼런스가 있으면 `gate.py ref`로 비교합니다.
+- 최종 확인은 `bash "$SKILL_ROOT/scripts/verify.sh" <mp4> --project "$PROJECT_ROOT"`로 합니다. Remotion은 `PRODUCTION=productions/<id>`를 더하면 carry도 함께 검사합니다. 테스트 → 계획 → 기존 미디어 게이트 → 이음새 그림 → LOOK 순서의 표와 영상 옆 `qa/VERIFY.md`가 생깁니다. 새 검사는 observe로 시작하며 WARN·SKIP은 통과 근거가 아닙니다. LOOK 이미지를 실제로 보고 검수 기록을 남긴 뒤 `gate.py final`을 실행합니다. 레퍼런스가 있으면 `gate.py ref`도 비교합니다. 계획 형식과 모드·한계는 `references/verification.md`에 있습니다.
### 타임라인 편집기 (조립 뒤 사람이 직접 고칠 때)
- 만든 영상을 사용자가 타임라인으로 보고 고치게 하려면 `node "$SKILL_ROOT/timeline/serve.mjs" "$PROJECT_ROOT"`를 실행합니다. 브라우저에 영상·텍스트·목소리·음악 네 트랙이 뜹니다. Node 표준 라이브러리와 ffmpeg만 씁니다(설치 없음).
@@ -170,7 +170,7 @@ python3 "$SKILL_ROOT/harness/gate.py" <단계> "$PROJECT_ROOT"
- 눈으로 보지 않은 것을 통과로 보고하지 않습니다. "렌더가 끝났다"는 통과의 근거가 아닙니다.
- 측정할 수 있는 것은 측정합니다: 프레임 수, 길이, 라우드니스(LUFS), true peak, 받아쓰기 일치 여부. 하네스가 있는 단계는 하네스의 종료 코드로 판정합니다.
- 직접 들어 보지 않은 오디오를 들었다고 보고하지 않습니다. 받아쓰기와 라우드니스로 확인했다고 보고합니다.
-- 결과 보고에는 측정 수치, 고친 것, 남은 결함, 산출물 위치를 포함합니다.
+- 결과 보고에는 측정 수치, 고친 것, 남은 결함, 산출물 위치와 검사하지 못한 것(WARN·SKIP·눈 검수 여부)을 포함합니다. 같은 검사에서 세 번 고쳐도 실패하면 시도한 것과 남은 실패를 사용자에게 보고합니다.
하네스 검사가 없는 실수는 `references/pitfalls.md`, 도구별 사용법은 `references/providers.md`를 참고합니다.
@@ -183,7 +183,7 @@ python3 "$SKILL_ROOT/harness/gate.py" <단계> "$PROJECT_ROOT"
| `clipsheet.sh` | 프레임 시트(클립의 모든 프레임을 6x5 칸으로 배치) |
| `key-plate.sh` | 초록 배경 -> 투명 PNG |
| `mix-mux.sh` | 음악·대사 믹스와 프레임 수 게이트 mux |
-| `verify.sh` | 영상 측정, 반복 프레임, 가장자리 색, 컨택트 시트, 받아쓰기, 선택적 carry 검사 |
+| `verify.sh` | 기존 미디어 게이트·carry·오버레이 검사를 한 표로, 컨택트 시트·마지막 프레임과 VERIFY.md |
| `beat-grid.py` | BPM 기준 박 길이·스냅 계산 |
| `../harness/gate.py` | 단계별 통과 여부를 종료 코드로 판정 |
| `../timeline/serve.mjs`, `apply.mjs`, `build.mjs` | 타임라인 편집기, 에이전트용 편집 CLI, edit.json → mp4 빌드 |
diff --git a/skills/motion-video-production/engines/remotion/package.json b/skills/motion-video-production/engines/remotion/package.json
index 1fdac93..0d73869 100644
--- a/skills/motion-video-production/engines/remotion/package.json
+++ b/skills/motion-video-production/engines/remotion/package.json
@@ -12,7 +12,8 @@
"test": "node --test 'motions/**/*.test.ts' 'pipeline/**/*.test.ts' 'productions/**/*.test.ts'",
"typecheck": "tsc --noEmit",
"render": "node pipeline/render.mjs",
- "probe": "node pipeline/probe.mjs"
+ "probe": "node pipeline/probe.mjs",
+ "verify": "node pipeline/verify.mjs"
},
"dependencies": {
"@fontsource/jetbrains-mono": "5.3.0",
diff --git a/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.test.ts b/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.test.ts
new file mode 100644
index 0000000..2fa0401
--- /dev/null
+++ b/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.test.ts
@@ -0,0 +1,58 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { bridge, cards, composed, finalTime, joinRows, noPeek, peekSpots, validatePlan } from './timeline-gates.ts';
+import type { Chapter, Plan, Row } from './timeline-gates.ts';
+
+const rows: Row[] = [
+ { id: 'title', start: 0, length: 4, clip: 4, fadeIn: false, fadeOut: true },
+ { id: 'detail', start: 4.5, length: 4, clip: 4, fadeIn: true, fadeOut: true },
+];
+const chapter: Chapter = { n: 1, length: 12, pauses: [], rows };
+const plan: Plan = { fps: 30, fadeIn: 0.2, fadeOut: 0.2, chapters: [chapter] };
+
+test('an exposed half-second join fails; holding until the next overlay is opaque passes', () => {
+ assert.match(noPeek(chapter, rows, plan)[0].message, /between title and detail/);
+ const held = joinRows(rows, plan);
+ assert.deepEqual(noPeek(chapter, held, plan), []);
+ assert.deepEqual(cards(chapter, held, plan), []);
+ assert.equal(rows[0].length, 4);
+ assert.equal(held[0].fadeOut, false);
+ assert.ok(held[0].length >= 4.7);
+ assert.deepEqual(peekSpots(held), [4.5, 0, held[0].length]);
+});
+
+test('a 15-second pause card fails; a 9-second card passes', () => {
+ const ch = { ...chapter, rows: [], pauses: [{ at: 5, seconds: 15, id: 'card' }] };
+ assert.match(cards(ch, [], plan)[0].message, /15.0 s > 9 s/);
+ assert.deepEqual(cards({ ...ch, pauses: [{ ...ch.pauses[0], seconds: 9 }] }, [], plan), []);
+});
+
+test('a source pause and a held card cannot stack even below nine seconds', () => {
+ const ch = { ...chapter, pauses: [{ at: 5, seconds: 2, id: 'title' }] };
+ const held = [{ ...rows[0], length: 6 }];
+ assert.match(cards(ch, held, plan)[0].message, /pause and the held title/);
+});
+
+test('a 2-second bridge fails; a 3.5-second bridge passes', () => {
+ assert.match(bridge({ ...chapter, bridgeAfter: 2 }, plan)[0].message, /2 s < 3.5 s/);
+ assert.deepEqual(bridge({ ...chapter, bridgeAfter: 3.5 }, plan), []);
+});
+
+test('items are composed at chapter edges and pauses map source to final time', () => {
+ const ch: Chapter = { n: 2, length: 12, offset: 20, pauses: [{ at: 3, seconds: 2, id: 'pause' }],
+ items: [{ id: 'title', start: 0.5, end: 2, clip: 2 }] };
+ const [row] = composed(ch, plan);
+ assert.equal(row.start, 0);
+ assert.equal(row.fadeIn, false);
+ assert.equal(row.fadeOut, false);
+ assert.equal(finalTime(ch, 4, 30), 26);
+});
+
+test('plan validation rejects invalid timing, unordered rows and missing fields', () => {
+ assert.doesNotThrow(() => validatePlan(plan));
+ for (const bad of [null, {}, { ...plan, fps: 0 }, { ...plan, chapters: [] },
+ { ...plan, chapters: [{ ...chapter, rows: rows.toReversed() }] },
+ { ...plan, chapters: [{ ...chapter, rows: [{ ...rows[0], length: -1 }] }] }]) {
+ assert.throws(() => validatePlan(bad));
+ }
+});
diff --git a/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.ts b/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.ts
new file mode 100644
index 0000000..87baa51
--- /dev/null
+++ b/skills/motion-video-production/engines/remotion/pipeline/timeline-gates.ts
@@ -0,0 +1,138 @@
+// Pure checks over chapter-source seconds: covered joins, bounded cards and chapter bridges.
+// shortcut: short shots after an overlay need source cut times; add that check when plans carry them.
+import { readFileSync } from 'node:fs';
+
+export const TIMELINE: { joinGap: number; cardMax: number; bridgeMin: number } =
+ JSON.parse(readFileSync(new URL('./verify-limits.json', import.meta.url), 'utf8')).timeline;
+
+/** a motion as planned: shown from start to end (null = its clip length); a clip shorter than that holds its last frame */
+export type Item = { id: string; start: number; end: number | null; clip: number };
+/** a motion as composed: length past `clip` is the held last frame */
+export type Row = { id: string; start: number; length: number; clip: number; fadeIn: boolean; fadeOut: boolean };
+/** the source stops at `at` (video and audio) while clip `id` plays full frame for `seconds` */
+export type Pause = { at: number; seconds: number; id: string };
+export type Chapter = { n: number; length: number; offset?: number; bridgeAfter?: number; pauses: Pause[]; items?: Item[]; rows?: Row[] };
+export type Plan = { fps: number; fadeIn: number; fadeOut: number; chapters: Chapter[] };
+export type Gate = 'no-peek' | 'card' | 'bridge';
+export type Failure = { gate: Gate; n: number; t: number; message: string };
+
+export const REASON: Record<Gate, string> = {
+ 'no-peek': 'a flash of source footage between overlays reads as a broken cut',
+ card: 'long or stacked holds make a card linger',
+ bridge: 'a chapter bridge needs time to read',
+};
+
+/** Validate external JSON before timing arithmetic; explicit rows must be in compositor order. */
+export function validatePlan(value: unknown): asserts value is Plan {
+ const p = value as Plan;
+ const num = (x: unknown, min = 0): x is number => typeof x === 'number' && Number.isFinite(x) && x >= min;
+ const valid = p && num(p.fps, 1) && num(p.fadeIn) && num(p.fadeOut) && Array.isArray(p.chapters) && p.chapters.length > 0 &&
+ p.chapters.every((ch) => ch && num(ch.n, 1) && num(ch.length, 0.001) &&
+ (ch.offset === undefined || num(ch.offset)) && (ch.bridgeAfter === undefined || num(ch.bridgeAfter)) &&
+ Array.isArray(ch.pauses) && ch.pauses.every((s) => s && typeof s.id === 'string' && num(s.at) && s.at <= ch.length && num(s.seconds, 0.001)) &&
+ (Array.isArray(ch.rows) || Array.isArray(ch.items)) &&
+ (ch.rows === undefined || (Array.isArray(ch.rows) && ch.rows.every((r, i) => r && typeof r.id === 'string' &&
+ num(r.start) && r.start < ch.length && num(r.length, 0.001) && num(r.clip, 0.001) &&
+ typeof r.fadeIn === 'boolean' && typeof r.fadeOut === 'boolean' && (i === 0 || r.start >= ch.rows![i - 1].start)))) &&
+ (ch.items === undefined || (Array.isArray(ch.items) && ch.items.every((it) => it && typeof it.id === 'string' &&
+ num(it.start) && it.start < ch.length && num(it.clip, 0.001) && (it.end === null || num(it.end, it.start + 0.001))))));
+ if (!valid) throw new Error('invalid timeline plan: see references/verification.md for the schema');
+}
+
+const pausePoints = (ch: Chapter, fps: number) => ch.pauses.map((p) => ({ ...p, at: Math.round(p.at * fps) / fps }));
+
+/** where chapter time t lands in the final file: chapter offset (0 if unset) + pauses inserted before t */
+export const finalTime = (ch: Chapter, t: number, fps: number) =>
+ (ch.offset ?? 0) + t + pausePoints(ch, fps).filter((p) => p.at < t).reduce((sum, p) => sum + p.seconds, 0);
+
+function where(ch: Chapter, t: number, fps: number): string {
+ const head = `ch${ch.n} ${t.toFixed(2)} s`;
+ if (ch.offset === undefined) return head;
+ const s = Math.round(finalTime(ch, t, fps) * 10) / 10;
+ return `${head} (final ${Math.floor(s / 60)}:${(s % 60).toFixed(1).padStart(4, '0')})`;
+}
+
+/** Items → rows, snapped to chapter edges and pause points. */
+export function placeRows(ch: Chapter, plan: Plan): Row[] {
+ const D = ch.length, gap = TIMELINE.joinGap, f = 1 / plan.fps;
+ const rows = (ch.items ?? []).map((it): Row => ({
+ id: it.id, start: it.start, length: Math.min(it.end === null ? it.clip : it.end - it.start, D - it.start), clip: it.clip, fadeIn: true, fadeOut: true,
+ })).sort((a, b) => a.start - b.start);
+ const pauses = pausePoints(ch, plan.fps);
+ for (const r of rows) {
+ if (r.start < gap) { r.length += r.start; r.start = 0; r.fadeIn = false; } // chapter opens on this motion
+ if (D - (r.start + r.length) < gap) { r.length = D - r.start; r.fadeOut = false; } // chapter closes on it
+ for (const { at } of pauses) {
+ const end = r.start + r.length;
+ if ((at - end >= 0 && at - end < gap) || (r.start < at && at <= end)) { r.length = at - r.start + f; r.fadeOut = false; } // runs into the pause
+ if (r.start - at >= 0 && r.start - at < gap) { r.length += r.start - at; r.start = at; r.fadeIn = false; } // right after it
+ }
+ }
+ return rows;
+}
+
+/** The hold/join step: a motion less than joinGap before the next holds (no fade-out) until the next is opaque. */
+export function joinRows(rows: Row[], plan: Plan): Row[] {
+ const out = rows.map((r) => ({ ...r }));
+ for (let i = 0; i + 1 < out.length; i++) {
+ const a = out[i], b = out[i + 1];
+ if (b.start - (a.start + a.length) < TIMELINE.joinGap) { a.length = b.start + plan.fadeIn + 1 / plan.fps - a.start; a.fadeOut = false; }
+ }
+ return out;
+}
+
+export const composed = (ch: Chapter, plan: Plan): Row[] => ch.rows ?? joinRows(placeRows(ch, plan), plan);
+
+/** (a) footage must not show between two motions, at a chapter edge next to a motion, or between a motion and a pause. */
+export function noPeek(ch: Chapter, rows: Row[], plan: Plan): Failure[] {
+ const D = ch.length, gap = TIMELINE.joinGap, out: Failure[] = [];
+ const fail = (t: number, what: string) => out.push({ gate: 'no-peek', n: ch.n, t, message: `${where(ch, t, plan.fps)}: footage shows ${what} — ${REASON['no-peek']}` });
+ for (let i = 0; i + 1 < rows.length; i++) {
+ const a = rows[i], b = rows[i + 1], end = a.start + a.length, g = b.start - end;
+ if (!(g >= gap || (!a.fadeOut && end >= b.start + plan.fadeIn)))
+ fail(end, `between ${a.id} and ${b.id} (${g.toFixed(2)} s apart, ${a.id} not held until ${b.id} is opaque)`);
+ }
+ for (const r of rows) {
+ const end = r.start + r.length;
+ if (r.start > 0 && r.start < gap) fail(0, `before ${r.id} at the chapter start`);
+ if (D - end > 0 && D - end < gap && r.fadeOut) fail(end, `after ${r.id} at the chapter end`);
+ }
+ for (const { at } of pausePoints(ch, plan.fps)) for (const r of rows) {
+ const end = r.start + r.length;
+ if (at - end > 0 && at - end < gap && r.fadeOut) fail(end, `between ${r.id} and the pause at ${at.toFixed(2)} s`);
+ if (r.start - at > 0 && r.start - at < gap) fail(at, `between the pause at ${at.toFixed(2)} s and ${r.id}`);
+ }
+ return out;
+}
+
+/** (b) a card = a motion's held last frame plus any source pause that touches that motion. */
+export function cards(ch: Chapter, rows: Row[], plan: Plan): Failure[] {
+ const f = 1 / plan.fps, out: Failure[] = [];
+ const fail = (t: number, what: string) => out.push({ gate: 'card', n: ch.n, t, message: `${where(ch, t, plan.fps)}: ${what} — ${REASON.card}` });
+ const pauses = pausePoints(ch, plan.fps), used = new Set<Pause>();
+ rows.forEach((r, i) => {
+ const next = rows[i + 1]; // frames under the next motion are covered by it, not a card
+ const held = Math.max(0, Math.min(r.length, next && next.start < r.start + r.length ? next.start - r.start : Infinity) - r.clip);
+ const touching = pauses.filter((p) => r.start - f <= p.at && p.at <= r.start + r.length + f);
+ touching.forEach((p) => used.add(p));
+ const paused = touching.reduce((s, p) => s + p.seconds, 0), shown = held + paused;
+ const t = Math.min(r.start + Math.min(r.clip, r.length), ...touching.map((p) => p.at));
+ if (held > f && paused > 0) fail(t, `the source pause and the held ${r.id} share one card (pause ${paused.toFixed(1)} s + held ${held.toFixed(1)} s)`);
+ if (shown > TIMELINE.cardMax) fail(t, `card ${r.id} shown ${shown.toFixed(1)} s > ${TIMELINE.cardMax} s (held ${held.toFixed(1)} s + pause ${paused.toFixed(1)} s)`);
+ });
+ for (const p of pauses) if (!used.has(p) && p.seconds > TIMELINE.cardMax) fail(p.at, `pause card ${p.id} shown ${p.seconds.toFixed(1)} s > ${TIMELINE.cardMax} s`);
+ return out;
+}
+
+/** (c) the bridge (loading screen) after a chapter. */
+export function bridge(ch: Chapter, plan: Plan): Failure[] {
+ if (ch.bridgeAfter === undefined || ch.bridgeAfter >= TIMELINE.bridgeMin) return [];
+ return [{ gate: 'bridge', n: ch.n, t: ch.length, message: `${where(ch, ch.length, plan.fps)}: bridge after ch${ch.n} is ${ch.bridgeAfter} s < ${TIMELINE.bridgeMin} s — ${REASON.bridge}` }];
+}
+
+/** Chapter times where footage could flash in the render : joined starts, a chapter opening
+ * on a motion, and every motion end without a fade-out. The picture leg of verify compares frames there. */
+export function peekSpots(rows: Row[]): number[] {
+ const joins = rows.slice(1).filter((b, i) => b.start - (rows[i].start + rows[i].length) < 0.05).map((b) => b.start);
+ return [...joins, ...rows.filter((r) => r.start === 0).map((r) => r.start), ...rows.filter((r) => !r.fadeOut).map((r) => r.start + r.length)];
+}
diff --git a/skills/motion-video-production/engines/remotion/pipeline/verify-limits.json b/skills/motion-video-production/engines/remotion/pipeline/verify-limits.json
new file mode 100644
index 0000000..5f8d858
--- /dev/null
+++ b/skills/motion-video-production/engines/remotion/pipeline/verify-limits.json
@@ -0,0 +1,21 @@
+{
+ "modes": {
+ "tests": "enforce",
+ "carry": "enforce",
+ "no-peek": "observe",
+ "card": "observe",
+ "bridge": "observe",
+ "picture-peek": "observe",
+ "cfr": "observe",
+ "frames": "enforce",
+ "audio-stream": "enforce",
+ "resolution": "enforce",
+ "fps": "enforce",
+ "av-length": "enforce",
+ "loudness": "enforce",
+ "true-peak": "enforce"
+ },
+ "timeline": { "joinGap": 2, "cardMax": 9, "bridgeMin": 3.5 },
+ "picture": { "peekDb": 18, "size": "344x216" },
+ "look": { "width": 390, "maxTiles": 60 }
+}
diff --git a/skills/motion-video-production/engines/remotion/pipeline/verify.mjs b/skills/motion-video-production/engines/remotion/pipeline/verify.mjs
new file mode 100644
index 0000000..5d581c7
--- /dev/null
+++ b/skills/motion-video-production/engines/remotion/pipeline/verify.mjs
@@ -0,0 +1,155 @@
+// One table over the existing media gate and engine checks, cheapest first. No rendering or paid calls.
+import { execFileSync, spawnSync } from 'node:child_process';
+import { existsSync, mkdirSync, readFileSync, statSync, writeFileSync } from 'node:fs';
+import { basename, dirname, extname, join, resolve } from 'node:path';
+import { pathToFileURL } from 'node:url';
+import { parseArgs } from 'node:util';
+import { CARRY, probe } from './carry.ts';
+import { REASON, bridge, cards, composed, finalTime, noPeek, peekSpots, TIMELINE, validatePlan } from './timeline-gates.ts';
+
+const root = resolve(import.meta.dirname, '..');
+const L = JSON.parse(readFileSync(new URL('./verify-limits.json', import.meta.url), 'utf8'));
+let a;
+try {
+ ({ values: a } = parseArgs({ options: {
+ production: { type: 'string' }, video: { type: 'string' }, project: { type: 'string' },
+ plan: { type: 'string' }, src: { type: 'string' }, 'skill-root': { type: 'string' }, all: { type: 'boolean' },
+ } }));
+} catch (e) { console.error(e.message); process.exit(2); }
+const sh = (cmd, args) => execFileSync(cmd, args, { encoding: 'utf8', maxBuffer: 1 << 26, timeout: 120000, stdio: ['ignore', 'pipe', 'pipe'] });
+const video = a.video ? resolve(a.video) : a.project ? resolve(a.project, 'out/final.mp4') : null;
+const skill = resolve(a['skill-root'] ?? process.env.SKILL_ROOT ?? join(root, '../..'));
+let film, plan, contract = {};
+try {
+ if (video && !existsSync(video)) throw new Error('video does not exist');
+ if (a.src && (!video || !a.plan || !existsSync(resolve(a.src)))) throw new Error('--src needs an existing source file, --video (or --project), and --plan');
+ if (a.production) ({ film } = await import(pathToFileURL(resolve(a.production, 'track.ts')).href));
+ if (film) contract = { fps: film.fps, width: film.width, height: film.height, cuts: [{ t: 0, d: film.seconds }] };
+ if (a.project) contract = JSON.parse(readFileSync(resolve(a.project, 'edit.json'), 'utf8'));
+ if (a.plan) { plan = JSON.parse(readFileSync(resolve(a.plan), 'utf8')); validatePlan(plan); }
+ if (video && !existsSync(join(skill, 'harness/gate.py'))) throw new Error('set --skill-root to the installed skill folder (the shared media gate is required)');
+} catch (e) { console.error(e.message); process.exit(2); }
+
+const media = {};
+const measure = (stage) => {
+ if (media[stage]) return media[stage];
+ const r = spawnSync('python3', [join(skill, 'harness/gate.py'), 'media', video, stage], {
+ input: JSON.stringify(contract), encoding: 'utf8', timeout: 120000, maxBuffer: 1 << 26,
+ });
+ if (r.error || ![0, 1].includes(r.status)) throw new Error(r.error?.message ?? `media gate failed: ${r.stderr.trim()}`);
+ media[stage] = JSON.parse(r.stdout);
+ return media[stage];
+};
+const mediaLeg = (leg, id) => ({ leg, reason: `shared gate ${id}`, run() {
+ if (!video) return { status: 'skip', measured: 'no video' };
+ const { checks, limits } = measure(['F05', 'F06'].includes(id) ? 'audio' : 'container');
+ const c = checks.find((c) => c.id === id);
+ if (!c) return { status: 'fail', measured: checks.find((c) => c.level === 'BLOCK')?.message ?? `${id} not measured` };
+ if ((id === 'F04' && (!contract.width || !contract.height)) || (id === 'F08' && !contract.fps))
+ return { status: 'skip', measured: c.message, limit: 'no external target; use --project or --production' };
+ return { status: id === 'F11' && c.level === 'WARN' ? 'fail' : { PASS: 'pass', WARN: 'warn', BLOCK: 'fail' }[c.level],
+ measured: c.message, limit: limits[id] ?? (id === 'F02' ? (contract.cuts?.length ? 'project/production length' : 'stream header only') : '') };
+} });
+const gateLeg = (leg, limit, check) => ({ leg, reason: REASON[leg], run() {
+ if (!plan) return { status: 'skip', measured: 'no --plan' };
+ const failures = plan.chapters.flatMap((ch) => check(ch, composed(ch, plan), plan));
+ return { status: failures.length ? 'fail' : 'pass', measured: `${failures.length} failures`, limit, details: failures.map((f) => f.message) };
+} });
+
+const tiers = [
+ [0, [{ leg: 'tests', reason: 'engine unit checks', run() {
+ const r = spawnSync('npm', ['test', '--silent'], { cwd: root, encoding: 'utf8', timeout: 120000 });
+ const n = (k) => (r.stdout + r.stderr).match(new RegExp(`(?:ℹ|#) ${k} (\\d+)`))?.[1] ?? '?';
+ return { status: r.status === 0 ? 'pass' : 'fail', measured: `${n('pass')} pass, ${n('fail')} fail`, limit: '0 fail',
+ details: r.status === 0 ? [] : [(r.stdout + r.stderr).trim()] };
+ } }]],
+ [1, [
+ { leg: 'carry', reason: 'an element must survive each declared boundary', run() {
+ if (!film) return { status: 'skip', measured: 'no --production' };
+ const r = probe(film);
+ return { status: r.verdict, measured: `${r.score ?? 'n/a'} over ${r.considered} boundaries`, limit: `fail < ${CARRY.fail}, warn < ${CARRY.warn}` };
+ } },
+ gateLeg('no-peek', `overlays < ${TIMELINE.joinGap} s apart are held`, noPeek),
+ gateLeg('card', `card ≤ ${TIMELINE.cardMax} s; no pause plus hold`, cards),
+ gateLeg('bridge', `bridge ≥ ${TIMELINE.bridgeMin} s`, (ch, _rows, p) => bridge(ch, p)),
+ ]],
+ [2, [mediaLeg('frames', 'F02'), mediaLeg('audio-stream', 'F03'), mediaLeg('resolution', 'F04'),
+ mediaLeg('fps', 'F08'), mediaLeg('cfr', 'F11'), mediaLeg('av-length', 'F09')]],
+ [3, [mediaLeg('loudness', 'F05'), mediaLeg('true-peak', 'F06')]],
+ [4, [{ leg: 'picture-peek', reason: REASON['no-peek'], run() {
+ if (!video || !plan || !a.src) return { status: 'skip', measured: 'needs video, --plan and --src' };
+ if (plan.chapters.length !== 1) return { status: 'skip', measured: '--src pairs with a one-chapter plan' };
+ const ch = plan.chapters[0], fps = plan.fps, [w, h] = L.picture.size.split('x');
+ const spots = peekSpots(composed(ch, plan)), bad = new Map();
+ let samples = 0, skipped = 0;
+ for (const t of spots) {
+ const t0 = Math.max(0, t - 0.3), win = Math.min(0.8, ch.length - t0);
+ // shortcut: windows crossing inserted pauses are not time-aligned; skip until piecewise sampling is supported.
+ if (win <= 0 || ch.pauses.some((p) => p.at >= t0 && p.at <= t0 + win)) { skipped++; continue; }
+ const out = sh('ffmpeg', ['-v', 'error', '-ss', String(finalTime(ch, t0, fps)), '-t', String(win), '-i', video,
+ '-ss', String(t0), '-t', String(win), '-i', resolve(a.src), '-lavfi',
+ `[0:v]fps=${fps},scale=${w}:${h},format=gray,setpts=PTS-STARTPTS[x];[1:v]fps=${fps},scale=${w}:${h},format=gray,setpts=PTS-STARTPTS[y];[x][y]psnr=stats_file=-:shortest=1`, '-f', 'null', '-']);
+ const lines = out.split('\n').filter((l) => l.includes('psnr_avg:'));
+ if (!lines.length) throw new Error('no PSNR samples at a planned join');
+ samples += lines.length;
+ for (const line of lines) {
+ const db = Number(line.match(/psnr_avg:(\S+)/)[1].replace('inf', 'Infinity'));
+ if (Number.isNaN(db)) throw new Error('invalid PSNR measurement');
+ const tt = t0 + (Number(line.match(/n:(\d+)/)[1]) - 1) / fps;
+ if (db > L.picture.peekDb) bad.set(tt.toFixed(3), `${tt.toFixed(3)} s: ${db} dB`);
+ }
+ }
+ return { status: samples ? (bad.size ? 'fail' : 'pass') : 'skip', measured: `${bad.size} exposed frames; ${samples} samples; ${skipped} windows skipped`,
+ limit: `PSNR ≤ ${L.picture.peekDb} dB at ${L.picture.size} gray`, details: [...bad.values()] };
+ } }]],
+ [5, ['contact sheet', 'last frame'].map((leg) => ({ leg, reason: 'human review required; never a machine PASS', run() {
+ if (!video) return { status: 'skip', measured: 'no video' };
+ const qa = join(dirname(video), 'qa'), base = basename(video, extname(video));
+ mkdirSync(qa, { recursive: true });
+ const out = join(qa, `${base}.${leg === 'contact sheet' ? 'contact.jpg' : 'last.png'}`);
+ if (leg === 'contact sheet') {
+ const secs = Number(sh('ffprobe', ['-v', 'error', '-show_entries', 'format=duration', '-of', 'default=nw=1:nk=1', video]).trim());
+ if (!(secs > 0)) throw new Error('invalid video duration');
+ const fps = Math.min(2, L.look.maxTiles / secs), tiles = Math.ceil(secs * fps);
+ sh('ffmpeg', ['-v', 'error', '-y', '-i', video, '-vf', `fps=${fps},scale=${L.look.width}:-2,tile=6x${Math.ceil(tiles / 6)}`, '-frames:v', '1', out]);
+ } else {
+ sh('ffmpeg', ['-v', 'error', '-y', '-sseof', '-0.5', '-i', video, '-vf', `scale=${L.look.width}:-2`, '-update', '1', out]);
+ }
+ if (!existsSync(out)) throw new Error('review image was not produced');
+ return { status: 'look', measured: out };
+ } }))],
+];
+
+const rows = [];
+let failed = false, stoppedAt = null;
+for (const [tier, legs] of tiers) {
+ for (const { leg, reason, run } of legs) {
+ let r;
+ try { r = run(); } catch (e) { r = { status: 'fail', measured: `error: ${e.message.split('\n')[0]}` }; }
+ const mode = L.modes[leg] ?? (tier === 5 ? '' : 'enforce');
+ if (r.status === 'fail' && mode === 'observe') r.status = 'warn';
+ if (r.status === 'fail') failed = true;
+ rows.push({ tier, leg, mode, ...r, reason });
+ }
+ if (failed && !a.all) { stoppedAt = tier; break; }
+}
+const cell = (s) => String(s ?? '').replaceAll('|', '\\|').replaceAll('\n', ' ');
+const head = ['tier', 'check', 'mode', 'status', 'measured / artifact', 'limit', 'reason'];
+const table = [head, ...rows.map((r) => [r.tier, r.leg, r.mode, r.status.toUpperCase(), r.measured, r.limit, r.reason])]
+ .map((c) => `| ${c.map(cell).join(' | ')} |`);
+table.splice(1, 0, `|${head.map(() => '---').join('|')}|`);
+const tail = rows.flatMap((r) => (r.details ?? []).map((d) => `- ${r.leg}: ${d}`));
+if (stoppedAt !== null) tail.push(`Stopped after tier ${stoppedAt}; --all runs every tier.`);
+console.log([...table, ...tail].join('\n'));
+if (video) {
+ const git = (...args) => spawnSync('git', args, { cwd: root, encoding: 'utf8' }).stdout.trim();
+ const st = statSync(video), qa = join(dirname(video), 'qa');
+ mkdirSync(qa, { recursive: true });
+ writeFileSync(join(qa, 'VERIFY.md'), [`# VERIFY ${basename(video)}`, '',
+ `- commit: ${git('rev-parse', '--short', 'HEAD') || 'unavailable'}${git('status', '--porcelain', '--untracked-files=no') ? ' (uncommitted changes)' : ''}`,
+ `- command: node pipeline/verify.mjs ${process.argv.slice(2).join(' ')}`,
+ `- video: ${video}`, `- video mtime: ${st.mtime.toISOString()}, size: ${st.size} bytes`,
+ `- verdict: ${failed ? 'FAIL' : 'PASS'} (WARN/SKIP are not proof; LOOK needs human review)`, '', ...table, ...tail, ''].join('\n'));
+ console.log(`wrote ${join(qa, 'VERIFY.md')}`);
+}
+process.exit(failed ? 1 : 0);
diff --git a/skills/motion-video-production/harness/SMOKE.md b/skills/motion-video-production/harness/SMOKE.md
index f4a2053..38fd938 100644
--- a/skills/motion-video-production/harness/SMOKE.md
+++ b/skills/motion-video-production/harness/SMOKE.md
@@ -1,38 +1,27 @@
-# SMOKE — 유료 API 없이 실행 가능한 것 전수 테스트 (2026-10-23)
+# SMOKE — 유료 API 없이 실행 가능한 검사
-대상: `skills/motion-video-production/{scripts,templates,engines,templates}` 의 실행 파일.
-`engines/hyperframes/node_modules/**` 는 검사에서 제외했다(제3자 배포물).
+## 2026-11-17 검증 표 이식
-## python3 -I <script> --help
+macOS, Node 26.13.0, Python 3.15.2. 의존 설치·Remotion 렌더·유료 호출 없이 실행했습니다.
-| 명령 | 종료 코드 | 비고 |
-|---|---|---|
-| `python3 -I scripts/beat-grid.py --help` | 2 | 설계대로: 인자 오류 시 사용법 출력 후 2 (`gate.py` 와 같은 규약) |
-| `python3 -I scripts/dupcheck.py --help` | 2 | 수정 후. 수정 전에는 `--help` 를 파일로 열어 traceback(exit 1). `-h/--help` 를 사용법 출력으로 처리하게 고침 |
-| `python3 -I scripts/ref-analyze.py --help` | 1 | `ModuleNotFoundError: cv2`. 의존(`requirements-ref.txt`: opencv-python-headless, numpy)을 이 머신에 설치하지 않아 환경 문제. 스크립트 버그 아님 |
+| 명령 | 결과 |
+|---|---|
+| `bash harness/selftest.sh` | exit 0, 기존 합성 미디어 사례 55건 통과, ICC 사례 1건 건너뜀(Pillow 없음), 아래 Node 테스트도 실행 |
+| `node --test timeline/core.test.mjs harness/*.test.mjs` | 20 tests, 20 pass, 0 fail (타임라인 10, 경로·이름 3, 검증 표 7: 상위 묶음 1 + 사례 6) |
+| Remotion 엔진의 `npm test` | 21 tests, 21 pass, 0 fail (기존 15 + 합성 타임라인 6) |
+| 모든 배포 `.mjs`의 `node --check` | exit 0 |
+| `bash -n harness/selftest.sh scripts/verify.sh` | exit 0 |
+| `python3 -m py_compile harness/gate.py` | exit 0 |
-기능 확인(추가): `beat-grid.py grid 144 4` / `snap 144 1.7` exit 0, `dupcheck.py` 로 반복 컷 2개짜리 edit.json 이 REPEAT exit 1 정상 판정.
+검증 표 테스트는 작은 합성 영상으로 기존 셸 호출, 복사한 엔진, 프레임 수 실패와 조기 중단·`--all`, observe 경고, 노출된/덮인 이음새의 PSNR, 잘못된 입력, LOOK 이미지와 VERIFY.md 기록을 확인합니다. 경로 테스트는 스킬·레퍼런스·README에 백틱으로 적은 정적 배포 경로와 스킬 폴더/이름 일치를 확인합니다. 프로젝트 산출물, 명령, 글롭, 자리표시자 경로는 제외합니다.
-## node --check (.mjs/.js, node_modules 제외)
+기존 단계 게이트와 새 표는 같은 미디어 함수를 씁니다. 새 타임라인·그림·명목/평균 프레임률 검사는 observe이고, 기존 음량 기준과 검수 기록 요구는 유지했습니다.
-전부 exit 0: `engines/remotion/pipeline/{probe,render,score,vo,vo-assemble}.mjs`, `engines/remotion/productions/wordcut/{render,plan,drift,look,look-fit}.mjs`.
+확인하지 않은 것: 의존이 없는 상태의 TypeScript 전체 타입 검사, 설치기·런타임 발견 재검사, Remotion 렌더, 외부 생성, 오디오 청취, 실제 작품에 맞춘 PSNR 보정. 이전 `verify.sh`의 반복 체크섬·가장자리 RGB·자동 받아쓰기는 새 표에서 실행하지 않습니다. 명령과 한계는 `references/verification.md`에 있습니다.
-## bash -n
+## 이전 검사 (2026-10-23)
-전부 exit 0: `harness/selftest.sh`, `scripts/{verify,mix-mux,clipsheet,key-plate}.sh`.
-
-## 문서화된 셀프테스트
-
-`bash harness/selftest.sh` — 약 2분 소요, exit 0, ok 55건 / FAIL 0건, `skip ICC 회귀 사례 (PIL 없음)`.
-(처음 120초 제한으로 돌았을 때는 타임아웃처럼 보였지만 실제로는 정상 완료 작업이었다.)
-
-`python3 -I harness/gate.py` (인자 없음) — 사용법 출력 exit 2, 정상.
-
-## 고친 것
-
-- `scripts/dupcheck.py`: `-h`/`--help` 를 사용법 출력으로 처리(수정 전 traceback).
-
-## 발견했지만 그대로 둔 것
-
-- `ref-analyze.py` 는 cv2·numpy 설치가 필요하다(이 머신에 없음). 설치하면 재검사 필요.
-- `selftest.sh` 의 ICC 회귀 사례는 PIL 이 없어 건너뛴다.
+- `python3 -I scripts/beat-grid.py --help`, `dupcheck.py --help`: 사용법 출력 exit 2. beat-grid의 grid/snap은 exit 0, 반복 컷은 dupcheck exit 1.
+- `ref-analyze.py --help`: cv2 미설치로 exit 1. OpenCV와 numpy 설치 후 재검사 필요.
+- 당시 배포 `.mjs` 구문 검사와 셸 `bash -n`: exit 0.
+- 당시 `harness/selftest.sh`: exit 0, ok 55건, ICC 회귀는 Pillow가 없어 건너뜀.
diff --git a/skills/motion-video-production/harness/gate.py b/skills/motion-video-production/harness/gate.py
index 2bc12c3..e8953e9 100644
--- a/skills/motion-video-production/harness/gate.py
+++ b/skills/motion-video-production/harness/gate.py
@@ -38,10 +38,12 @@ IMG = {".png", ".jpg", ".jpeg", ".webp"}
class Report:
def __init__(self):
self.lines = []
+ self.checks = []
self.blocks = 0
def add(self, level, cid, msg):
self.lines.append(f"{level:5} {cid} {msg}")
+ self.checks.append({"level": level, "id": cid, "message": msg})
if level == "BLOCK":
self.blocks += 1
@@ -384,33 +386,41 @@ def g_edit(root, r):
f"{f.name} 은 {have:.2f}초인데 컷이 {need:.2f}초 지점까지 사용함 - 클립이 모자람")
-def g_final(root, r):
- f = root / "out" / "final.mp4"
- if not r.check(f.exists(), "F01", "out/final.mp4 있음", "out/final.mp4 없음"):
+def g_media(f, e, r):
+ """Shared final-file measurements. The table runner supplies an edit/production contract on stdin."""
+ if not r.check(f.is_file(), "F01", "영상 파일 있음", "영상 파일 없음"):
return
- e = (load_json(root / "edit.json", Report(), "-") or {})
- fps = e.get("fps", 30)
cuts = e.get("cuts", [])
secs = max((c["t"] + c["d"] for c in cuts), default=None)
- v = (probe(f, "stream=codec_type,width,height,r_frame_rate,duration").get("streams") or [])
+ v = (probe(f, "stream=codec_type,width,height,r_frame_rate,avg_frame_rate,duration").get("streams") or [])
vid = next((s for s in v if s.get("codec_type") == "video"), {})
aud = next((s for s in v if s.get("codec_type") == "audio"), None)
- if secs:
- got = run(["ffprobe", "-v", "error", "-count_frames", "-select_streams", "v:0", "-show_entries",
- "stream=nb_read_frames", "-of", "default=nw=1:nk=1", str(f)]).stdout.strip()
- r.check(got.isdigit() and int(got) == round(fps * secs), "F02", f"프레임 {got}개 = {fps}fps x {secs:.2f}초",
- f"프레임 {got}개, 기대 {round(fps*secs)}개 - 렌더가 끊겼거나 길이가 다름")
+ num, den = (vid.get("r_frame_rate") or "0/1").split("/")
+ stream_fps = float(num) / float(den or 1)
+ fps = e.get("fps", stream_fps)
+ secs = secs if secs is not None else float(vid.get("duration") or 0)
+ got = run(["ffprobe", "-v", "error", "-count_frames", "-select_streams", "v:0", "-show_entries",
+ "stream=nb_read_frames", "-of", "default=nw=1:nk=1", str(f)]).stdout.strip()
+ r.check(fps > 0 and secs > 0 and got.isdigit() and int(got) == round(fps * secs), "F02",
+ f"프레임 {got}개 = {fps}fps x {secs:.2f}초",
+ f"프레임 {got}개, 기대 {round(fps*secs)}개 - 렌더가 끊겼거나 길이가 다름")
r.check(aud is not None, "F03", "오디오 스트림 있음", "오디오 스트림 없음")
wh = (vid.get("width"), vid.get("height"))
- want = (e.get("width", 1920), e.get("height", 1080))
+ want = (e.get("width", vid.get("width")), e.get("height", vid.get("height")))
r.check(wh == want, "F04", f"해상도 {wh}", f"해상도 {wh}, 기대 {want}")
num, den = (vid.get("r_frame_rate") or "0/1").split("/")
got_fps = float(num) / float(den or 1)
r.check(abs(got_fps - fps) < 0.01, "F08", f"fps {got_fps:g}", f"fps {got_fps:g}, edit.json 은 {fps}")
+ avg_num, avg_den = (vid.get("avg_frame_rate") or "0/1").split("/")
+ avg_fps = float(avg_num) / float(avg_den or 1)
+ (r.ok if abs(avg_fps - got_fps) < 0.01 else r.warn)("F11", f"일정 프레임률 참고: r={got_fps:g}, avg={avg_fps:g}")
if aud is not None:
vd, ad = float(vid.get("duration") or 0), float(aud.get("duration") or 0)
r.check(abs(vd - ad) <= 0.1 and (not secs or abs(ad - secs) <= 1.5 / fps + 0.05), "F09",
f"오디오 {ad:.2f}초, 영상 {vd:.2f}초", f"오디오 {ad:.2f}초와 영상 {vd:.2f}초가 맞지 않음 - 오디오가 일찍 끝나거나 길이가 다름")
+
+
+def g_loudness(f, r):
out = run(["ffmpeg", "-hide_banner", "-i", str(f), "-af", "ebur128=peak=true", "-f", "null", "-"]).stderr
seg = out[out.rfind("Summary"):]
li = re.search(r"I:\s+(-?[0-9.]+) LUFS", seg)
@@ -421,6 +431,15 @@ def g_final(root, r):
r.check(float(tp.group(1)) <= TP_MAX, "F06", f"true peak {tp.group(1)} dBFS", f"true peak {tp.group(1)} dBFS > {TP_MAX}")
else:
r.block("F05", "라우드니스 측정 실패(오디오 없음?)")
+
+
+def g_final(root, r):
+ f = root / "out" / "final.mp4"
+ if not r.check(f.exists(), "F01", "out/final.mp4 있음", "out/final.mp4 없음"):
+ return
+ e = load_json(root / "edit.json", Report(), "-") or {}
+ g_media(f, {"fps": 30, "width": 1920, "height": 1080, **e}, r)
+ g_loudness(f, r)
rv = root / "qa" / "review.md"
ok = reviewed(rv) and len([ln for ln in rv.read_text(encoding="utf-8").splitlines() if ln.strip() and not ln.startswith("REVIEWED:")]) >= 1
r.check(ok, "F07", "qa/review.md 에 REVIEWED 줄과 본 결과가 있음",
@@ -434,6 +453,24 @@ STAGES = {"ref": g_ref, "story": g_story, "character": g_character, "keyframes":
def main(argv):
+ # Internal bridge for verify.mjs; existing final checks remain the source of truth.
+ if len(argv) == 4 and argv[1] == "media" and argv[3] in ("container", "audio"):
+ r = Report()
+ try:
+ e = json.load(sys.stdin)
+ if not isinstance(e, dict):
+ raise ValueError("expected a JSON object")
+ if argv[3] == "container":
+ g_media(Path(argv[2]), e, r)
+ else:
+ g_loudness(Path(argv[2]), r)
+ except (ValueError, TypeError, KeyError, ZeroDivisionError) as err:
+ r.block("F01", f"media contract/measurement error: {err}")
+ print(json.dumps({"checks": r.checks, "limits": {
+ "F05": f"{LUFS_TARGET} ± {LUFS_TOL} LUFS", "F06": f"≤ {TP_MAX} dBTP",
+ "F09": "A/V difference ≤ 0.1 s; audio within 1.5 frames + 0.05 s of expected length",
+ }}, ensure_ascii=False))
+ return 1 if r.blocks else 0
if len(argv) < 2 or argv[1] not in (*STAGES, "all"):
print(__doc__)
return 2
diff --git a/skills/motion-video-production/harness/selftest.sh b/skills/motion-video-production/harness/selftest.sh
index b397440..0da3940 100644
--- a/skills/motion-video-production/harness/selftest.sh
+++ b/skills/motion-video-production/harness/selftest.sh
@@ -149,7 +149,8 @@ fi
# 타임라인 코어(편집기·에이전트 CLI·빌드가 같이 쓰는 순수 함수)
if command -v node >/dev/null; then
- if node --test "$HERE/../timeline/core.test.mjs" >/dev/null 2>&1; then echo "ok 타임라인 코어 테스트"; else echo "FAIL 타임라인 코어 테스트 (node --test timeline/core.test.mjs)"; fails=$((fails+1)); fi
+ if node --test "$HERE/../timeline/core.test.mjs" "$HERE/"*.test.mjs; then echo "ok 타임라인·스킬 경로·검증 표 테스트"; else echo "FAIL 타임라인·스킬 경로·검증 표 테스트"; fails=$((fails+1)); fi
+ if (cd "$HERE/../engines/remotion" && npm test); then echo "ok Remotion 엔진 테스트"; else echo "FAIL Remotion 엔진 테스트"; fails=$((fails+1)); fi
else
echo "skip 타임라인 코어 테스트 (node 없음)"
fi
diff --git a/skills/motion-video-production/harness/skills-check.test.mjs b/skills/motion-video-production/harness/skills-check.test.mjs
new file mode 100644
index 0000000..e793df2
--- /dev/null
+++ b/skills/motion-video-production/harness/skills-check.test.mjs
@@ -0,0 +1,29 @@
+// Check shipped source paths, not project outputs, commands, placeholders or glob examples.
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { existsSync, readdirSync, readFileSync } from 'node:fs';
+import { basename, dirname, join, resolve } from 'node:path';
+
+const skill = resolve(import.meta.dirname, '..');
+const repo = resolve(skill, '../..');
+const engine = join(skill, 'engines/remotion');
+const docs = [join(skill, 'SKILL.md'), ...readdirSync(join(skill, 'references')).filter((f) => f.endsWith('.md')).map((f) => join(skill, 'references', f)),
+ ...['README.md', 'README.ko.md', 'docs/runtimes.md'].map((f) => join(repo, f)).filter(existsSync)];
+const path = /^(skills|docs|references|templates|harness|scripts|engines|timeline|motions|pipeline|productions|src)\/[\w./-]+$/;
+
+function missingPaths(text, doc) {
+ return [...text.matchAll(/`([^`\n]+)`/g)].map((m) => m[1])
+ .filter((token) => path.test(token) && ![repo, skill, engine, dirname(doc)].some((base) => existsSync(join(base, token))));
+}
+
+test('every literal shipped path named in the skill, references and READMEs exists', () => {
+ assert.deepEqual(docs.flatMap((doc) => missingPaths(readFileSync(doc, 'utf8'), doc).map((p) => `${doc}: ${p}`)), []);
+});
+
+test('the path check catches stale paths and ignores commands and output placeholders', () => {
+ assert.deepEqual(missingPaths('`pipeline/missing.mjs` `pipeline/<id>.mjs` `node pipeline/missing.mjs` `out/final.mp4`', docs[0]), ['pipeline/missing.mjs']);
+});
+
+test('the skill folder name matches its frontmatter name', () => {
+ assert.equal(readFileSync(join(skill, 'SKILL.md'), 'utf8').match(/^name:\s*(.+)$/m)?.[1].trim(), basename(skill));
+});
diff --git a/skills/motion-video-production/harness/verify.test.mjs b/skills/motion-video-production/harness/verify.test.mjs
new file mode 100644
index 0000000..2aad51b
--- /dev/null
+++ b/skills/motion-video-production/harness/verify.test.mjs
@@ -0,0 +1,91 @@
+import { test } from 'node:test';
+import assert from 'node:assert/strict';
+import { execFileSync, spawnSync } from 'node:child_process';
+import { cpSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
+import { tmpdir } from 'node:os';
+import { basename, join, resolve } from 'node:path';
+
+const skill = resolve(import.meta.dirname, '..');
+const scratch = tmpdir();
+mkdirSync(scratch, { recursive: true });
+const work = mkdtempSync(join(scratch, 'verify-'));
+const ff = (...args) => execFileSync('ffmpeg', ['-v', 'error', '-y', ...args], { timeout: 30000 });
+const edit = { fps: 30, width: 320, height: 180, cuts: [{ t: 0, d: 2 }] };
+const row = { id: 'card', start: 0, length: 2, clip: 2, fadeIn: false, fadeOut: false };
+const plan = { fps: 30, fadeIn: 0.2, fadeOut: 0.2, chapters: [{ n: 1, length: 2, pauses: [], rows: [row] }] };
+const json = (name, value) => writeFileSync(join(work, name), JSON.stringify(value));
+const run = (args, command = ['node', join(skill, 'engines/remotion/pipeline/verify.mjs')]) => {
+ const r = spawnSync(command[0], [...command.slice(1), ...args], { encoding: 'utf8', timeout: 60000 });
+ assert.ifError(r.error);
+ return r;
+};
+
+test('the table reuses the final gate, reports observe failures, and works from a copied engine', async (t) => {
+ try {
+ mkdirSync(join(work, 'out'));
+ const video = join(work, 'out/final.mp4');
+ ff('-f', 'lavfi', '-i', 'color=black:s=320x180:r=30:d=2', '-f', 'lavfi', '-i', 'sine=f=440:d=2',
+ '-af', 'loudnorm=I=-14:TP=-1.5:LRA=9', '-c:v', 'libx264', '-pix_fmt', 'yuv420p', '-c:a', 'aac', '-shortest', video);
+ json('edit.json', edit); json('plan.json', plan);
+ await t.test('existing shell entry point writes PASS, LOOK artifacts and a file stamp', () => {
+ const r = run([video, '--project', work], ['bash', join(skill, 'scripts/verify.sh')]);
+ assert.equal(r.status, 0, r.stdout + r.stderr);
+ const report = readFileSync(join(work, 'out/qa/VERIFY.md'), 'utf8');
+ assert.match(report, /verdict: PASS/);
+ assert.match(report, /video mtime: .*size: \d+ bytes/);
+ assert.match(report, /loudness \| enforce \| PASS/);
+ assert.match(report, /contact sheet \| \| LOOK/);
+ assert.ok(existsSync(join(work, 'out/qa/final.last.png')));
+ });
+ await t.test('a truncated contract fails the shared frame gate and stops before LOOK', () => {
+ json('edit.json', { ...edit, cuts: [{ t: 0, d: 3 }] });
+ const r = run(['--project', work]);
+ assert.equal(r.status, 1, r.stdout + r.stderr);
+ assert.match(r.stdout, /frames \| enforce \| FAIL/);
+ assert.doesNotMatch(r.stdout, /contact sheet \|/);
+ assert.doesNotMatch(r.stdout, /loudness \|/);
+ const all = run(['--project', work, '--all']);
+ assert.equal(all.status, 1, all.stdout + all.stderr);
+ assert.match(all.stdout, /contact sheet \| \| LOOK/);
+ json('edit.json', edit);
+ });
+ await t.test('unsafe overlay joins, long cards and short bridges warn without blocking', () => {
+ json('plan.json', { ...plan, chapters: [{ n: 1, length: 12, bridgeAfter: 2,
+ pauses: [{ at: 10, seconds: 15, id: 'pause-card' }], rows: [
+ { ...row, length: 4, clip: 4, fadeOut: true },
+ { ...row, id: 'next', start: 4.5, length: 4, clip: 4, fadeIn: true, fadeOut: true },
+ ] }] });
+ const r = run(['--project', work, '--plan', join(work, 'plan.json')]);
+ assert.equal(r.status, 0, r.stdout + r.stderr);
+ for (const gate of ['no-peek', 'card', 'bridge']) assert.ok(r.stdout.includes(`${gate} | observe | WARN`), r.stdout);
+ json('plan.json', plan);
+ });
+ await t.test('an exposed picture join warns without blocking; a covered join passes', () => {
+ const args = ['--project', work, '--plan', join(work, 'plan.json'), '--src'];
+ const exposed = run([...args, video]);
+ assert.equal(exposed.status, 0, exposed.stdout + exposed.stderr);
+ assert.match(exposed.stdout, /picture-peek \| observe \| WARN/);
+ const source = join(work, 'source.mp4');
+ ff('-f', 'lavfi', '-i', 'color=white:s=320x180:r=30:d=2', '-c:v', 'libx264', source);
+ const covered = run([...args, source]);
+ assert.equal(covered.status, 0, covered.stdout + covered.stderr);
+ assert.match(covered.stdout, /picture-peek \| observe \| PASS/);
+ });
+ await t.test('missing source and invalid external plans are usage errors, not silent passes', () => {
+ assert.equal(run(['--unknown']).status, 2);
+ assert.equal(run(['--video']).status, 2);
+ assert.equal(run(['--project', work, '--plan', join(work, 'plan.json'), '--src', join(work, 'missing.mp4')]).status, 2);
+ json('plan.json', { fps: 0 });
+ assert.equal(run(['--plan', join(work, 'plan.json')]).status, 2);
+ });
+ await t.test('copied engine uses the installed shared gate without npm install', () => {
+ const engine = join(work, 'engine');
+ cpSync(join(skill, 'engines/remotion'), engine, { recursive: true, filter: (src) => basename(src) !== 'node_modules' });
+ const r = run(['--project', work, '--skill-root', skill], ['node', join(engine, 'pipeline/verify.mjs')]);
+ assert.equal(r.status, 0, r.stdout + r.stderr);
+ assert.match(r.stdout, /tests \| enforce \| PASS/);
+ });
+ } finally {
+ rmSync(work, { recursive: true, force: true });
+ }
+});
diff --git a/skills/motion-video-production/references/brand-intro.md b/skills/motion-video-production/references/brand-intro.md
index cd262ba..a350984 100644
--- a/skills/motion-video-production/references/brand-intro.md
+++ b/skills/motion-video-production/references/brand-intro.md
@@ -29,7 +29,7 @@
2. `productions/wordcut/data.ts`에 단어, 장면 문구, 끝 문구를 키워드로 채워요.
3. 마무리 이미지를 엔진 폴더의 `public/closing.jpg`로 두고 `data.ts`의 `closing`을 `'closing.jpg'`로 바꿔요. 마지막 2초에 이미지로 넘어가 멈추고, 단어는 같은 자리에 남아요. 이미지가 페이지를 덮는 경계는 carry 검사에서 bare로 세져요. 데모에서는 세지는 경계가 이것 하나뿐이라 carry 점수가 0.00(FAIL)이에요. 단어가 같은 자리에 그대로 남으면 carry로 세지지 않으니, 이 경계에서 단어를 움직이거나 키워 carry로 바꿔야 FAIL을 벗어나요.
4. 레퍼런스 분석이 있으면 `node productions/wordcut/plan.mjs ref/analysis.json <초>`로 타이밍을 뽑아요.
-5. `node productions/wordcut/render.mjs video 9x16`로 렌더하고, `drift.mjs`와 `verify.sh`로 재요. 레퍼런스가 있으면 `gate.py ref`로 비교해요.
+5. `node productions/wordcut/render.mjs video 9x16`로 렌더하고, `drift.mjs`와 `verify.sh <mp4> --project "$PROJECT_ROOT"`로 재요. 검증 표의 LOOK 이미지를 실제로 본 뒤 `gate.py final`도 통과해야 해요(`references/verification.md`). 레퍼런스가 있으면 `gate.py ref`로 비교해요.
## 5. 홈페이지 한 장
diff --git a/skills/motion-video-production/references/engines.md b/skills/motion-video-production/references/engines.md
index 1c5c061..854d000 100644
--- a/skills/motion-video-production/references/engines.md
+++ b/skills/motion-video-production/references/engines.md
@@ -39,7 +39,7 @@ Node.js 24 이상이 필요합니다(`.ts` 파일을 바로 실행). 모든 의
| 기본 스코어 | `node pipeline/score.mjs productions/<id>` → `productions/<id>/audio/score.wav` |
| 목소리 | `node pipeline/vo.mjs productions/<id>/vo`, `node pipeline/vo-assemble.mjs productions/<id>/vo <초> productions/<id>/vo/cues.json` |
| 믹스와 mux | `bash "$SKILL_ROOT/scripts/mix-mux.sh" <picture.mp4> <fps> <초> <score.wav> <vo_track.wav 또는 -> "$PROJECT_ROOT/out/final.mp4"` |
-| 측정 | `PRODUCTION=productions/<id> bash "$SKILL_ROOT/scripts/verify.sh" "$PROJECT_ROOT/out/final.mp4"` |
+| 검증 표 | `PRODUCTION=productions/<id> bash "$SKILL_ROOT/scripts/verify.sh" "$PROJECT_ROOT/out/final.mp4" --project "$PROJECT_ROOT"` |
새 작품은 `productions/carry-demo/`를 복사해 시작합니다. 파일 구성: `timing.ts`(계약), `scene.ts`(시각 t의 순수 기하), `<이름>.tsx`(얇은 Remotion 호스트), `track.ts`(carry 검사가 읽는 상자), `BEATSHEET.md`(`templates/BEATSHEET.md`), `vo/`, `audio/`. 컴포지션은 `src/Root.tsx`에 등록합니다.
@@ -69,3 +69,5 @@ Node.js 24 이상이 필요합니다(`.ts` 파일을 바로 실행). 모든 의
| 렌더 | `npx hyperframes render --fps 30 --quality high -o renders/<이름>.mp4` |
`index.html`의 루트 요소에 `data-composition-id`, `data-width`, `data-height`, `data-duration`을 두고, `gsap.timeline({ paused: true })`를 `window.__timelines["<컴포지션 ID>"]`에 등록합니다. 자세한 규칙은 `npx hyperframes docs compositions`, `npx hyperframes docs gsap`에 있습니다. 렌더한 mp4는 Remotion과 같은 `mix-mux.sh`, `verify.sh`, `gate.py ref`, `gate.py final`로 넘깁니다.
+
+검증 표는 기존 `harness/gate.py`의 미디어 계산을 재사용합니다. 복사한 Remotion 엔진에서는 `npm run verify -- --video <mp4> --skill-root "$SKILL_ROOT"`로도 실행합니다. 계획·원본 옵션, observe 모드, 눈 검수와 검사하지 않는 항목은 `references/verification.md`에 있습니다.
diff --git a/skills/motion-video-production/references/glossary.md b/skills/motion-video-production/references/glossary.md
index 7fe553e..c8efa41 100644
--- a/skills/motion-video-production/references/glossary.md
+++ b/skills/motion-video-production/references/glossary.md
@@ -45,9 +45,9 @@
## 화면과 출력
- 첫 프레임·썸네일 프레임(first frame / thumbnail frame): 재생 전이나 피드에서 처음 보이는 한 장이에요. wordcut은 0프레임을 `frame0.mjs --check`로 판정하고, 홈페이지 템플릿은 마지막 프레임을 포스터로 써요(`references/brand-intro.md`).
-- 세이프 영역(safe area): 화면 가장자리에서 잘리거나 플랫폼 UI에 가려질 수 있어 글자를 두지 않는 안쪽 경계예요. 이 스킬에는 전용 검사가 없어요. 가장자리 색은 `verify.sh`가 재요.
+- 세이프 영역(safe area): 화면 가장자리에서 잘리거나 플랫폼 UI에 가려질 수 있어 글자를 두지 않는 안쪽 경계예요. 이 스킬에는 전용 검사가 없어요. 가장자리 잘림은 완성본을 직접 보고 확인해요.
- 키프레임(keyframe): 이 스킬에서는 영상 생성의 시작 화면으로 쓰는 이미지 한 장이에요(3단계). 애니메이션 도구의 "값을 찍는 시점"과 다른 뜻이에요.
-- 컨택트 시트(contact sheet): 영상의 여러 시점을 한 장에 격자로 늘어놓은 이미지예요. `scripts/verify.sh`와 `scripts/clipsheet.sh`가 만들어요.
+- 컨택트 시트(contact sheet): 영상의 여러 시점을 한 장에 격자로 늘어놓은 이미지예요. `scripts/verify.sh`의 LOOK 행과 `scripts/clipsheet.sh`가 제공해요.
- 크로마키(chroma key): 단색(초록) 배경을 지워 캐릭터만 떼어 내는 합성이에요. 이 스킬은 RGB 기준 `colorkey`를 쓰는 `scripts/key-plate.sh`로 해요.
- 키네틱 타이포그래피(kinetic typography): 글자 자체가 움직이며 내용을 전하는 모션 그래픽이에요. wordcut 끝의 교과서 글자가 흩어지고 단어가 사전 표제어가 되는 구간, `productions/carry-demo`의 단어가 라벨이 되는 경계가 이것이에요.
- 스크롤 연동 영상(scroll-scrubbed video): 스크롤 위치에 따라 영상의 재생 위치가 앞뒤로 움직이는 웹 기법이에요. 이 스킬의 홈페이지 템플릿은 쓰지 않고 자동 재생 반복을 써요. 쓰려면 `references/brand-intro.md`의 외부 라이브러리 규칙을 따라요.
diff --git a/skills/motion-video-production/references/pitfalls.md b/skills/motion-video-production/references/pitfalls.md
index 08101be..de09716 100644
--- a/skills/motion-video-production/references/pitfalls.md
+++ b/skills/motion-video-production/references/pitfalls.md
@@ -14,7 +14,7 @@
- **매끄러운 페이지 전환도 bare입니다.** 아무것도 살아남지 않는 아이리스는 carry 0.00(FAIL)으로 잽니다. 두 레이어 위에 요소 하나를 두고 그 구간에서 움직이거나 키운 뒤 `pipeline/probe.mjs`를 돌립니다.
- **선언한 상자는 어긋납니다.** `track.ts`의 글자 상자는 스틸에서 잰 잉크 상자입니다. 글꼴이나 크기를 바꾸면 다시 잽니다. 화면과 `track.ts`가 같은 `scene(t)`를 읽게 만들어야 위치가 서로 어긋나지 않습니다.
- **경계 0개는 1.00이 아닙니다.** probe는 비트 시트보다 경계를 적게 찾으면 WARN을 냅니다. 몰아치기 안의 경계는 점수에서 빠지므로 몰아치기가 많은 작품은 WARN이 정상입니다.
-- **흔들기는 페이지 배경을 드러냅니다.** 잘라 내는 틀을 흔들면 가장자리가 움직입니다. 고정된 `overflow: hidden` 틀 안의 안쪽 레이어만 흔들고, `verify.sh`의 가장자리 색 검사로 확인합니다.
+- **흔들기는 페이지 배경을 드러냅니다.** 잘라 내는 틀을 흔들면 가장자리가 움직입니다. 고정된 `overflow: hidden` 틀 안의 안쪽 레이어만 흔들고, 최종본의 첫·중간·마지막 프레임 가장자리를 직접 확인합니다. `verify.sh`의 LOOK 이미지만으로 모든 프레임을 확인했다고 보고하지 않습니다.
- **글꼴은 고정 버전 npm 패키지에서만** 불러오고, 첫 프레임 전에 다 불러올 때까지 기다립니다(`delayRender`, `document.fonts.load`). 헤드리스 브라우저에는 시스템 글꼴이 없을 수 있습니다. 한글 웹폰트가 unicode-range로 나뉘어 있으면 화면에 나올 글자로 직접 불러옵니다(`productions/wordcut/fonts.ts`).
- **결정성 확인**: 같은 컴포지션을 두 번 렌더해 `framemd5`를 비교합니다.
diff --git a/skills/motion-video-production/references/verification.md b/skills/motion-video-production/references/verification.md
new file mode 100644
index 0000000..2afe5d7
--- /dev/null
+++ b/skills/motion-video-production/references/verification.md
@@ -0,0 +1,68 @@
+# 완성본 검증
+
+`verify.sh`는 기존 단계 게이트를 대체하지 않습니다. `gate.py`의 미디어 검사에 엔진 검사와 눈 검수용 이미지를 한 표로 모읍니다. `final` 게이트는 여전히 실제 검수 기록과 그 기록이 최종본보다 새것인지 확인합니다.
+
+## 실행
+
+산출물 폴더의 `edit.json`을 기준으로 검사합니다. 엔진 종류는 상관없습니다.
+
+```bash
+bash "$SKILL_ROOT/scripts/verify.sh" "$PROJECT_ROOT/out/final.mp4" --project "$PROJECT_ROOT"
+# 표의 LOOK 이미지를 실제로 보고 qa/review.md에 기록한 뒤:
+python3 "$SKILL_ROOT/harness/gate.py" final "$PROJECT_ROOT"
+```
+
+Remotion 엔진을 복사한 폴더에서도 실행할 수 있습니다. 공유 게이트를 찾도록 설치된 스킬 경로를 넘깁니다.
+
+```bash
+npm run verify -- --production productions/carry-demo --video renders/carry-demo/final.mp4 --skill-root "$SKILL_ROOT"
+```
+
+기존 `PRODUCTION=productions/<id> bash "$SKILL_ROOT/scripts/verify.sh" <mp4>` 호출도 유지됩니다. `--project`와 `--production`이 함께 있으면 미디어의 기대값은 `edit.json`, carry는 작품의 `track.ts`를 씁니다. 둘 다 없으면 프레임 수는 스트림 헤더와만 비교하고, 목표 해상도·fps 비교는 SKIP입니다. 헤더와 맞는 짧은 파일도 있을 수 있으므로 납품에는 외부 기대값을 넘깁니다.
+
+## 표 읽기
+
+| 순서 | 검사 | 기준과 모드 |
+|---|---|---|
+| 0 | 엔진 단위 테스트 | 기존 테스트와 합성 타임라인 테스트. enforce |
+| 1 | carry, 타임라인 | carry는 enforce. 2초 미만 간격의 오버레이는 다음 것이 불투명해질 때까지 유지, 카드 9초 이하, 원본 일시정지와 카드 연장 중첩 금지, 챕터 브리지 3.5초 이상은 observe |
+| 2 | 컨테이너 | 기존 게이트의 프레임 수, 오디오 스트림, 해상도, fps, A/V 길이. enforce. 새 명목·평균 프레임률 비교는 observe |
+| 3 | 음량 | 기존 게이트의 −14 ±1.5 LUFS, true peak ≤ −1 dBTP. enforce. `GATE_LUFS`, `GATE_LUFS_TOL`, `GATE_TP_MAX`로 변경 |
+| 4 | 이음새 그림 | 원본과 너무 닮은 프레임(344×216 회색조 PSNR > 18 dB)을 찾음. observe |
+| 5 | LOOK | 최대 60칸 컨택트 시트, 마지막 프레임. 사람이 볼 경로이며 PASS가 아님 |
+
+`engines/remotion/pipeline/verify-limits.json`에 새 검사의 모드·기준이 있습니다. 새 검사는 observe에서 시작합니다. 실제 프로젝트에서 오탐을 확인하고 보정한 뒤 enforce로 바꿉니다. 기존 음량 기준은 이식 때문에 바꾸지 않았고, 수치와 계산은 계속 `harness/gate.py` 한 곳에 있습니다.
+
+- PASS: 해당 기계 검사 통과. WARN: 관찰 모드의 실패 또는 참고 경고. SKIP: 입력·기대값이 없어 검사하지 못함. LOOK: 사람이 확인할 자료.
+- enforce 실패는 종료 코드 1, 잘못된 입력은 2입니다. 기본은 실패한 비용 단계까지만 실행합니다. `--all`은 실패해도 모든 단계를 실행합니다.
+- 영상 옆 `qa/VERIFY.md`에 표, 명령, 커밋, 영상 수정 시각·크기를 씁니다. 다시 인코딩하면 다시 검사해야 합니다. 이 파일은 눈 검수 기록이 아닙니다.
+- 같은 검사에서 세 번 고쳐도 실패하면 시도한 것과 남은 실패를 사용자에게 보고합니다.
+
+## 선택: 오버레이 계획과 원본 비교
+
+`--plan <계획.json>`을 더하면 렌더 없이 타임라인을 검사합니다. 시간은 챕터의 **원본 초**입니다. `rows`는 실제 합성한 오버레이를 시작 시간순으로 적습니다. 자동으로 고쳐진 가상 계획으로 실제 편집을 통과시키지 않습니다.
+
+```json
+{
+ "fps": 30, "fadeIn": 0.2, "fadeOut": 0.2,
+ "chapters": [{
+ "n": 1, "length": 12, "offset": 0, "bridgeAfter": 3.5, "pauses": [],
+ "rows": [
+ {"id": "title", "start": 0, "length": 4.7333, "clip": 4, "fadeIn": false, "fadeOut": false},
+ {"id": "detail", "start": 4.5, "length": 4, "clip": 4, "fadeIn": true, "fadeOut": true}
+ ]
+ }]
+}
+```
+
+`clip`은 움직이는 클립 길이, 그보다 긴 `length`는 마지막 프레임 유지입니다. `fadeIn`·`fadeOut`은 페이드 유무이고, 페이드 길이는 최상위 초 값입니다. `pauses`에는 `{"at": 5, "seconds": 2, "id": "card"}`처럼 원본을 멈춘 위치와 추가 길이를 적습니다. `offset`은 최종본에서 챕터가 시작하는 초, `bridgeAfter`는 챕터 뒤 브리지 길이입니다. 마지막 챕터처럼 브리지가 없으면 생략합니다.
+
+또는 `rows` 대신 `items`에 `{"id": "title", "start": 0, "end": 4, "clip": 4}`를 넣어 배치·유지 결과를 계산할 수 있습니다(`end: null`이면 클립 길이). 이 방식은 합성기가 같은 `composed()` 결과를 사용하거나 실제 결과와 대조했을 때만 검증 근거가 됩니다. 기존 `edit.json`의 `cuts`와는 다른 오버레이 계약입니다.
+
+`--src <원본.mp4>`까지 주면 한 챕터 계획에 한해 이음새 주변 0.8초를 원본과 비교합니다. 최종본과 원본은 같은 화면 크롭·속도여야 합니다. 추가 일시정지를 가로지르는 창은 시간 대응이 달라 건너뛰고 개수를 표시합니다. 이 검사는 이음새 표본 밖의 플래시를 보장하지 않습니다. 프레임률 비교도 명목·평균 값 비교이며 모든 타임스탬프를 검사하지는 않습니다.
+
+## 사람이 남겨야 하는 것
+
+컨택트 시트와 마지막 프레임에서 겹침·잘린 글자·얼굴과 의상 변형을 보고, 컷 전후 영상과 오디오도 직접 재생합니다. 컷이 말의 내용에 맞는지, 음악이 자연스러운지는 이 표로 판정하지 않습니다. 실제로 본 뒤에만 `qa/review.md`에 `REVIEWED: <이름> <YYYY-MM-DD>`와 본 결과를 씁니다.
+
+이 표는 렌더·유료 생성·받아쓰기를 실행하지 않습니다. 이전 `verify.sh`의 반복 체크섬·가장자리 RGB 출력과 자동 whisper 호출은 빠졌습니다. 움직임 중 반복 여부는 영상과 스트립으로, 대본 일치는 별도 받아쓰기로 확인합니다. 짧은 소스 숏 감지, 구간별 음악 균형, 렌더 결정성도 검사하지 않습니다.
diff --git a/skills/motion-video-production/scripts/verify.sh b/skills/motion-video-production/scripts/verify.sh
index 673d5ea..a9d0142 100755
--- a/skills/motion-video-production/scripts/verify.sh
+++ b/skills/motion-video-production/scripts/verify.sh
@@ -1,48 +1,8 @@
#!/usr/bin/env bash
-# 완성 영상을 믿지 말고 측정한다: 스트림 정보, 프레임 수, 반복 프레임, 라우드니스, 컨택트 시트, 프레임 가장자리 색, 받아쓰기.
-# 사용법: [PRODUCTION=productions/<id>] verify.sh <video.mp4> [언어=ko] [whisper 모델=small]
-# PRODUCTION을 주면 엔진 폴더(현재 폴더)의 pipeline/probe.mjs로 carry 검사를 먼저 돌리고, 종료 코드는 그 판정을 따릅니다.
-# 끝나면 <video>.contact.png (0.5초당 1칸)를 직접 눈으로 확인하세요. 겹침, 사라진 글자, 이상한 소품은 시트에서만 보입니다.
-set -uo pipefail
-v=${1:?usage: verify.sh video.mp4 [lang] [model]}; lang=${2:-ko}; model=${3:-small}
-base=${v%.*}
-verdict=0
-if [[ -n "${PRODUCTION:-}" ]]; then node pipeline/probe.mjs "$PRODUCTION"; verdict=$?; fi
-echo "== ffprobe"; ffprobe -v error -show_entries stream=codec_type,width,height,r_frame_rate,nb_frames,duration -of csv=p=0 "$v"
-echo "== decoded frames: $(ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nw=1:nk=1 "$v")"
-echo "== repeated frames (앞 프레임과 같은 프레임. 정지 구간은 괜찮고, 움직이는 중의 반복은 끊김)"
-ffmpeg -loglevel error -i "$v" -map 0:v -f framemd5 - | python3 -c '
-import sys
-rows = [[s.strip() for s in l.split(",")] for l in sys.stdin.read().splitlines() if l and not l.startswith("#")]
-rep = run = longest = at = 0
-for i, r in enumerate(rows):
- if i and r[5] == rows[i - 1][5]:
- rep += 1; run += 1
- if run > longest: longest, at = run, i - run
- else: run = 0
-print(f"{rep} of {len(rows)} frames repeat the previous one; longest hold {longest + (1 if longest else 0)} frames from frame {at}")
-'
-echo "== loudness (I 와 True peak 를 확인)"
-ffmpeg -hide_banner -i "$v" -af ebur128=peak=true -f null - 2>&1 | grep -A14 Summary | grep -E 'I:|Peak:'
-secs=$(ffprobe -v error -show_entries format=duration -of csv=p=0 "$v")
-cols=9; tiles=$(python3 -c "import math;print(math.ceil($secs*2))"); rows=$(python3 -c "import math;print(math.ceil($tiles/$cols))")
-ffmpeg -loglevel error -y -i "$v" -vf "fps=2,scale=320:-2,tile=${cols}x${rows}" -frames:v 1 "$base.contact.png" && echo "== contact sheet: $base.contact.png"
-echo "== frame edges (위 아래 왼쪽 오른쪽 평균 RGB, 10개 시점. 흔들기 이음매는 한쪽 가장자리 색이 달라져서 보입니다)"
-for i in 1 2 3 4 5 6 7 8 9 10; do
- t=$(python3 -c "print(f'{$secs*$i/11:.2f}')"); printf "%6s: " "$t"
- for c in "iw:1:0:0" "iw:1:0:ih-1" "1:ih:0:0" "1:ih:iw-1:0"; do
- ffmpeg -loglevel error -ss "$t" -i "$v" -frames:v 1 -vf "format=rgb24,crop=$c,scale=1:1:flags=area" -f rawvideo -pix_fmt rgb24 - | xxd -p | tr '\n' ' '
- done; echo
-done
-# 받아쓰기: WHISPER_GGML이 ggml 모델을 가리키면 whisper.cpp(빠름). 단어 시작 시각은 openai-whisper --word_timestamps로 잽니다.
-tmp=$(mktemp -d); ffmpeg -loglevel error -y -i "$v" -vn -ac 1 -ar 16000 "$tmp/a.wav"
-if [[ -n "${WHISPER_GGML:-}" && -f "$WHISPER_GGML" ]] && command -v whisper-cli >/dev/null; then
- echo "== transcript (whisper.cpp $(basename "$WHISPER_GGML"), $lang) - 대본과 비교하세요"
- timeout 300 whisper-cli -m "$WHISPER_GGML" -l "$lang" -f "$tmp/a.wav" -otxt -of "$tmp/a" -np >/dev/null 2>&1 && cat "$tmp/a.txt" || echo "(whisper-cli 실패 또는 시간 초과)"
-elif command -v whisper >/dev/null; then
- echo "== transcript ($model, $lang) - 대본과 비교하세요"
- timeout 900 whisper "$tmp/a.wav" --model "$model" --language "$lang" --output_format txt --output_dir "$tmp" --fp16 False >/dev/null 2>&1 && cat "$tmp/a.txt" || echo "(whisper 실패 또는 시간 초과)"
-else
- echo "== whisper 미설치: 받아쓰기 생략 (pip install openai-whisper)"
-fi
-exit $verdict
+# 기존 진입점: 미디어 검사는 gate.py 한 곳에서 하고 결과를 한 표로 남긴다.
+# 사용법: [PRODUCTION=productions/<id>] verify.sh <video.mp4> [--project <폴더>] [--plan <계획.json> --src <원본.mp4>] [--all]
+set -euo pipefail
+SKILL_ROOT=$(cd "$(dirname "$0")/.." && pwd)
+v=${1:?usage: verify.sh video.mp4 [verify options]}; shift
+if [[ -n "${PRODUCTION:-}" ]]; then set -- --production "$PRODUCTION" "$@"; fi
+exec node "$SKILL_ROOT/engines/remotion/pipeline/verify.mjs" --skill-root "$SKILL_ROOT" --video "$v" "$@"