Videos#
Lossless videos of matplotlib figures (VP9 lossless in WebM).
Every frame decodes to exactly the rendered pixels, so colours can be read against the colour bar. The files stay small when consecutive frames differ little, since VP9 codes the differences. They play in browsers, VS Code and VLC (not QuickTime). Needs ffmpeg with libvpx-vp9. Used by Target.planet_video (toycoronagraph.main) and observe.video.
- toycoronagraph.video.write_video(fig, update, frames, path, fps=20, dpi=100)[source]#
Write a figure animated frame by frame to a lossless WebM file.
- Parameters:
fig (matplotlib.figure.Figure) – The figure (not closed here).
update (callable) – update(i) changes the figure for frame i (0 … frames-1); it may be called more than once for a frame.
frames (int) – Number of frames.
path (str) – The .webm file to write.
fps (int) – Frames per second.
dpi (int) – Dots per inch of the frames.
- Returns:
path.
- Return type:
str