imageio.plugins.pyav.PyAVPlugin.init_video_stream
- PyAVPlugin.init_video_stream(codec: str, *, fps: float = 24, pixel_format: Optional[str] = None, max_keyframe_interval: Optional[,
Initialize a new video stream.
This function adds a new video stream to the ImageResource using the selected encoder (codec), framerate, and colorspace.
The codec to use, e.g. "h264" or "vp9".
The desired framerate of the video stream (frames per second).
The pixel format to use while encoding frames. If None (default) use the codec’s default.
The maximum distance between two intra frames (I-frames). Also known as GOP size. If unspecified use the codec’s default. Note that not every I-frame is a keyframe; see the notes for details.
If True, limit inter frames dependency to frames within the current keyframe interval (GOP), i.e., force every I-frame to be a keyframe. If unspecified, use the codec’s default.
You can usually leave max_keyframe_interval and force_keyframes
at their default values, unless you try to generate seek-optimized video
or have a similar specialist use-case. In this case, force_keyframes
controls the ability to seek to _every_ I-frame, and
max_keyframe_interval controls how close to a random frame you can
seek. Low values allow more fine-grained seek at the expense of
file-size (and thus I/O performance).