Module engine

Source
Expand description

Rendering / mixing / export engine. Pure CPU, RGBA8 + f32 audio. Shared by preview and export.

Modules§

autocut
Auto-cut: find “loud” segments (speech) vs “quiet” ones (ambient) in an audio clip from its waveform peaks (media::waveform::Peaks, 100 buckets/s) — no extra decoding. Pure functions, unit-tested.
blend
Blend modes and the per-pixel composite of a straight-alpha RGBA layer onto an opaque canvas.
capture
Screen recording and voiceover capture, both through ffmpeg child processes (no new deps).
compose
Compositor: renders the timeline at time t into an RGBA canvas. Used by preview (small canvas) and export (project-size canvas) — same output, so preview == export. The one gap left against the GL renderer: node graphs (Clip.graph) and the GPU-only effect kinds (effects::gpu_only) are not evaluated here; export::cpu_gaps names them in the export progress line.
convert
“Convert To…”: transcode a media file to another container/format with ffmpeg (no compositor): video ↔ gif, mp4 ↔ mov/mkv/webm, audio extraction (mp3/wav/m4a/flac), optional rescale with a chosen scaler. Runs on a background thread, reports through engine::export::Progress, never writes the destination until done (temp + rename, same as exports), never touches the source.
effects
Per-clip effects (CPU, RGBA8). apply runs on the decoded layer image (at its decode size, straight alpha) in stack order, before placement/blending. Pixel-sized parameters (blur radius, pixel block, wobble amplitude) are project pixels; scale = canvas px per project px converts them. Wobble is geometric: it does not touch pixels — the compositor adds wobble() to the placement.
export
Export: render the timeline with the CPU Compositor + Mixer and pipe it into ffmpeg.exe (-f rawvideo -pix_fmt rgba -s WxH -r fps -i pipe:0 + pre-mixed temp WAV), encoder chosen by the output extension / settings. Plus the lossless -c copy fast path for pure cuts of one source. Runs on a background thread; the UI polls Progress.
gpu
GPU renderer: the effect chain as OpenGL shaders, using eframe’s existing glow context.
import
Import timelines from other editors, with an honest per-item report.
mixer
Audio mixer: sums every audible audio clip at timeline time t into interleaved stereo f32. Used by playback (real-time, block by block) and export (offline to WAV). Handles speed/reverse (linear resampling), freeze (silence), volume/pan/fades (gains lerped across each block), transitions (gain crossfades with virtual clip extension — on video tracks too, so a transition between Sequence clips crossfades their audio with the picture) and Sequence clips on video tracks (their timeline mixed recursively, depth ≤ 8).
mixer_fx
Audio filters and bus routing: the DSP behind the mixer panel.
prerender
Pre-render (“movie mode”): render ranges at full quality into a cache so playback shows exactly what an export would, without re-running the effect chain every frame.
presets
Keyframe presets, motion presets and clip templates — capture from clips and apply back. Curve presets store keys normalised to 0..1 of the clip length (stretched to the target clip’s duration when applied) or as absolute seconds (kept as saved).
shaders
GLSL sources for every GPU effect (engine/gpu.rs compiles these).
shapes
Vector shapes and recorded drawings -> RGBA layers (CPU rasteriser; the GPU path samples the result).
style
Style summary: a deterministic Markdown description of how a project was edited — statistics an AI (or a human) can turn into a reusable style guide: format, duration, tracks, cut cadence (count, mean/median clip length, shortest/longest), transitions used (kinds, durations), effects (kinds + typical params), text styles (fonts, sizes, colours, outlines/shadows), colour labels, retimes, masks and node graphs, audio (levels, fades, music/SFX split by length), subtitles usage, the planner (done/todo), and the free-form notes verbatim. Also served by the MCP tool style.summary and exported via File ▸ Export Style Summary (.md).
subtitles
Subtitle file formats: SubRip (.srt) and WebVTT (.vtt) — parse (auto-detected) and write. Basic formatting tags (, , {\an8}, VTT cue settings) are stripped on import; text is kept as plain lines. Times are seconds.
text
Text rasterizer for Text clips: system fonts (fontdb) + ab_glyph. Produces a tight, straight-alpha RGBA image with fill, outline (dilated coverage), shadow (offset + box blur) and optional background box. Output is cached by (style.cache_key(), scale bits). scale = canvas px per project px, so a 72 px style at a 960-wide preview of a 1920 project renders at 36 px.
tracking
Point / area tracking (the Tracking pane): zero-mean normalised cross-correlation of a template patch over a search window, frame by frame, producing exactly the (x, y, t) point list a PathAsset holds — so a track can be saved as a project path and replayed onto a clip’s X/Y keyframes (Project::apply_path).
transcribe
Speech → text (whisper.cpp), the subtitle generator on top of it, and the double-take detector.
xmeml
Final Cut Pro 7 XML (xmeml v5) exporter — the interchange format both Premiere Pro (File → Import) and DaVinci Resolve (File → Import → Timeline) read. Video tracks (with clipitems: file path, in/out/start/end in frames, opacity/position if animated) and audio tracks (one per project audio track, channel-source by stream). Text clips are exported as a generator-less gap (Premiere/Resolve text isn’t interchangeable) — mention it in a comment. Paths as file://localhost/C:/... pathurls. Timebase = round(fps), NTSC flag when fps is fractional.