spdl.io.VideoFrames¶
- class VideoFrames[source]¶
Video frames.
Methods
clone
()Clone the frames, so that data can be converted to buffer multiple times.
Attributes
The height of video.
The number of video frames.
The number of planes in the each frame.
The name of the pixel format.
The width of video.
- __getitem__(key: int) ImageFrames [source]¶
- __getitem__(key: slice) VideoFrames
- __getitem__(key: list[int]) VideoFrames
Slice frame by key.
- Parameters:
key – If the key is int type, a single frame is returned as
ImageFrames
. If the key is slice type, a newVideoFrames
object pointing the corresponding frames are returned.- Returns:
The sliced frame.
- clone() VideoFrames [source]¶
Clone the frames, so that data can be converted to buffer multiple times.
- Returns:
A clone of the frame.
- property num_planes: int[source]¶
The number of planes in the each frame.
Note
This corresponds to the number of color components, however it does not always match with the number of color channels when the frame is converted to buffer/array object.
For example, if a video file is YUV format (which is one of the most common formats, and comprised of different plane sizes), and color space conversion is disabled during the decoding, then the resulting frames are converted to buffer as single channel frame where all the Y, U, V components are packed.
SPDL by default converts the color space to RGB, so this is usually not an issue.