Skip to content

Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.

docs: repoint the export and preview docs at what survives the deletion

Etienne Lescot3889af803b04
diff --git a/technical-documentation/architecture/export-pipeline.md b/technical-documentation/architecture/export-pipeline.md
index 365542cea..c2606ccf8 100644
--- a/technical-documentation/architecture/export-pipeline.md
+++ b/technical-documentation/architecture/export-pipeline.md
@@ -3,8 +3,8 @@
The MP4 export drives the same Rust + Direct3D 11 compositor that powers the
live preview ([preview.md](preview.md) /
[native-compositor.md](native-compositor.md)), one segment at a time. The
-Electron renderer turns the project document into a `RenderPlan`, the
-renderer hands the plan and the per-segment source files to the napi addon
+Electron renderer turns the project document into the same `SceneDescription`
+the live preview uses plus an ordered clip list, hands both to the napi addon
through the `compositor` IPC domain, and the addon drives `poc-d3d`'s
`Player` + `Compositor::compose_frame` + AMF encoder + muxer to write one
`.mp4`. The renderer only watches progress; the actual rendering does not
@@ -12,80 +12,21 @@ leave the native process. Performance numbers, the bench, and the rejected
alternatives that drove the design live in
[engineering/rendering-performance.md](../engineering/rendering-performance.md).
-GIF and the legacy browser-side path are out of scope here: GIF has no native
-encoder yet (it has its own dedicated code path in
-`src/lib/exporter/gifExporter.ts`); the legacy path is the one the
-`RenderPlan` is being migrated away from.
+GIF is out of scope here: it has no native encoder yet, so it keeps its own
+dedicated code path in `src/lib/exporter/gifExporter.ts` — the one format
+the document adapter still renders in the renderer.
```mermaid
flowchart LR
DOC["AxcutDocument"]
- TSD["src/lib/ai-edition/exporter/renderPlan.ts<br/>buildRenderPlan / buildDocumentRenderPlan"]
- RP["RenderPlan<br/>output + segments + virtual-time effects + appearance + cursor + webcam"]
+ TSD["src/native/sceneDescription.ts<br/>resolveVisibleClips / buildSceneDescription"]
+ RP["clips + SceneDescription JSON<br/>layout + effects + background + zoom + cursor + webcam"]
ADDON["compositor_view.node addon<br/>exportMulti (Electron IPC)"]
NATIVE["poc-d3d::live::Player<br/>Compositor::compose_frame<br/>h264_amf encoder + mux"]
FILE["output.mp4"]
DOC --> TSD --> RP --> ADDON --> NATIVE --> FILE
```
-## The `RenderPlan`
-
-`src/lib/ai-edition/exporter/renderPlan.ts` is the pure-logic data model that
-turns an `AxcutDocument` into an ordered, per-clip plan. `documentExporter`'s
-[`buildDocumentRenderPlan`](../../src/lib/ai-edition/exporter/documentExporter.ts)
-is the single boundary that builds it; `ExportDialog` and the bench both go
-through it. Every length that crosses the boundary is in seconds or
-fractions, every output is in fractions of the output frame, and the plan
-itself is JSON-serialisable.
-
-```ts
-interface RenderSegment {
- clipId: string;
- assetId: string;
- videoUrl: string; // toFileUrl(asset.originalPath) — the doc is self-contained
- sourceStartSec: number; // clip in-point in the asset's media time
- sourceEndSec: number;
- timelineStartSec: number; // position on the (1:1-with-source, pre-speed) virtual timeline
- timelineEndSec: number;
- intraTrims: Interval[]; // trimRanges of THIS asset inside [start,end)
- cropRegion: CropRegion; // per-clip screen crop, fractions of the source
- sourceWidth: number;
- sourceHeight: number;
- camera: { videoUrl: string; offsetMs: number } | null; // per-asset webcam
- cursorSamples: CursorRecordingSample[]; // partitioned by assetId
-}
-
-interface RenderPlan {
- output: { width, height, frameRate, bitrate, codec };
- aspectRatioValue: number;
- segments: RenderSegment[]; // sorted by timelineStartSec
- zoomRegions: ZoomRegion[]; // VIRTUAL (output) time, no projection
- annotationRegions: AnnotationRegion[]; // same — captions are derived + joined here
- speedRegions: SpeedRegion[]; // same
- appearance: RenderPlanAppearance; // wallpaper, padding, radius, shadow, blur, motion
- cursor: RenderPlanCursor | null; // shared atlas + style; per-segment samples above
- webcam: RenderPlanWebcam; // shared layout/style; per-segment source above
-}
-```
-
-Effects (`zoomRegions`, `annotationRegions`, `speedRegions`) live on the
-plan in **virtual** (output) time. The segment loop already tracks the
-virtual-time cursor that an earlier design tried to compute up-front by
-projecting every region onto source time — that projection is what the TS
-exporter still does for the legacy single-source renderer; the segment
-loop does not need it.
-
-The plan also carries the `codec` as a WebCodecs encoder string per
-user-facing choice (`avc1.640033` for H.264, `hvc1.1.6.L120.90` for H.265,
-`vp09.00.10.08` for VP9). The native side's AMF encoder takes those
-strings and produces the matching mp4 track family.
-
-`isIdentityFastPathEligible(plan)` is a single boolean: one segment, no
-intra-trims, identity crop, no zoom/annotation, no cursor overlay, no
-speed, and `output.size === segment.source.size` → the renderer can take a
-stream-copy / remux-only fast path. Everything else goes through the full
-decode → composite → encode round trip.
-
## Segment loop
The renderer hands the addon `exportMulti(clips, outPath, sceneJson, params)`
@@ -133,35 +74,23 @@ and **one** encoder + muxer pair:
The WSOLA stretch is kicked off before the video loop so it overlaps
the encode and does not add to the wall.
-- **Output** is sized to the largest clip and honours the timeline's
- selected aspect ratio. `pickReferenceDimensions` (in `renderPlan.ts`)
- picks the largest source area, then `calculateMp4ExportSettings` maps
- quality + source dims + aspect ratio to the encoder width / height /
- bitrate.
-
-## Per-segment cursor
-
-`CursorRecordingSample.assetId` tags each sample, so the plan partitions
-the shared recording per segment (`cursorSamplesForAsset`,
-[`renderPlan.ts:178`](../../src/lib/ai-edition/exporter/renderPlan.ts)).
-Samples with no `assetId` belong to the primary asset — the convention that
-keeps single-asset projects rendering their cursor exactly as before.
-Untagged samples were the format before multi-asset cursor tagging
-landed; the fallback is the documented behaviour, not a heuristic.
-
-The shared parts of the cursor render — the sprite atlas and the style
-knobs (`scale`, `smoothing`, `motionBlur`, `clickBounce`, `clipToBounds`,
-`theme`) — live on `plan.cursor` once. The time-varying samples live per
-segment on `segment.cursorSamples`. A segment with no cursor samples
-renders with no cursor overlay, which is correct (the asset had no
-recording), not a gap.
+- **Output** honours the timeline's selected aspect ratio
+ (`resolveAspectRatioValue` over `getEditorSettings(document).aspectRatio` —
+ the same typed façade `buildSceneDescription` reads, so the dialog cannot
+ drift from the compositor). `ExportDialog`'s `tierOutputDims` feeds the
+ crop-aware **smallest** clip on the timeline to
+ [`calculateMp4ExportSettings`](../../src/lib/exporter/mp4ExportSettings.ts),
+ which maps quality + source dims + aspect ratio to the encoder
+ width / height / bitrate, and passes `width` / `height` to `exportMulti`.
+ Only "Source" quality targets those source dims; 720p / 1080p target a
+ fixed short side regardless.
## Output formats and codecs
The native MP4 export takes `width`, `height`, `frameRate`, and `codec` as
-parameters on `exportMulti` and writes H.264 (AMF) by default. The user-
-facing codec choice (H.264 / H.265 / VP9) is mapped by `renderPlan.ts` to
-the WebCodecs encoder string the addon's AMF encoder consumes; VP9
+parameters on `exportMulti` and writes H.264 (AMF) by default. The
+user-facing codec choice crosses as the plain `ExportVideoCodec` string
+(`"h264"` / `"h265"` / `"vp9"`) in those params; VP9
falls back to the same H.264 path on machines without a hardware VP9
encoder (software VP9 was measured too slow and removed — see
[native-compositor.md](native-compositor.md#known-gaps)). GIF is a
diff --git a/technical-documentation/architecture/preview.md b/technical-documentation/architecture/preview.md
index 000bd2b6c..574858302 100644
--- a/technical-documentation/architecture/preview.md
+++ b/technical-documentation/architecture/preview.md
@@ -16,12 +16,13 @@ and scene contract; the GPU-resident path it builds on is documented in
(preview fluidity, bench methodology, the trade-offs that drove this design) live
in [engineering/rendering-performance.md](../engineering/rendering-performance.md).
-## The two paths
+## The compositor path
-Two paths exist in the source tree. The native one is live; the Pixi-based second
-implementation is shipped but not reached from the editor surface.
+One compositor exists in the source tree, and it is the live one. A Pixi/WebGL
+single-canvas screen compositor was tried alongside it and removed once it was
+established that nothing mounted it.
-### Path A — native D3D compositor overlay (live)
+### Native D3D compositor overlay (live)
Mounted as the first child of `.previewFrame` by
[`NativeCompositorOverlay.tsx`](../../src/components/ai-edition/NativeCompositorOverlay.tsx).
@@ -60,20 +61,6 @@ addon's `LoadLibrary("avcodec-NN.dll")` resolves against the same pinned build t
crate links against
([`compositorViewService.ts:206`](../../electron/native-bridge/services/compositorViewService.ts:206)).
-### Path B — Pixi/WebGL single-canvas screen compositor (shipped, not mounted)
-
-[`preview-compositor/PreviewCompositor.tsx`](../../src/components/ai-edition/preview-compositor/PreviewCompositor.tsx)
-is the screen-only successor that decodes straight into a Pixi `VideoSource` and
-composites video + zoom + mask in one GPU draw call. It is not mounted by the
-editor shell; `PreviewCanvas.tsx:393-411` deliberately falls back to the
-`VirtualPreview` legacy path with a comment recording why
-("`PreviewCompositor` (Pixi v8) regressed the screen preview … `setPixiReady` +
-`canvasSize === {0,0}` on mount produces a 1x1 canvas that the resize effect never
-widens"). The module stays in the tree as the route the next Pixi hardening
-attempts to revive, but no flag in this branch re-enables it. `PreviewCompositor`
-is therefore dead code today and is referenced in this doc only as the
-"two paths" it was advertised as offering; the live path is the native overlay.
-
There is no fallback to a CPU/Canvas2D legacy compositor: before the native view
ships a frame, only the wallpaper painted by CSS is visible, and the cursor / zoom
DOM layers depend on the layout math (not the compositor) to know where to land.
diff --git a/technical-documentation/architecture/timeline-model.md b/technical-documentation/architecture/timeline-model.md
index b193bf7fd..bd3ca100d 100644
--- a/technical-documentation/architecture/timeline-model.md
+++ b/technical-documentation/architecture/timeline-model.md
@@ -157,7 +157,7 @@ in the same commit, or the project round-trips into an inconsistent state:
| **Native preview scene** | `src/native/sceneDescription.ts` (`:489, :508, :517, :531`) | Calls `projectRegionsToSource` for every region kind before serialising to the native compositor. |
| **Native playback sync** | `src/native/useNativePlaybackSync.ts` (`:22, :39`) | Resolves the RAW playhead through `resolveNativePosition` to feed `setActiveClip` / `presentTime`. |
| **Native compositor overlay** | `src/components/ai-edition/NativeCompositorOverlay.tsx` (`:3, :70`) | Same — `resolveNativePosition(currentTimeSec, nativeClips, document.timeline.clips)` — to keep preview in sync with the timeline ruler. |
-| **Multi-clip export** | `src/lib/ai-edition/exporter/documentExporter.ts` (`:223, :238, :260, :265`) + `src/lib/ai-edition/exporter/renderPlan.ts` | Projects regions to source per-clip through `region-ventilation`'s `projectRegionsToSourceTime`, then walks the multi-clip render plan; identity single-clip projects are unchanged. |
+| **Multi-clip export** | `src/lib/ai-edition/exporter/documentExporter.ts` | Projects regions to source per-clip through `region-ventilation`'s `projectRegionsToSourceTime`; identity single-clip projects are unchanged. |
| **Captions layer** | `src/lib/ai-edition/captions/cues.ts` (`:14-15` and `captionCuesToTextRegions`) | Caption cues are a derived view of the transcript; the projection to source at export goes through `projectRegionsToSourceTime` from `region-ventilation`, matching the multi-clip export path so preview and file agree. |
| **Agent LLM tools** | `electron/ai-edition/agent-tools.ts` (`:22-26, :80-95, :560-575, :772-820, :835-880, :952, :1025`) | Writes the same shape via `anchorRegionsWithDerivedMs` / `replacePillSpan` / `resolvePillIds`; reads it through `coalesceRegionsForRuler` (`coalesceForAgent`, `:77-86`) so the model reasons in virtual seconds over whole pills. |