DeepStream Libraries (Developer Preview)

DeepStream Libraries provide CVCUDA, NvImageCodec, and PyNvVideoCodec modules as Python APIs to easily integrate into custom frameworks. Developers can build complete Python applications with fully accelerated components leveraging intuitive Python APIs. Most of the DeepStream Libraries building blocks and their Python APIs are available today as standalone packages. DeepStream Libraries provide a way for Python developers to install these packages with a single installer. All these packages are built against the same CUDA version and validated with the specified driver version. Reference applications are provided to demonstrate the usage of Python APIs.

DeepStream Libraries Installation

  1. Download DeepStream Libraries wheel file from NGC.

  • Download wheel file from this NGC link

  1. Install DeepStream Libraries package.

$ pip3 install deepstream_libraries-1.0-cp310-cp310-linux_x86_64.whl

DeepStream Libraries Repository Setup

To run sample apps, follow below steps:

  1. Clone DeepStream Libraries repo.

$ git clone
$ cd deepstream_libraries
  1. Install dependencies.

Install all the dependent packages required by sample apps:

$ sudo sh scripts/
  1. Download test files

Download images/videos to run sample apps:

$ sh scripts/

Getting Started with DeepStream Libraries APIs

We can use DeepStream Libraries API’s to create an application.

Consider the below reference example:

  • Read an image from the given file path using NvImageCodec

  • Resize the image with specified dimensions and Cubic interpolation method using CVCUDA

  • Save the resized image using NvImageCodec

    # Import necessary libraries
    import cvcuda
    from nvidia import nvimgcodec
    # Create Decoder
    decoder = nvimgcodec.Decoder()
    # Read image with nvImageCodec
    inputImage ="path/to/image.jpg")
    # Pass it to cvcuda using as_tensor
    nvcvInputTensor = cvcuda.as_tensor(inputImage, "HWC")
    # Resize with cvcuda to 320x240
    cvcuda_stream = cvcuda.Stream()
    with cvcuda_stream:
        nvcvResizeTensor = cvcuda.resize(nvcvInputTensor, (320, 240, 3), cvcuda.Interp.CUBIC)
    # Write with nvImageCodec
    encoder = nvimgcodec.Encoder()
    output_image_path = "output.jpg"
    encoder.write(output_image_path, nvimgcodec.as_image(nvcvResizeTensor.cuda(), cuda_stream = cvcuda_stream.handle))

Sample Applications

DeepStream Libraries Sample Apps




A CUDA-accelerated image and video classification pipeline integrating PyTorch or TensorRT for efficient processing on NVIDIA GPUs


GPU accelerated Object detection using CV-CUDA library with TensorFlow or TensorRT


GPU accelerated Semantic segmentation by utilizing the CV-CUDA library with PyTorch or TensorRT


A sample app that decodes, resizes, and encodes images using the CVCUDA and NvImageCodec Python API’s


Decodes encoded bitstreams using PyNvVideoCodec decode APIs


Encodes a raw YUV file using PyNvVideoCodec encode APIs


Transcodes the video files using PyNvVideoCodec API’s

Additional References and Applications

For more references and application please refer to the below link: