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

Parameters:
  • src – The source URI. Passed to Demuxer.

  • device_config – The CUDA device config. See NvDecDecoder for 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 contains num_frames frames 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() or nv12_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).