Get Started with PyNvVideoCodec

PyNvVideoCodec is NVIDIA’s Python based video codec library that provides simple yet powerful Python APIs for hardware accelerated video encode and decode on NVIDIA GPUs.

PyNvVideoCodec is the successor of VPF (Video Processing Framework). It is distributed under MIT license and is officially supported by NVIDIA.

PyNvVideoCodec library internally uses core C/C++ video encode and decode APIs of Video Codec SDK and provides easy to use Python APIs on it. The library offers encode and decode performance close to Video Codec SDK.

High-level block diagram showing PyNvVideoCodec library
[ Figure 1. High level block diagram showing PyNvVideoCodec library in the DL/Multimedia code stack.]

PyNvVideoCodec library is distributed in two formats: binary distribution via PyPl and source code distribution via NVIDIA NGC. In both cases, it can be installed using a single pip install command.

The Python APIs provided by the library are easy to use. These APIs support popular data formats that are commonly understood by DL frameworks like PyTorch. This enables applications to seamlessly exchange data between DL frameworks and NVIDIA’s video encode/decode hardware accelerators.

The library contains Python samples which demonstrate the usage of APIs for decode, encode and transcode use cases. Additionally, these samples feature an example of how to exchange data between the PyNvVideoCodec APIs and popular DL frameworks such as PyTorch.


System Requirements

NVIDIA Drivers

NVIDIA Windows display driver - 531.61 or newer.
NVIDIA Linux display driver - 530.41.03 or newer.
Get most recent NVIDIA Display Driver

Supported NVIDIA GPUs

GPU families - Turning, Ampere, Ada, Hopper and Blackwell

Supported Operating Systems

Windows and Linux

PyNvVideoCodec Latest Version

  • Pip install from PyPl (recommended)

    Ready to use Python WHLs of PyNvVideoCodec library for popular configurations, including Python samples are available on PyPl and can be installed by running the following command on shell prompt

  • Download source on NGC and build 



    Package containing PyNvVideoCodec source code, its dependencies, Python sample applications and documents is available on NVIDIA NGC. To install PyNvVideoCodec library please download zip file containing the latest version of PyNvVideoCodec from the NVIDIA NGC catalog page (located in the file browser tab) onto your local machine. Then, open the shell prompt, go to the folder containing the zip file and execute the following command, replacing "PyNvVideoCodec.zip'' with the actual name of the downloaded zip file.

    pip install PyNvVideoCodec.zip

    Please use this method of installation in case you need any customizations in PyNvVideoCodec library. e.g. enabling NVTX markers for profiling, support for specific surface format etc.

Release Notes

This release of PyNvVideoCodec includes support for the following features:

Decode Features

  • Seek and frame sampling: Provides efficient and flexible methods for fetching video frames in various modes, including sequential, random, periodic, indexed, batched, and sliced, as well as at a specified target frame rate.

  • Decoder caching: Optimizes decoding of short video clips through decoder caching and reconfiguration.

  • Threaded decoder: Supports decoding on a separate thread, delivering pre-decoded frames with near-zero latency, enabling high-performance video processing pipelines.

  • Video processing from buffer: Supports video processing from memory buffers, reducing I/O overhead, enabling streaming applications.

  • Low latency decode: Offers zero-latency decoding for video sequences that do not contain B-frames.

  • SEI extraction: Supports the extraction of Supplemental Enhancement Information (SEI) messages, allowing access to additional information such as HDR information, timecodes, and custom user data.

  • Stream metadata access: Enables access to stream metadata, including frame width, height, bit depth, and keyframe indices, to enhance content management.

  • GIL handling: Improved multithreaded performance through better handling of Global Interpreter Lock (GIL) in C++ layer.

  • Multi-GPU decode: Enables multi-GPU decoding to efficiently handle larger workloads.

  • Extended codec support: Supports codecs H.264, HEVC, AV1, VP8, VP9, VC1, MPEG4, MPEG2, and MPEG1

  • 4:2:2 decode: Supports 4:2:2 decoding for both H.264 and HEVC formats on Blackwell GPUs (NV16, P210 and P216 surface formats).

  • Extended output formats : Decode to various output formats including NV12, YUV420, YUV444, NV16, P010, P016 and RGB24(interleaved and planar)

Encode Features

  • Encoder reconfiguration: Supports encoder reconfiguration, enabling dynamic updating of encoding parameters without recreating encoder instances.

  • SEI insertion: Allows insertion of SEI messages during encoding.

  • GIL handling: Improved multithreaded performance through better handling of Global Interpreter Lock (GIL) in C++ layer.

  • Multi-GPU encode: Enables multi-GPU encoding to efficiently handle larger workloads.

  • Codec support: Support encoding to codec H.264, HEVC, and AV1.

  • 4:2:2 encode: Supports 4:2:2 encoding for both H.264 and HEVC formats on Blackwell GPUs (NV16 and P210 surface formats).

  • Extended input formats: Encode from various input formats including NV12, YV12, IYUV, YUV444, YUV420_10BIT, YUV444_10BIT, NV16, P210, ARGB, ABGR, ARGB10, and ABGR10.

Transcode Features

  • Segment-based transcode: Enables transcoding of video segments based on timestamp ranges, ideal for content editing and partial processing.


Python Samples

The library has a collection of Python samples that illustrate use of PyNNVideoCodec APIs for video decoding, encoding and transcoding use cases.

PyNvVideoCodec package containing sample applications and documents can be downloaded from 
NVIDIA NGC.


Documentation

Key documents can be easily accessed from the PyNvVideoCodec package on NVIDIA NGC.

For your convenience, these documents are also accessible online at PyNvVideoCodec online documents.

Support

To provide feedback, request additional features, or report support issues, please contact us here or use the Video Codec Developer Forum.