# Spec-Driven Post-to-Video Studio Engine (Idea #21)

Reusable deterministic dual-format (`16:9` `1920x1080` + native vertical `9:16` `1080x1920`) video compiler built to turn quantitative research notes on `zidingz.com` into social-ready explainer cuts.

## Architecture (X-Bookmark Stack + `one-letter` Contract)
1. **Declarative JSON scene specs (`specs/*.json`):** Each post specifies `slug`, `duration_s`, `url`, `audio_theme` (`bell` | `pulse` | `bio`), and 4–5 acts with typed data panels (`bar_compare`, `curve_compare`, `loop_diagram`, `timeline_rows`, `coda_card`) and `events` timestamps.
2. **Sample-accurate procedural audio (`audio_synth.py`):** Synthesizes a `48 kHz` stereo WAV master with clean transient attacks aligned to every `events[i].t_s` boundary (snapped cleanly to the 30 fps frame grid).
3. **Stateless frame compositor (`studio_cli.py`):** Pure function `render_frame(t, spec, aspect)` renders both widescreen (`16:9`) and native mobile (`9:16` with >=130 px top/bottom UI safe zones, never center-cropped `16:9`), with `>= 1.8 s` readable hold plateaus and `< 2 MB` H.264/AAC outputs.
4. **Automated sync & visual verification (`verify_sync.py`):** Asserts audio RMS transient alignment `< 1.0 frame` against pixel brightness deltas on every cue and emits contact sheets for eye inspection.

## Usage

```bash
python3 studio_cli.py --spec specs/rsi-knowing-what-improved.json --out-dir /path/to/media/studio
python3 verify_sync.py --spec specs/rsi-knowing-what-improved.json --media-dir <media-dir> --shots-dir <shots-dir>
```
