video_editing_poc/.claude/memory/ai-handover.md

75 lines
4.7 KiB
Markdown

# AI Handover: Local Cinematic Highlight PoC
Last updated: 2026-07-23 (Europe/Berlin). **This file goes stale — verify before trusting it.**
## FIRST: check for staleness (prevents the 2026-07-23 stale-session incident)
This handover was once resumed from an old commit while the repo had advanced 2 days on another
branch/agent, wasting a whole session re-deriving already-built work. Do NOT let that happen:
```bash
git rev-parse --short HEAD # compare to "Recorded HEAD" below
git log -8 --oneline --decorate
git status --short # uncommitted work may be the real current state
```
- **Recorded HEAD when this was written: `1da0661`** ("Automatic two-tier highlight director +
source-adaptive rendering") — the session's work below is COMMITTED as of 2026-07-23.
- If HEAD is newer than `8b68116`, or there are unfamiliar commits/uncommitted files, **this file is behind
the repo**. The authoritative live state is: the git log, `git status`, and
`docs/cinematic-highlight-poc-plan.md` (milestone log at its tail). Trust those over this file.
- If a `claude agents` background session is still "running" for this repo, only one agent should mutate the
repo at a time (renders/commits/state). Confirm the others are stopped.
## What exists NOW (built, not aspirational)
The full local single-source cinematic-highlight pipeline is implemented and working end-to-end:
analysis → candidates/category → (manual) director plan → local asset generation → cinematic FFmpeg render
→ QA. Models are provisioned and proven (Piper voice, MusicGen music, AudioLDM2 SFX) — see
[[local-model-runtime-intel-mac]]. The user authorized model downloads on 2026-07-21 (this **reversed** the
earlier no-download stance; that reversal is real and current).
To run source → final render, follow [[highlight-e2e-render-runbook]] — do not re-derive it.
## Delivered 2026-07-23 (whole service, not just PoC) — committed at `1da0661`
**Automatic two-tier director** (plans were hand-authored before; now auto-generated):
- Tier 1 `HighlightMontageDirector`: composes `director/montage.json` from measured motion (YDIF) + audio (RMS)
— setup, continuous action, slow-mo payoff on the audio climax, resolution button, camera-whip tail trimmed.
- Tier 2 `HighlightVisionDirector` + `tools/vision_caption.py`: local moondream2 (offline) captions the payoff
→ semantic overlay ("STRIKE") + scene-informed music; fails soft. See [[local-model-runtime-intel-mac]].
- Wired into the scheduler behind `auto-director-enabled` / `vision-director-enabled` (localpoc on).
**Source-adaptive rendering fixes:**
1. **Portrait/orientation**: `FfmpegClipInspector` now reads rotation side-data/`rotate` tag and stores the
EFFECTIVE (display) width/height. `HighlightFfmpegRenderer.outputGeometry()` renders portrait sources to a
portrait frame and skips the 2.39 letterbox (landscape unchanged). Fixes portrait phone footage being
stretched into landscape.
2. **Audio mix**: source audio (`[0:a]`) is now ducked (-20 dB, or -24 with narration) so the generated score
leads instead of being buried; montage music cue raised to -9 dB. In `HighlightFfmpegRenderer.audioMixCommand`
+ the montage cue in `HighlightDirectorFlowService`.
3. **Duration constraint removed**: `HighlightDirectorPlanValidator` no longer enforces min/max highlight
duration (only positive/finite + sane playback speed + candidate containment). Config defaults relaxed
(min 2 / max 3600 as soft candidate hints only). A highlight can be as long as the story needs. Montage path
was already unconstrained.
`mvn -o verify`: 254 tests, 0 failures (JaCoCo gate passes). 6 new tests cover the above. NOT yet committed —
the user has not asked to commit.
## Still open / next levers (from docs/cinematic-highlight-poc-plan.md Phase 5)
- Source footage quality is the ceiling (e.g. 576p phone clips upscale soft). Biggest lever.
- No resident local **director** — plans are hand-authored (`montage.json`). P5.2/P5.5.
- Bigger/continuous music (musicgen-medium is slow on CPU) — P5.3.
- In-shot `zoompan` push-in, beat-synced cut lengths — P5.4.
- Licensing: MusicGen CC-BY-NC, AudioLDM2 CC-BY-NC-SA, YOLOv8 AGPL → non-commercial. Production needs
commercially-licensed models — P5.7.
- Production hardening (security, CI/CD, containers, PostgreSQL, no-egress cert) deferred until quality passes.
## Non-negotiables still in force (except downloads, which the user authorized)
No external AI services in the media path; no unlicensed assets shipped as production; no placeholder
silence/tones as success; no rendering without explicit approval; record license/provenance for every model.
Manual approval is fine for the PoC. Do not commit unless the user asks.