pynvvideocodec (PyNvVideoCodec) is NVIDIA's Python library for hardware-accelerated video encode/decode on NVIDIA GPUs.
Actively maintained. Last release 4 weeks ago. A safe choice.
pip install pynvvideocodecPyNvVideoCodec
PyNvVideoCodec is NVIDIA's Python-based library that provides simple yet powerful Python APIs for hardware-accelerated video encoding and decoding on NVIDIA GPUs.
PyNvVideoCodec is built on top of the Video Codec SDK and offers encode, decode, and transcode performance on par with it.
The library is distributed under MIT license and is officially supported by NVIDIA.
Features
PyNvVideoCodec supports 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 separate threads, delivering pre-decoded frames with near-zero latency, enabling high-performance video processing pipelines.
- Decode statistics extraction: Enables extraction of low-level decode statistics—such as QP values, coding-unit types, and motion vectors—from H.264 and H.265 streams. These statistics provide valuable insights into video quality, content complexity, and encoder behaviour.
- 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).