spdl.io.nvdec_decoder¶
- nvdec_decoder(cuda_config: CUDAConfig | None = None, codec: VideoCodec | None = None, *, use_cache: bool = True, crop_left: int = 0, crop_top: int = 0, crop_right: int = 0, crop_bottom: int = 0, scale_width: int = -1, scale_height: int = -1) NvDecDecoder[source]¶
Instantiate an
NvDecDecoderobject.- Parameters:
cuda_config – The device configuration. Specifies the GPU of which video decoder chip is used, the CUDA memory allocator and CUDA stream used to fetch the result from the decoder engine. If not provided, the decoder will not be initialized.
codec – The information of the source video. If not provided, the decoder will not be initialized.
use_cache – If
True(default), the decoder instance cached in thread local storage is used. Otherwise a new decoder instance is created. Note: If crop parameters are provided, the decoder will always be recreated regardless of this flag.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 applied after cropping.
scale_height (int) – Optional: Resize the frame. Resizing is applied after cropping.
Changed in version 0.1.7: Calling
nvdec_decoder()withoutcuda_configandcodecis deprecated. Pass these parameters directly to initialize the decoder. The old pattern of callingdecoder.init()afternvdec_decoder()will be removed in a future version.