VideoReader
- class lib.video.VideoReader(video_file: str, fast_count: bool = True, stream_index: int = 0, pts: list[int] | None = None, keyframes: list[int] | None = None)
Bases:
objectA wrapper around pyAV that allows obtaining frames by frame index and iterating video files
- Parameters:
video_file (str) – Full path to a video file
fast_count (bool) – Whether to obtain the count of frames quickly, but inaccurately or slowly but accurately. If pts and keyframes are provided then the count will be derived from the provided pts file. Default:
Truestream_index (int) – The stream index to select from the video file. Default: 0
pts (list[int] | None) – The Presentation Timestamps if available or
Noneto retrieve from the video. Default:Nonekeyframes (list[int] | None) – The keyframe frame indices if available or
Noneto retrieve from the video. Default:None
Attributes Summary
The metadata information for the video file
Methods Summary
close()Shut down the AV Container object
get(index)Obtain the video frame at the given frame index
Attributes Documentation
- info
The metadata information for the video file
Methods Documentation
- close() None
Shut down the AV Container object
- Return type:
None
- get(index: int) VideoFrame
Obtain the video frame at the given frame index
- Parameters:
index (int) – The index number of the frame to retrieve
- Return type:
The pyAV frame object for the given index
- __next__() VideoFrame
Obtain the next video frame object
- Return type:
The next available video frame object
- close() None
Shut down the AV Container object
- Return type:
None
- get(index: int) VideoFrame
Obtain the video frame at the given frame index
- Parameters:
index (int) – The index number of the frame to retrieve
- Return type:
The pyAV frame object for the given index