Skip to main content

export_edited_project

Function export_edited_project 

Source
pub fn export_edited_project(
    project: EditProject,
    source: &Path,
    output_path: PathBuf,
    format: OutputFormat,
    cancel: &AtomicBool,
    on_progress: impl FnMut(u64, u64),
) -> Result<PathBuf, String>
Expand description

Export an entire edited project to a single video file (ED.21).

Drives the ExportFrameGenerator frame by frame into a fresh [LiveGstreamerEncoder] (reused unchanged from the live recorder), then finalizes the container. Synchronous and long-running — call it from a blocking task. cancel is polled once per frame (for the export UI, ED.22) and on_progress(done, total) reports after each frame.

The output is composed at the project’s aspect-ratio canvas ([EditProject::canvas_dims], AUT-513) — the source reframed to 16:9 / 9:16 / 1:1 / 4:3, letterboxed/pillarboxed without stretch — clamped to the HW-encoder edge cap. The zoom punch-ins (ED.16), crop (ED.15), and background framing (ED.18 — backdrop, padding, rounded corners, shadow, inset border) are all baked into each frame by the generator; the per-segment audio retime (ED.21) muxes on at finalize.

§Errors

Returns a message if the source can’t be opened, the encoder can’t start, a frame fails to encode, or cancel fired mid-export.