docs: add growth roadmap and handoff schema
This commit is contained in:
parent
82c80aa49a
commit
692df72898
1 changed files with 173 additions and 0 deletions
173
PLAN.md
Normal file
173
PLAN.md
Normal file
|
|
@ -0,0 +1,173 @@
|
||||||
|
# cadence — YouTube Growth Roadmap
|
||||||
|
|
||||||
|
Working plan for the long-form editor side of the pipeline. **No code has been
|
||||||
|
written yet.** This document is the agreed spec; the authoritative handoff
|
||||||
|
interface lives here.
|
||||||
|
|
||||||
|
Related: `/home/pbento/Projects/clipwright/PLAN.md` (the packaging/clipping side).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Context
|
||||||
|
|
||||||
|
**Pipeline:** raw OBS recording → **cadence** (silence/filler edit + transcript)
|
||||||
|
→ Kdenlive render (master) → **clipwright** (moments + reframe + captions +
|
||||||
|
packaging) → **Postiz** (publish).
|
||||||
|
|
||||||
|
cadence already does the hard part: transcribe (word timestamps) → `build_cuts`
|
||||||
|
→ `build_timeline` → `.kdenlive` + `.srt` + `*_llm_transcript.txt`. The render is
|
||||||
|
done manually in Kdenlive; that is the master step, so **cadence does not need a
|
||||||
|
`--render` stage.**
|
||||||
|
|
||||||
|
Inputs confirmed: OBS multitrack `.mkv`, separate audio tracks, **1440p**,
|
||||||
|
editor maximized.
|
||||||
|
|
||||||
|
### Design rules
|
||||||
|
|
||||||
|
1. **Every word carries a leading space** in the emitted transcript (cadence's
|
||||||
|
internal `Word.text` is stripped; clipwright defensively merges continuation
|
||||||
|
words). Emit `" " + text`, or document the strip-on-load fix (clipwright does
|
||||||
|
the merge on load — preferred).
|
||||||
|
2. **Timestamps are on the EDITED timeline**, absolute seconds.
|
||||||
|
3. **No network / no LLM in cadence.** Keep it a single-file, dependency-light
|
||||||
|
tool. Candidate hook/title fields are reserved but left `null`.
|
||||||
|
4. **Atomic writes** for all new outputs (reuse `_write_text_atomic`,
|
||||||
|
`cadence.py:482`).
|
||||||
|
5. **`PACING_PRESETS` stay as-is.** They are pacing only; channel identity lives
|
||||||
|
in clipwright profiles. Do not add a profile layer to cadence.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## #8 — cadence → clipwright handoff (emitter) · S
|
||||||
|
|
||||||
|
New `--handoff` flag (alongside `--captions`, `cadence.py:1303-1307`). After
|
||||||
|
`generate_combined_transcripts` (`cadence.py:1518`), write two files next to the
|
||||||
|
`.kdenlive` output:
|
||||||
|
|
||||||
|
```
|
||||||
|
recording.transcript.json # clipwright transcribe_media contract, edited timeline
|
||||||
|
recording.handoff.json # EDL + candidates + chapter slot
|
||||||
|
```
|
||||||
|
|
||||||
|
### `recording.transcript.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"text": "full punctuated transcript",
|
||||||
|
"language": "en",
|
||||||
|
"segments": [
|
||||||
|
{
|
||||||
|
"start": 1.02, "end": 5.40, "text": "So the first thing…",
|
||||||
|
"words": [
|
||||||
|
{"word": " So", "start": 1.02, "end": 1.21},
|
||||||
|
{"word": " the", "start": 1.22, "end": 1.35}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"source": {"kind": "cadence-edited", "fps": 30, "width": 2560, "height": 1440,
|
||||||
|
"duration": 1234.56, "generator": "cadence 0.1.x"}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### `recording.handoff.json`
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"schema": "clipwright.handoff/1",
|
||||||
|
"generator": {"name": "cadence", "version": "0.1.x"},
|
||||||
|
"edited": {
|
||||||
|
"timeline": "voice-audio",
|
||||||
|
"fps": 30, "width": 2560, "height": 1440, "duration": 1234.56,
|
||||||
|
"jl_mode": "j", "jl_frames": 2,
|
||||||
|
"master": {"path": "recording_edited.mp4", "sha256": "…"}
|
||||||
|
},
|
||||||
|
"sources": [
|
||||||
|
{"index": 0, "path": "/abs/rec.mkv", "duration": 612.3,
|
||||||
|
"fps": 30, "width": 2560, "height": 1440,
|
||||||
|
"audio_track": 1, "audio_streams": 2}
|
||||||
|
],
|
||||||
|
"edit": [
|
||||||
|
{"source": 0, "start": 4.21, "end": 11.07, "type": "keep",
|
||||||
|
"video_shift_frames": 2},
|
||||||
|
{"source": 0, "start": 11.07, "end": 12.40, "type": "drop", "reason": "filler"}
|
||||||
|
],
|
||||||
|
"transcript": {"path": "recording.transcript.json"},
|
||||||
|
"candidates": [],
|
||||||
|
"chapters": []
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
### Implementation notes
|
||||||
|
|
||||||
|
- **Refactor** `generate_combined_transcripts` (`cadence.py:1121-1225`) into a
|
||||||
|
pure `build_mapped_transcript(track_data_list)` that returns
|
||||||
|
`(subs, mapped_words)`. Emit `.srt`, `*_llm_transcript.txt` **and**
|
||||||
|
`.transcript.json` from that one structure. Keeps a single chunker and makes
|
||||||
|
`tests/test_transcripts.py` cover the new emitter with no mocks.
|
||||||
|
- **`candidates[]`** stays empty in v1 (no LLM). Reserve the fields for a future
|
||||||
|
caller. When populated: `{id, start, end, word_start_idx, word_end_idx,
|
||||||
|
start_word, end_word, score, reason, tags, hook, title}`; `hook`/`title`
|
||||||
|
nullable.
|
||||||
|
- **`edit[]`** is the inverse map: per keep segment, source-relative `start`/`end`
|
||||||
|
plus optional `video_shift_frames` (J/L). Edited duration = Σ(keep.end −
|
||||||
|
keep.start).
|
||||||
|
- Paths resolved relative to the manifest's directory.
|
||||||
|
- `--handoff` implies the mapped-word computation; it does not imply `--captions`
|
||||||
|
(the point is to avoid a second ASR run downstream).
|
||||||
|
|
||||||
|
**Files:** `cadence.py` (`parse_args` `1258-1352`, `generate_combined_transcripts`
|
||||||
|
`1121-1225`, new emitter, `main` `1518`), `tests/test_transcripts.py`.
|
||||||
|
|
||||||
|
**Verify:** pure unit tests on the emitter (mapped words → segments; srt
|
||||||
|
regression unchanged; JSON round-trip). No new third-party imports.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## #5 — Chapters (deterministic fallback) · S–M · depends on #8
|
||||||
|
|
||||||
|
Primary home for chapter generation is **clipwright's YouTube Studio long-form
|
||||||
|
mode** (it has the Gemini plumbing). cadence's job is to supply the edited
|
||||||
|
transcript; the handoff manifest reserves a `chapters` slot.
|
||||||
|
|
||||||
|
Optional deterministic fallback in cadence: emit a `.chapters.txt`
|
||||||
|
(`00:00 Title`) from topic-shift detection over the mapped words, written from
|
||||||
|
the same `build_mapped_transcript` structure. Keep it simple; the LLM-quality
|
||||||
|
version lives in clipwright.
|
||||||
|
|
||||||
|
**Files:** `cadence.py` transcript stage; `tests/test_transcripts.py`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## #9 — Loudness normalization + music ducking · DEFERRED
|
||||||
|
|
||||||
|
cadence emits a `.kdenlive` project, not media, so there is nothing to normalize
|
||||||
|
until render. With Kdenlive in the loop, the right home is **MLT filter elements
|
||||||
|
/ Kdenlive's own effects**, not a cadence render pass (which would be
|
||||||
|
render-untestable in CI).
|
||||||
|
|
||||||
|
When it lands, the recipes are already researched:
|
||||||
|
- Two-pass `loudnorm I=-14:TP=-1.0:LRA=11` (measure → apply).
|
||||||
|
- Ducking: `sidechaincompress threshold=0.03:ratio=8:attack=20:release=400`
|
||||||
|
→ `amix` → `loudnorm`.
|
||||||
|
- Voice/System tracks are already separated (`use_system`, `cadence.py:796-829`)
|
||||||
|
— a natural sidechain key.
|
||||||
|
|
||||||
|
Do not schedule this until/unless a deliberate MLT-filter or render-stage
|
||||||
|
decision is made.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Tests
|
||||||
|
|
||||||
|
- Module imports nothing third-party at top level; tests run with only `pytest`.
|
||||||
|
- All I/O uses `tmp_path`; atomic writes are asserted
|
||||||
|
(`tests/test_transcripts.py:25`).
|
||||||
|
- New pure functions over `Word`/`Segment`/`VideoTrackData` are testable via the
|
||||||
|
`make_track` fixture (`tests/conftest.py:11-43`).
|
||||||
|
- CI: `.forgejo/workflows/ci.yml` (ruff + pytest).
|
||||||
|
|
||||||
|
## Open items
|
||||||
|
|
||||||
|
- Decide whether cadence's deterministic `.chapters.txt` fallback is wanted, or
|
||||||
|
chapters live only in clipwright Studio.
|
||||||
|
- #9 home decision (MLT filters vs render stage) — deferred by agreement.
|
||||||
Loading…
Reference in a new issue