Metadata-Version: 2.4
Name: pynvvideocodec
Version: 2.2.0
Summary: pynvvideocodec (PyNvVideoCodec) is NVIDIA's Python library for hardware-accelerated video encode/decode on NVIDIA GPUs.
Author: NVIDIA
Maintainer: nvidia
License: MIT
Project-URL: documentation, https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html
Project-URL: source, https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec
Classifier: License :: OSI Approved :: MIT License
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE.txt
License-File: NOTICES.txt
Dynamic: license-file

# **PyNvVideoCodec**

[PyNvVideoCodec](https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html) 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).
* **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.

## **What's New**

### **v 2.2 (Latest)**

* **NVIDIA Jetson support:** Brings easy-to-use, GPU-accelerated Python video APIs to Jetson, making it easy to build video and AI pipelines for robotics and other edge devices.
* **NVIDIA DGX Spark support:** Unlocks high-throughput, Python-based video decode and encode on DGX Spark, accelerating video curation, experimentation, prototyping, training, and deployment of video and AI pipelines.
* **Access to in-memory video data:** Reads video directly from Python byte data and streams, allowing video input from network buffers or cloud storage (such as S3) without writing to temporary files, while still supporting random frame access and batch retrieval.
* **New samples:**
  * **Face protection:** Jupyter notebook that demonstrates an important privacy use case on Jetson—detecting faces in video with a TensorRT-optimized RetinaFace model and blurring them using GPU-accelerated Gaussian blur to protect identities in video.
  * **Video decode from memory:** Illustrates decoding video directly from in-memory Python byte data and seekable binary streams (such as bytes, bytearray, memoryview, BytesIO, or file handles).
  * **Video transcode:** Shows end-to-end GPU video transcoding—demuxing, decoding, encoding, and muxing—using hardware-accelerated video decode and encode.
  * **Video encode with muxing:** The encode sample now shows how to write encoded video directly into container formats such as MP4 and MOV.

## **Distribution**

PyNvVideoCodec library is distributed in two formats: binary distribution via [PyPI](https://pypi.org/project/pynvvideocodec/) and source code distribution via [NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec). In both cases, the library and its dependencies can be installed using a single pip install command.

This package on PyPI contains Python WHLs of the PyNvVideoCodec library and sample applications that demonstrate the use of the PyNvVideoCodec API. To install these please open the shell prompt, and run the following command.

```py
$ pip install pynvvideocodec
```

This is the recommended way to install PyNvVideoCodec.

Upon installation of the wheel, the sample applications and documents are placed in the Python site-packages directory. The specific location of site-packages may vary depending on the operating system and Python environment. The path can be identified by running:

```py
import site; print(site.getsitepackages())
```

## **Sample Applications and Documents**

* A package containing PyNvVideoCodec source code, Python sample applications and documentation can be downloaded from [NVIDIA NGC](https://catalog.ngc.nvidia.com/orgs/nvidia/resources/pynvvideocodec).
* For your convenience, the documents are also accessible online at [PyNvVideoCodec Online Documentation](https://docs.nvidia.com/video-technologies/pynvvideocodec/index.html).
