Skip to main content
`Ctrl`+`K`

# imageio.plugins.pyav.PyAVPlugin.write_frame

PyAVPlugin.write_frame(frame: ndarray, *, pixel_format: str = 'rgb24') → None

  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:
    frame np.ndarray

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

    pixel_format str

      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.