spdl.io.decode_packets_nvdec¶
- decode_packets_nvdec(packets: VideoPackets, *, device_config: CUDAConfig, pix_fmt: str = 'rgb', **kwargs) CUDABuffer [source]¶
[Experimental] Decode packets with NVDEC.
Warning
This API is exmperimental. The performance is not probed, and the specification might change.
Changed in version 0.0.10:
The alpha channel was removed, and the supported format values were changed from
"rgba"
and"bgra"
to"rgb"
and"bgr"
.width
andheight
options were renamed toscale_width
andscale_height
.
Note
Unlike FFmpeg-based decoding, NVDEC returns GPU buffer directly.
See also
NvDecDecoder
: The underlying decoder implementation, which supports incremental decoding.- Parameters:
packets – Packets object.
device_config – The device to use for decoding. See
spdl.io.cuda_config()
.crop_left (int) – Optional: Crop the given number of pixels from each side.
crop_top (int) – Optional: Crop the given number of pixels from each side.
crop_right (int) – Optional: Crop the given number of pixels from each side.
crop_bottom (int) – Optional: Crop the given number of pixels from each side.
scale_width (int) – Optional: Resize the frame. Resizing is done after cropping.
scale_height (int) – Optional: Resize the frame. Resizing is done after cropping.
pix_fmt (str or None) – Optional: Change the format of the pixel. Supported value is
"rgb"
and"bgr"
. Default:"rgb"
.
- Returns:
A CUDABuffer object.