spdl.io.streaming_load_video_nvdec¶
- streaming_load_video_nvdec(src: SourceType, device_config: CUDAConfig, *, num_frames: int, post_processing_params: dict[str, int | bool] | None = None, use_cache: bool = True) Iterator[CUDABuffer][source]¶
Load video from source chunk by chunk using NVDEC.
See also
streaming_nvdec_decoding: Demonstrates how to decode a long video using NVDEC.
- Parameters:
src – The source URI. Passed to
Demuxer.device_config – The CUDA device config. See
NvDecDecoderfor details.num_frames – The number of frames per batch.
post_processing_params – The post processing parameters passed to
NvDecDecoder.init.use_cache – If
True(default), the decoder instance cached in thread local storage is used. Otherwise a new decoder instance is created.
- Yields:
CUDA buffers in batches of
num_frames. Each yielded CUDA buffer containsnum_framesframes in NV12 format. The shape is(num_frames, height + height // 2, width). The bottom one-third contains interleaved UV plane, and the top part contains the Y plane.Use
nv12_to_rgb()ornv12_to_bgr()to convert to RGB frames.
Changed in version 0.2.0: The return type was changed from a list of CUDABuffer (single frames) to a single CUDABuffer (a batch of frames).