python_vali.PyDecoder¶
- class python_vali.PyDecoder¶
Video decoder class.
- __init__(self: python_vali._python_vali.PyDecoder, input: str, opts: Dict[str, str], gpu_id: int = 0) None ¶
Constructor method.
- Parameters:
input – path to input file
opts – AVDictionary options that will be passed to AVFormat context.
gpu_id – GPU ID. Default value is 0. Pass negative value to use CPU decoder.
Methods
DecodeSingleFrame
(*args, **kwargs)Overloaded function.
DecodeSingleSurface
(*args, **kwargs)Overloaded function.
__init__
(self, input, opts[, gpu_id])Constructor method.
Attributes
Return encoded video file average framerate.
Return encoded video bitrate in bits per second.
Get color range information stored in video file.
Get color space information stored in video file.
Return encoded video delay.
Return video duration time in seconds.
Return encoded video file pixel format.
Return encoded video file framerate.
Return encoded video GOP size.
Return encoded video file height in pixels.
Return amount of bytes needed to store decoded frame.
Return true if decoder has HW acceleration support, false otherwise.
Return true if video has variable framerate, false otherwise.
Return encoded video level coding parameter.
Return dictionary with video file metadata.
Return motion vectors of last decoded frame.
Return number of video frames in encoded video file.
audio and video.
Return encoded video profile coding parameter.
Return video start time in seconds.
Return number of current video stream in file.
Return encoded video file time base.
Return encoded video file width in pixels.
- property AvgFramerate¶
Return encoded video file average framerate.
- property Bitrate¶
Return encoded video bitrate in bits per second.
- property ColorRange¶
Get color range information stored in video file. Please not that some video containers may not store this information.
- Returns:
color range information
- property ColorSpace¶
Get color space information stored in video file. Please not that some video containers may not store this information.
- Returns:
color space information
- DecodeSingleFrame(*args, **kwargs)¶
Overloaded function.
DecodeSingleFrame(self: python_vali._python_vali.PyDecoder, frame: numpy.ndarray, seek_ctx: Optional[python_vali._python_vali.SeekContext] = None) -> Tuple[bool, python_vali._python_vali.TaskExecInfo]
Decode single video frame from input file. Only call this method for decoder without HW acceleration.
- param frame:
decoded video frame
- param pkt_data:
decoded video frame packet data, may be None
- param seek_ctx:
seek context, may be None
- return:
tuple, first element is True in case of success, False otherwise. Second elements is TaskExecInfo.
DecodeSingleFrame(self: python_vali._python_vali.PyDecoder, frame: numpy.ndarray, pkt_data: python_vali._python_vali.PacketData, seek_ctx: Optional[python_vali._python_vali.SeekContext] = None) -> Tuple[bool, python_vali._python_vali.TaskExecInfo]
Decode single video frame from input file. Only call this method for decoder without HW acceleration.
- param frame:
decoded video frame
- param pkt_data:
decoded video frame packet data, may be None
- param seek_ctx:
seek context, may be None
- return:
tuple, first element is True in case of success, False otherwise. Second elements is TaskExecInfo.
- DecodeSingleSurface(*args, **kwargs)¶
Overloaded function.
DecodeSingleSurface(self: python_vali._python_vali.PyDecoder, surf: VPF::Surface, seek_ctx: Optional[python_vali._python_vali.SeekContext] = None) -> Tuple[bool, python_vali._python_vali.TaskExecInfo]
Decode single video surface from input file. Only call this method for HW-accelerated decoder.
- param surf:
decoded video surface
- param pkt_data:
decoded video surface packet data, may be None
- param seek_ctx:
seek context, may be None
- return:
tuple, first element is True in case of success, False otherwise. Second elements is TaskExecInfo.
DecodeSingleSurface(self: python_vali._python_vali.PyDecoder, surf: VPF::Surface, pkt_data: python_vali._python_vali.PacketData, seek_ctx: Optional[python_vali._python_vali.SeekContext] = None) -> Tuple[bool, python_vali._python_vali.TaskExecInfo]
Decode single video surface from input file. Only call this method for HW-accelerated decoder.
- param surf:
decoded video surface
- param pkt_data:
decoded video surface packet data, may be None
- param seek_ctx:
seek context, may be None
- return:
tuple, first element is True in case of success, False otherwise. Second elements is TaskExecInfo.
- property Delay¶
Return encoded video delay.
- property Duration¶
Return video duration time in seconds. May not be present.
- property Format¶
Return encoded video file pixel format.
- property Framerate¶
Return encoded video file framerate.
- property GopSize¶
Return encoded video GOP size.
- property Height¶
Return encoded video file height in pixels.
- property HostFrameSize¶
Return amount of bytes needed to store decoded frame.
- property IsAccelerated¶
Return true if decoder has HW acceleration support, false otherwise.
- property IsVFR¶
Return true if video has variable framerate, false otherwise.
- property Level¶
Return encoded video level coding parameter.
- property Metadata¶
Return dictionary with video file metadata.
- property MotionVectors¶
- Return motion vectors of last decoded frame.
If there are no movion vectors it will return empty list.
- Returns:
list of motion vectors
- Return type:
List[vali.MotionVector]
- property NumFrames¶
Return number of video frames in encoded video file. Please note that some video containers doesn’t store this infomation.
- property NumStreams¶
audio and video.
- Type:
Return number of streams in video file. E. g. 2 streams
- property Profile¶
Return encoded video profile coding parameter.
- property StartTime¶
Return video start time in seconds.
- property StreamIndex¶
Return number of current video stream in file. E. g. video stream has index 0, and audio stream has index 1. This method will return 0 then.
- property Timebase¶
Return encoded video file time base.
- property Width¶
Return encoded video file width in pixels.