Skip to main content

render_with_progress

Function render_with_progress 

Source
pub fn render_with_progress<F>(
    args: RenderConfig,
    on_progress: F,
) -> Result<RenderReport, String>
Expand description

Like render, but calls on_progress while ffmpeg works: once with frame 0 when encoding starts, then about twice a second, and with 100% at the end. Use it to drive a progress bar in a GUI or another tool.

render_with_progress(cfg, |p| {
    println!("{:.0}% ({}/{} frames)", p.percent, p.frame, p.total_frames);
})?;