animation_plot

Function animation_plot 

Source
pub fn animation_plot<'a>(
    ani: &'a Vec<Vec<Vec<(u8, u8, u8)>>>,
) -> AnimationPlotBuilder<'a>
Expand description

Creates a video or animation from a series of frames or existing image files.

§Example

use cgrustplot::plots::animation_plot::*;
let frames: Vec<Vec<Vec<(u8, u8, u8)>>> = (0..100).map(|frame| (0..50).map(|y| (0..100).map(|x| (x as f64 + 0.1 * frame as f64).sin() * (y as f64 + 0.1 * frame as f64).sin()).map(|x| (127. * (x + 1.)) as u8).map(|n| (n, n, n)).collect()).collect()).collect();
animation_plot(&frames).set_rel_path("testoutput/doctest_animation_plot.mp4").save();

§Options

  • ani - The inputted vector of frames.
  • path - The path to save the output video file to. Default is “./output.mp4”.
  • framerate - The framerate of the output video.
  • compression - The CRF value for FFmpeg: higher is more compressed. Default is 23.
  • encoding_speed - The encoding speed for FFmpeg, given by animation_plot::EncodingSpeed enum. Default is Fast.
  • overwrite - Whether or not to overwrite an existing file of the same name. Default is false.

§Notes

FFmpeg must be installed.