PyNvVideoCodec is NVIDIA's Python library for hardware-accelerated video encoding and decoding on NVIDIA GPUs. It wraps the NVIDIA Video Codec SDK and provides high-performance encode/decode operations directly from Python. Current version 2.1.0, requires Python >=3.8 and an NVIDIA GPU with supported drivers. Release cadence is irregular, tied to SDK updates.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from PyNvVideoCodec import CreateDecoder
from PyNvVideoCodec import CreateEncoder
from PyNvVideoCodec import CreateTranscoder
Basic encode and decode a single frame. Requires an NVIDIA GPU with proper drivers.
from pynvvideocodec import PyNvEncoder, PyNvDecoder, EncodeConfig, DecodeConfig
import numpy as np
# Encode example
enc_config = EncodeConfig(
codec='h264',
width=1920,
height=1080,
framerate=30,
bitrate=5000000
)
encoder = PyNvEncoder(enc_config)
frame = np.zeros((1080, 1920, 3), dtype=np.uint8)
encoded = encoder.encode(frame)
# Decode example
dec_config = DecodeConfig(codec='h264', width=1920, height=1080)
decoder = PyNvDecoder(dec_config)
decoded = decoder.decode(encoded)
print('Success')
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.
Resources
No resource links recorded.