imageio.plugins.pyav.PyAVPlugin.write_frame#

PyAVPlugin.write_frame(frame: ndarray, *, pixel_format: str = 'rgb24') None[source]#

Add a frame to the video stream.

This function appends a new frame to the video. It assumes that the stream previously has been initialized. I.e., init_video_stream has to be called before calling this function for the write to succeed.

Parameters:
framenp.ndarray

The image to be appended/written to the video stream.

pixel_formatstr

The colorspace (pixel format) of the incoming frame.

Notes

Frames may be held in a buffer, e.g., by the filter pipeline used during writing or by FFMPEG to batch them prior to encoding. Make sure to .close() the plugin or to use a context manager to ensure that all frames are written to the ImageResource.