Skip to main content

render_stream

Function render_stream 

Source
pub fn render_stream<R, F>(
    args: RenderConfig,
    frames: R,
    expected_frames: Option<u32>,
    on_progress: F,
) -> Result<RenderReport, String>
where R: Read + Send + 'static, F: FnMut(RenderProgress),
Expand description

Render a PNG stream: PNG files back to back, as written by aether-renderer-capture --stdout or ffmpeg -f image2pipe -c:v png -. No temp files: the bytes go straight to ffmpeg’s stdin. args.input is ignored.

expected_frames is optional. Without it progress reports total_frames: 0 (unknown) and percent: 0 until the end, and fade_out can’t be used, since it needs to know where the stream ends.

let frames = std::fs::File::open("frames.pngstream").map_err(|e| e.to_string())?;
render_stream(cfg, frames, Some(120), |p| println!("{}/{}", p.frame, p.total_frames))?;