File size: 5,399 Bytes
dbaf81f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# t07-remake-reference

Remake-the-edit — type 1 from `video_types.md`, **real-footage variant**. The
agent gets two raw iPhone clips plus a finished reference render and minimal
text; the reference IS the instruction. Tests: scrubbing/analyzing an
existing cut, multi-clip sequencing, an interior pull, a cross dissolve,
rendering, saving the project.

Unlike t01–t06 the ground truth is a **human edit made in FCPX** — this task
is the Linux-tier prototype of the FCPX gold-tier grading pipeline:

```
environment/media/*.MOV            raw clips (agent inputs, gitignored — ~108MB)
environment/reference/edit.fcpxmld the FCPX XML export (committed: IS the ground truth)
environment/reference/reference.mov the human's 1080p30 render (gitignored)
tools/fcpxml_to_edl.py             FCPXML -> tests/edl.json compiler
tests/edl.json                     the EDL the verifier grades against
```

The edit (from `tests/edl.json` — regenerate with
`python3 tools/fcpxml_to_edl.py environment/reference/edit.fcpxmld tests/edl.json`
after re-exporting the XML):

| timeline | source | note |
|---|---|---|
| 0.00–3.07s | IMG_9741 from src 8.40s | interior pull |
| 2.57–3.57s | Cross Dissolve, 1s | + audio crossfade |
| 3.07–8.80s | IMG_9475 from src 0.50s | |

Nothing in the verifier hardcodes this edit — change the FCPXML, recompile
the EDL, and the same rubric grades the new instance (flat single-spine
asset-clip edits only; compound/multicam/connected clips are rejected by the
compiler on purpose).

## Grading

Fractional, artifact-only, split into four NAMED SUB-VERIFIERS — each is its
own pytest test (separate pass/fail in ctrf.json, so trajectories show which
dimension fell short), grading runs once and is shared, and the per-category
breakdown lands in `/logs/verifier/verifier.json` next to `reward.txt`:

```json
{"export_valid": 1.0, "visual_match": 1.0,
 "project_structure": 1.0, "anti_cheat": 1.0, "reward": 1.0}
```

| category | weight | covers |
|---|---|---|
| export_valid | 0.30 | exists, duration, resolution, audio |
| visual_match | 0.30 | sampled frames match the reference render |
| project_structure | 0.40 | references, order, source-ins, durations, transition |
| anti_cheat | gate | re-export detection — zeroes the reward |

Checkpoint weights within each category (`W` in `tests/test_outputs.py`):

| weight | checkpoint |
|---|---|
| 0.08 | `/root/Desktop/final.mp4` exists and ffprobe can read it |
| 0.10 | duration within ±0.6s of the sequence (8.2–9.4s) |
| 0.07 | export is 1920x1080 (not the 960x540 reference) |
| 0.05 | export has an audio stream |
| 0.30 | frame matching: sampled frames (2/segment, clear of cuts and the dissolve, LOWEST-MOTION candidates) match the reference — grayscale 96x54 thumbs, watermark band masked, best-of-window ±0.9s, MAD ≤ 22 |
| 0.10 | project saved, parses, references both clips |
| 0.08 | project timeline clip order matches the EDL |
| 0.12 | per-segment source-in within ±0.5s (split across segments) |
| 0.05 | per-segment durations within ±0.75s |
| 0.05 | project contains a dissolve/mix transition (luma/mix service) |
| GATE | export IS the watermarked reference → score zeroed |

Do-nothing floor: **0.00**.

The gate is two-pronged because OCR alone is beatable: an upscaled re-export
blurs the watermark text past tesseract (measured — OCR missed it), but the
watermark **band pixels** still match the reference near-exactly. Calibrated
on this footage: re-export band MAD ≤ 0.5, honest remake ≥ 10.2, wrong edit
≥ 49. Gate fires at ≤ 4.0 on a majority of samples. Frame-match calibration:
oracle MAD 0.7–17.2 vs wrong-edit 56.9+, threshold 22.

Oracle-checked locally on a dev Mac (oracle 1.0000, upscaled re-export
0.0000 gated, wrong-clip-order fails every frame check) AND in docker via
`harbor run -a oracle`.

## Gotchas

- **Frame samples must sit on calm frames.** This footage is handheld pans;
  motion blur makes a SUB-FRAME timing difference between encoders explode
  the match MAD (measured 37.6 on a pan tail for the same correct edit
  rendered by the container's ffmpeg vs the dev Mac's — vs <6 on calm
  frames, threshold 22). `sample_times()` therefore ranks candidate times by
  the reference's own frame-to-frame motion and samples the calmest two per
  segment. Don't replace it with fixed timestamps.

- **iPhone footage is VFR.** ffmpeg's xfade rejects it even through an fps
  filter in the same graph — the oracle renders CFR intermediates first.
  Kdenlive handles VFR fine; this only affects ffmpeg-side tooling.
- **The MOVs carry an APAC (spatial audio) stream** alongside AAC. ffprobe
  shows codec_type=audio with no codec_name for it; anything stream-mapping
  by hand should map `a:0`-style explicitly if it misbehaves.
- **Don't move `environment/media/*.MOV`** — the FCPX library references
  them in place; moving them breaks re-exporting an updated FCPXML.
- **This task's image layer includes ~120MB of media** (raw clips + the
  watermarked reference built from `reference/reference.mov` at build time;
  the full-res render never ships). The synthetic seed media from the base
  image is removed. Daytona runs need a snapshot built from THIS Dockerfile.
- **Re-calibrating thresholds**: keep the measured gaps (band gate, frame
  MAD) — don't tighten without re-running oracle + cheat + wrong-order
  controls.