Running Inference#

VSR NIM exposes a bidirectional streaming gRPC API. The quickstart bundle includes a reference client and JSON request configurations for gRPC, RTP/UDP, and Cloud File workflows.

Run the gRPC Sample#

Download the VSR compressed-video quickstart resource from NGC and extract it:

mkdir -p vsr-quickstart
ngc registry resource download-version \
  nim/nvidia/vsr-nim-compressed-video-quickstart:1.0.10 \
  --dest vsr-quickstart
tar xzf vsr-quickstart/vsr-nim-compressed-video-quickstart-*.tar.gz \
  -C vsr-quickstart
cd vsr-quickstart/quickstart

From the extracted VSR quickstart folder, build the reference client image:

docker build -t vsr-client:1.0.0 .

The packaged quickstart includes a sample H.264 elementary stream for the bundled gRPC and RTP/UDP clients:

ls -lh media/input.h264

To use your own MP4 input instead, convert it to H.264 Annex B before updating input_video_file in config/client_config.sh:

ffmpeg -y -i my_input.mp4 -map 0:v:0 -c:v copy -bsf:v h264_mp4toannexb -an my_input.h264

Run the gRPC sample:

chmod +x vsr_client.sh
./vsr_client.sh

By default, the sample client does the following:

  1. Connects to 127.0.0.1:8001.

  2. Reads /host/media/input.h264.

  3. Reads samples/client/vsr/grpc_vsr.json.

  4. Uses the input codec, target resolution, and quality preset from the JSON file.

  5. Writes the upscaled result to output_vsr_grpc.h264.

For best results, choose an input resolution lower than the target resolution, such as 720p input for 1440p or 4K output.

RTP/UDP Sample#

To use the RTP/UDP sample:

  1. Start VSR NIM with the RTP/UDP launch command in Getting Started.

  2. In config/client_config.sh, set sample_app to rtp_udp.

  3. If the client is not running on the Docker host, edit samples/client/vsr/rtp_udp_vsr.json.

  4. Run ./vsr_client.sh.

The RTP/UDP workflow is controlled by the gRPC API, but media is transferred over RTP/UDP ports. The Dockerfile-built RTP/UDP sample client is intended for H.264 and H.265 RTP streams from Ubuntu-packaged GStreamer plugins. Use the default H.264 sample config and packaged media/input.h264 for the quickstart path. AV1 RTP requires rtpav1pay and rtpav1depay GStreamer Rust RTP elements, which are not available from stock Ubuntu 24.04 packages.

Cloud File Sample#

To use the Cloud File sample:

  1. Set sample_app to cloud_file in config/client_config.sh.

  2. Upload an input video to object storage.

  3. Create a readable presigned URL for the input object and a writable presigned URL for the output object.

  4. Export both URLs and run ./vsr_client.sh.

    export INPUT_PRESIGNED_URL='https://storage.example.com/input.mp4?presigned-query'
    export OUTPUT_PRESIGNED_URL='https://storage.example.com/output.mp4?presigned-query'
    ./vsr_client.sh
    

    The wrapper passes these values to cloud_file_vsr_client as --input_presigned_url and --output_presigned_url, overriding the placeholder URIs in samples/client/vsr/cloud_file_vsr.json.

For container output, use an input container supported by the Support Matrix. If you upload the packaged media/input.h264, use an elementary-bitstream output object such as output.h264.

Build a Custom gRPC Client#

Protocol buffer definitions live in samples/protos/video_processing/. Generate language stubs with your own protoc toolchain, and invoke nvidia.video_processing.v1beta1.VideoSuperResolutionService/ProcessVideo against the VSR NIM gRPC endpoint.

For example, to generate Python stubs with grpcio-tools:

python3 -m pip install grpcio grpcio-tools
python3 -m grpc_tools.protoc \
  -I samples \
  --python_out=. --grpc_python_out=. \
  samples/protos/video_processing/vsr.proto \
  samples/protos/video_processing/common.proto

API Summary#

The VSR gRPC API uses the following:

Field

Value

Package

nvidia.video_processing.v1beta1

Service

VideoSuperResolutionService

Method

ProcessVideo(stream StreamingVSRRequest) returns (stream StreamingVSRResponse)

Proto files

samples/protos/video_processing/

The gRPC, RTP/UDP, and Cloud File examples all use the same VSR request configuration model.