videogen/EDITING-SUITE-PLAN.md
caelum0x d56639a594
Some checks are pending
build-images / api (push) Waiting to run
build-images / worker-gpu (push) Waiting to run
build-images / web (push) Waiting to run
codeql / Analyze (javascript-typescript) (push) Waiting to run
codeql / Analyze (python) (push) Waiting to run
perf / API hot-path micro-smoke (budgeted) (push) Waiting to run
perf / Desktop engine crates (release build check) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Waiting to run
vision2026-ci / API phase modules (ruff + pytest) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Waiting to run
vision2026-ci / Python SDK resource tests (push) Waiting to run
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Waiting to run
vision2026-ci / Alembic upgrade + drift check (push) Waiting to run
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Waiting to run
Menivor — open source release (MIT), free to use and fork
Paid, hosted product at menivor.com, now retired as a company project.
Fresh squashed history of the cleaned working tree (secret-scanned,
no .env, no customer data, no outreach logs). Built on
MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
2026-12-04 02:10:26 +03:00

300 lines
20 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Editing Suite Plan — folding WolfCut + OpenScreen into videogen / ReelForge (Menivor)
> **Status:** Proposal / direction doc. Additive only. No existing videogen,
> wolfcut, or openscreen code is deleted or modified by this plan.
> **Model:** "Cursor-on-VSCode" — videogen is the AI-native product shell; the two
> OSS bases are the proven editing/recording substrate we build *on*, not rewrite.
---
## 0. TL;DR
- **videogen / ReelForge (brand: Menivor)** is already a full-stack AI UGC video
*generation* product: Python/FastAPI + Celery pipeline (`apps/api`), Next.js web
(`apps/web`), Expo mobile (`apps/mobile`), a Rust/GPUI native *generation* client
(`apps/desktop`), and shared TS/Python packages (`packages/*`). Its core loop is
`script → tts → {avatar ∥ captions} → compose → upload`, rendered with pure FFmpeg.
- **WolfCut** (`wolfcut/`, upstream jub0t/Concat, **MPL-2.0**) is a local CapCut
alternative: a **Rust engine** (`wolfcut-core/media/project/render/export`) with a
**Tauri host** and a **React UI**. It owns the thing videogen lacks: a real
**multi-track timeline editor** with an authoritative document model, undo, and a
frame-accurate render/export path.
- **OpenScreen** (`openscreen/`, upstream siddharthvaddem/openscreen, **MIT**,
*archived upstream*) is a Screen Studio alternative: an **Electron + React + PixiJS**
app that owns **capture** — native screen/window recording (ScreenCaptureKit on
macOS, Windows Graphics Capture on Windows), webcam PiP, and the category-defining
**auto-zoom-on-cursor + cursor-smoothing** editor.
- **Natural division of labor:** **OpenScreen = capture** (get pixels in), **WolfCut
= timeline edit** (arrange/cut/render), **videogen = AI generation + orchestration**
(avatar, script, TTS, captions, B-roll, publish, billing, accounts). The suite is
one product that spans all three: *record or generate → edit on a timeline → publish.*
---
## 1. What each base is (assessment)
### 1.1 videogen / ReelForge (the product we are extending)
| Layer | Path | Stack | Owns |
|---|---|---|---|
| Backend API + pipeline | `apps/api/app` | Python 3.11, FastAPI, Celery+Redis, SQLAlchemy2/Alembic, Neon PG, R2 | Job DAG `script→tts→{avatar∥captions}→compose→upload`, 247 paths / 281 ops, 70 tables |
| Web | `apps/web` | Next.js 15; `src/features/editor` (active) + preserved `editor-module` (OpenCut, MIT) | Product UI, an in-progress web editor |
| Mobile | `apps/mobile` | Expo | Creator mobile client |
| Native desktop | `apps/desktop` | **Rust + GPUI**, ~35 `rf-*` crates (`rf-capture`, `rf-render`, `rf-compose`, `rf-encode`, `rf-captions`, `rf-effects`, `rf-project`, `rf-audio`…) | Today a **generation** workspace (submit/monitor jobs, media gateway, wallet) — *not yet an editor* |
| Shared pkgs | `packages/*` | TS (+ python parity) | `render-core` (RenderSpec→FFmpeg filtergraph, TS/Py bit-identical), `caption-engine`, `effects-core`, `api-contract`, `provider-adapter-kit`, `ui-kit`, SDKs |
Key facts that shape the plan:
- videogen **already has precedent for absorbing an OSS editor**: `apps/web/editor-module`
is a preserved OpenCut (MIT) editor being migrated into `apps/web/src/features/editor`.
- videogen **already has a native Rust media stack** in `apps/desktop/crates/*`
(including `rf-capture` = "native screen/camera capture ffmpeg argv builder" and a
render/compose/encode/project chain). This overlaps heavily with *both* WolfCut's
engine and OpenScreen's capture — the plan must dedupe, not triplicate.
- Prior research already flagged OpenScreen: `docs/reelforge/RESEARCH_ROUND2_CAPCUT_EDITORS.md`
calls it "**Highest-ROI new find**" for auto-zoom/cursor and proposed porting the
zoom/cursor-keyframe logic server-side into `compose_ffmpeg.py`. This plan is the
desktop-suite superset of that server-side idea.
### 1.2 WolfCut (`wolfcut/`) — the editor engine
- **License:** MPL-2.0 (engine + desktop). File-level copyleft.
- **Shape:** `engine/` is a standalone Cargo **workspace** (`resolver=3`, edition 2024,
Rust ≥1.93) of 6 crates with a strict inward dependency arrow:
- `wolfcut-core` (~1.4k LOC) — rational time, frame model, timeline model, zero deps.
- `wolfcut-media` (~3.0k) — all FFmpeg: probe, decode/encode, LRU frame cache, waveforms.
- `wolfcut-project` (~3.3k) — the **document**: model, edit commands, undo `Editor`,
`wolfcut.json` round-trip. Top-level doc: `{ media, tracks, clips, fonts, timelines, settings }` (serde, camelCase).
- `wolfcut-render` (~1.3k) — compositing; `CpuCompositor` reference + optional `WgpuCompositor` (`gpu` feature).
- `wolfcut-export` (~2.2k) — timeline→file: flatten, FFmpeg filtergraph builders, frame loop.
- `wolfcut-cli` — `wolfcut probe|render` vertical slice (binary name `wolfcut`), no UI.
- **Host/UI:** `wolfcut/desktop/` — Tauri v2 host (`src-tauri`, 39 `#[tauri::command]`) +
React 19 UI (`src/`). Engine is consumed as **path deps**, deliberately *not* one
workspace, so the engine builds/tests/versions alone. Wire types are ts-rs generated.
- **Doctrine:** "everything important lives in the engine crates; the Tauri host is
plumbing; the UI renders state and sends commands." The engine owns model + undo +
render + document format. This makes the engine **reusable as a library** independent
of Tauri — the single most important fact for integration.
- **Capabilities:** multi-track/multi-timeline editing, split/trim/merge, transitions,
speed, on-device Whisper auto-captions, local TTS, voice filters, titles/styled text,
templates. No watermark, fully local.
### 1.3 OpenScreen (`openscreen/`) — the recorder
- **License:** MIT. Permissive. **Upstream archived** (community fork exists at
EtienneLescot/openscreen); we own our checkout.
- **Shape:** Electron + React + Vite + PixiJS (WebGL compositing). Node 22.22.1.
- `electron/` — main process, IPC, `recording/`, `native/` + `native-bridge/`
(native capture helpers), global shortcuts, windows.
- `scripts/build-macos-screencapturekit-helper.mjs` / `build-windows-wgc-helper.mjs`
— build native capture sidecars (Swift/ScreenCaptureKit; C++/WGC).
- `src/` — React editor UI (PixiJS canvas), contexts, hooks, i18n (13 languages).
- **Capabilities:** window/screen capture, mic + system audio, webcam PiP, **auto & manual
zoom** (depth/duration/easing/pixel-precise, cursor-following), custom cursor
size/smoothing/click-effects/themes, on-device captions, backgrounds
(wallpaper/gradient/image), motion blur, crop/trim/per-segment speed, text/arrow/image
annotations, snapping + waveform, export MP4/GIF in multiple aspect ratios/resolutions.
- **Linux caveat:** native capture is macOS/Windows only; Linux falls back to the
browser pipeline (position-only cursor, no custom-cursor features).
### 1.4 Overlap map (why we must dedupe, not stack)
| Concern | OpenScreen | WolfCut | videogen `apps/desktop` crates | videogen `apps/api` | **Suite owner (proposed)** |
|---|---|---|---|---|---|
| Native screen/cam capture | ✅ native helpers | ❌ | `rf-capture` (argv builder) | ❌ | **OpenScreen** (proven native pipeline) |
| Auto-zoom / cursor punch-in | ✅ (category-defining) | ❌ | ❌ | port target (research) | **OpenScreen** logic → shared spec |
| Multi-track timeline + undo + doc model | ❌ (single-clip-ish) | ✅ engine | `rf-project` (partial) | ❌ | **WolfCut engine** |
| Compositing / render / export (FFmpeg) | PixiJS + ffmpeg | ✅ engine | `rf-render/compose/encode` | `compose_ffmpeg.py` | **WolfCut engine** for edit; keep `apps/api` for batch gen |
| Captions | on-device | Whisper on-device | `rf-captions` | ASS karaoke authority | **videogen** timing authority; editors consume |
| AI gen (avatar/script/TTS/B-roll) | ❌ | local TTS only | via gateway | ✅ core | **videogen** |
| Accounts / billing / publish / templates | ❌ | ❌ | wallet | ✅ core | **videogen** |
**Conclusion:** OpenScreen and WolfCut are complementary (capture vs edit) with
minimal mutual overlap. Both overlap with the *nascent* `apps/desktop/crates/rf-*`
media stack — that stack should converge onto the WolfCut engine rather than grow a
parallel third implementation.
---
## 2. Target architecture — one suite
```
┌─────────────────────────────────────────────┐
│ videogen / ReelForge │
│ apps/api (FastAPI + Celery) · accounts, │
│ billing, avatar/script/TTS/B-roll, publish, │
│ templates, credits, media gateway, R2 │
└───────────────▲───────────────▲──────────────┘
│ REST /api/v1 │ generated clips (R2 URLs)
┌─────────────────┘ └─────────────────┐
┌────────────┴────────────┐ ┌──────────────┴───────────┐
│ RECORD (OpenScreen) │ capture.mp4 + │ EDIT (WolfCut engine) │
│ native ScreenCaptureKit│ cursor/zoom keyframes│ timeline · undo · render │
│ / WGC · webcam · auto- │──────────────────────▶│ export · wolfcut.json │
│ zoom · cursor · caps │ (handoff = project) │ │
└─────────────────────────┘ └──────────────────────────┘
shared: RenderSpec / project JSON, R2 asset URLs, caption timing
```
**Integration seam = a shared project/handoff format**, not shared UI. Each surface
speaks the same two contracts:
1. **Asset handoff** — an R2 URL (or local path) + probe metadata for any clip, whether
it came from OpenScreen capture or a videogen AI job.
2. **Project handoff** — a `wolfcut.json`-shaped document (or a small adapter into it) so
a recording, a generated avatar reel, and manual edits land on one timeline.
---
## 3. Reuse vs replace
| Piece | Decision | Rationale |
|---|---|---|
| WolfCut **engine crates** (`wolfcut-core/media/project/render/export`) | **REUSE as-is** (path/git dep) | Clean, standalone, engine-doctrine → embeddable as a library. This is the crown jewel. |
| WolfCut **Tauri host + React UI** | **REUSE, reskin later** | Ship the editor first; rebrand + trim to videogen design system in a later phase. |
| WolfCut local TTS / captions | **KEEP but defer to videogen** where a job already has ElevenLabs timing (single-source-of-truth rule) | Avoid double alignment; use engine captions only for local-only edits. |
| OpenScreen **capture (electron/native helpers)** | **REUSE as-is** | Native ScreenCaptureKit/WGC is expensive to rebuild; MIT lets us adopt freely. |
| OpenScreen **auto-zoom / cursor keyframe logic** | **REUSE + extract to a shared spec** | Highest-ROI feature; also feeds the server-side `compose_ffmpeg.py` port already scoped in research. |
| OpenScreen **PixiJS editor UI** | **REPLACE over time** with the WolfCut timeline | Two editors is the thing to avoid. OpenScreen becomes *capture + zoom authoring*; heavy editing migrates to WolfCut. |
| videogen `apps/desktop/crates/rf-render/compose/encode/project` | **CONVERGE onto WolfCut engine** (don't grow a 3rd stack) | Prefer one Rust media engine. Migrate `rf-*` call sites to WolfCut crates incrementally; keep `rf-gateway/provider/wallet/growth` (product-specific). |
| videogen `apps/web/src/features/editor` (OpenCut) | **RE-EVALUATE** vs WolfCut | If WolfCut becomes the desktop editor, the web editor is either (a) a lighter web-only variant or (b) retired in favor of WolfCut-in-Tauri. Decide in Phase 2. |
| videogen `apps/api` pipeline | **KEEP unchanged** | Batch AI generation + publish + billing is the product moat; editors are clients of it. |
---
## 4. How the editors connect to videogen's AI generation
Two directions, both over the existing `/api/v1` contract:
1. **Generate → edit.** A videogen Job finishes (`compose` stage) and produces a 1080×1920
MP4 in R2. The suite offers "Open in editor": the clip (URL + probe) is wrapped into a
minimal `wolfcut.json` (one media item, one clip on one video track) and opened in the
WolfCut engine. The creator trims, adds B-roll, retimes, exports. See the Phase-1
adapter stub in `docs/reelforge/editing-suite/` (§ First Step).
2. **Record → generate → edit.** OpenScreen captures a screen demo (+ cursor/zoom
keyframes). The recording is uploaded to videogen as a source asset; the creator
attaches an AI avatar / script / captions job (`script→tts→avatar∥captions→compose`),
then drops both the screen capture and the avatar reel onto one WolfCut timeline.
Caption timing stays governed by videogen's **single-source-of-truth rule** (ElevenLabs
`/with-timestamps` when a job exists); editor-local captions (Whisper) are only for
assets with no job-side timing.
---
## 5. Phased roadmap
**Phase 0 — Vendoring & attribution (this task).**
Bases are already checked out under `videogen/wolfcut` and `videogen/openscreen`.
Record licenses (MPL-2.0 / MIT) in `THIRD_PARTY_NOTICES.md` / `docs/reelforge/VENDORED-OSS.md`.
Document exact build/run for both (done — § First Step). No wiring yet.
**Phase 1 — Prove the seam (thin, additive).**
- Stand up WolfCut and OpenScreen independently from our checkouts (build/run doc).
- Land the **generate→edit adapter**: videogen Job clip → `wolfcut.json` → opens in the
WolfCut engine (start with `wolfcut-cli`/engine test harness, no UI change).
- Deliverable: one generated reel opened on the WolfCut timeline.
**Phase 2 — One editor of record.**
- Choose WolfCut (Tauri) as the desktop editor of record. Decide fate of
`apps/web/src/features/editor` (OpenCut) and `apps/desktop` GPUI generation client
(likely: GPUI stays the *generation/wallet* shell; WolfCut is the *editor* — or merge).
- Begin converging `apps/desktop/crates/rf-render/compose/encode/project` onto WolfCut
engine crates to kill the duplicate media stack.
**Phase 3 — Capture into the suite.**
- Wrap OpenScreen as the **recorder**: launch from the suite, capture, and hand the
recording (+ zoom/cursor keyframes) to videogen upload + the WolfCut timeline.
- Extract OpenScreen's auto-zoom/cursor-keyframe logic into a shared spec that feeds both
the timeline and the server-side `compose_ffmpeg.py` port (already scoped in research).
**Phase 4 — Unify & reskin.**
- Single brand/design-system shell; trim OpenScreen's PixiJS editor to capture+zoom only;
retire duplicate editors; wire accounts/credits/publish through videogen across all
surfaces.
---
## 6. Licensing notes (must-follow)
- **WolfCut = MPL-2.0.** *File-level* copyleft (weaker than GPL): we may ship it inside a
larger, otherwise-proprietary product, **but** any WolfCut source files we **modify**
must remain MPL and be offered in source form; larger-work / proprietary files can stay
closed. Practical rule: **keep WolfCut engine crates in their own directory, modify
sparingly, upstream-track**, and add them to `THIRD_PARTY_NOTICES.md`. Distributing
`apps/desktop` triggers the offer-source obligation for modified MPL files.
- **OpenScreen = MIT.** Permissive; keep the copyright + permission notice, list it in
`THIRD_PARTY_NOTICES.md` / `VENDORED-OSS.md`. No source-offer obligation.
- **Do not entangle** WolfCut MPL files and MIT/proprietary files in the *same* source
file — keep the MPL boundary at the file/crate level so the copyleft stays contained.
- Consistent with videogen's existing OSS policy (`docs/reelforge/VENDORED-OSS.md`): no
GPL adopted; `apps/desktop` is distributed, so GPL would be viral — MPL/MIT are safe.
- OpenScreen upstream is **archived**; we maintain our own fork. Track the community
fork (EtienneLescot/openscreen) for security fixes.
---
## 7. Risks
| Risk | Severity | Mitigation |
|---|---|---|
| **Three media stacks** (WolfCut engine, `apps/desktop/rf-*`, OpenScreen ffmpeg) diverge | High | Phase 2 convergence onto WolfCut engine; freeze `rf-render/compose` growth. |
| **Two editors** (WolfCut timeline vs OpenScreen PixiJS vs web OpenCut) confuse scope | High | Phase 2 "editor of record" decision; OpenScreen demoted to capture+zoom. |
| MPL modified-file source-offer obligation missed at distribution | Med | File-level boundary + `THIRD_PARTY_NOTICES.md`; sparse edits; CI license check. |
| OpenScreen archived → bit-rot, native-helper build breakage (Swift/WGC toolchains) | Med | Pin toolchains; adopt community fork fixes; CI the native-helper builds. |
| Tauri (WolfCut) + Electron (OpenScreen) + GPUI (`apps/desktop`) = three shells | Med | Long-term pick one shell; near-term keep separate, integrate via files/URLs not process embedding. |
| Caption double-alignment (editor Whisper vs job ElevenLabs) breaks timing authority | Med | Enforce single-source-of-truth rule; editor captions only for job-less assets. |
| Linux capture gap in OpenScreen | Low | Document; browser-pipeline fallback already exists upstream. |
| Engine `wolfcut.json` schema drift vs adapter | Low | Adapter targets the documented top-level doc shape; add a golden round-trip test. |
---
## 8. Open decisions (for the owner)
1. **Editor of record:** WolfCut-in-Tauri as the one desktop editor, and what becomes of
the GPUI `apps/desktop` (generation shell) and the web OpenCut editor?
2. **Shell strategy:** live with Tauri + Electron + GPUI short-term, or converge?
3. **Engine convergence depth:** fully migrate `rf-render/compose/encode/project` onto
WolfCut crates, or keep `rf-*` for server-side batch and use WolfCut only in-editor?
4. **Vendoring mode:** keep `wolfcut/` + `openscreen/` as sibling checkouts, or promote
into `apps/recorder` + `apps/editor` (or `external/`) with our own THIRD_PARTY notices?
---
## 9. Decision record (ADR)
### ADR-001 — WolfCut is the editor of record; Diffusion Studio is a non-integrated alternate
- **Date:** 2026-09-21
- **Status:** Accepted
- **Deciders:** Owner
- **Supersedes/resolves:** Open decision § 8.1 ("Editor of record"), for the choice of
timeline editor engine. (The fate of the GPUI `apps/desktop` generation shell and the
web OpenCut editor remains as scoped in Phase 2 / § 3 and is not changed here.)
**Context.** The suite needs exactly one authoritative timeline-editor engine (see
§ 7 risk "Two editors"). Two candidates were on the table:
- **WolfCut** (`wolfcut/`, jub0t/Concat, MPL-2.0) — the Rust engine-doctrine editor
assessed in § 1.2: standalone engine crates, authoritative document model
(`wolfcut.json`), undo, and a frame-accurate render/export path, reusable as a library.
- **Diffusion Studio** (`diffusionstudio/editor`) — a browser-based, WebGPU/WebCodecs
video editor evaluated as an alternate engine.
**Decision.** **WolfCut is Menivor's editor of record.** All editor integration work
(the generate→edit adapter of § 4, the `wolfcut.json` handoff seam of § 2, and the
`rf-*` engine convergence of § 3 / Phase 2) targets the WolfCut engine.
**diffusionstudio/editor is retained only as an alternate and will NOT be integrated.**
No Diffusion Studio integration code is to be written, vendored, or wired into any app.
It is kept on record solely as a fallback option should WolfCut be re-evaluated in the
future; adopting it would require a new ADR that supersedes this one.
**Consequences.**
- The § 2 integration seam (shared project/handoff format) is defined against the
WolfCut `wolfcut.json` document shape, not any Diffusion Studio format.
- No Diffusion Studio dependency, checkout, or build enters the tree; § 6 licensing
notes and `THIRD_PARTY_NOTICES.md` are unaffected by this decision.
- The § 7 "Two editors" risk is narrowed: the editor-engine choice is settled; remaining
editor surfaces (OpenScreen PixiJS, web OpenCut) are demoted/re-evaluated per the
existing phased roadmap, not by adding a third engine.
- Revisiting this choice (e.g. adopting Diffusion Studio) is an explicit, deliberate act:
it requires a superseding ADR entry in this section.