NVIDIA introduces an open source video processing framework for Python

NVIDIA has launched VideoProcessing Framework (VPF), an open source video processing framework for Python. It is understood that VPF is an open source set of C-library and Python bindings that can interact with its closed source Codec SDK. The feature of the framework is to simplify the process of developing GPU-accelerated video encoding/decoding from Python. VPF leverages the NVIDIA Video Codec SDK to increase flexibility and performance, and provides developers with the ease of use inherent in Python.

NVIDIA introduces an open source video processing framework for Python

In fact, while Python is not the highest performing language, it is an easy-to-use language. And after NVIDIA decides to release this video processing framework, the Python wrapper, which is equivalent to the existing Video Codec SDK C s stack, will be used for GPU-based video encoding/decoding on Kepler and later.

As a result, users end up with code that is easy to read/write while leveraging GPU-based high-performance video acceleration.

The code is available on GitHub as NVIDIA’s VideoProcessing Framework.

In addition, in the blog about VPF, the developer provides a short example of Python code that uses the PyNvCodec module to display video transcoding in Python.

import PyNvCodec as nvc gpuID = 0 encFile = “big_buck_bunny_1080p_h264.mov” xcodeFile = open(“big_buck_bunny_1080p.h264”, “wb”) nvDec = nvc.PyNvDecoder(encFile, gpuID) nvEnc = nvc.PyNvEncoder({‘preset’: ‘hq’, ‘codec’: ‘h264’, ‘s’: ‘1920×1080’}, gpuID) while True:     rawSurface = nvDec.DecodeSingleSurface()     # Decoder will return zero surface if input file is over;     if not (rawSurface.GetCudaDevicePtr()):         break          encFrame = nvEnc.EncodeSingleSurface(rawSurface)     if(encFrame.size):         frameByteArray = bytearray(encFrame)          xcodeFile.write(frameByteArray) # Encoder is asynchronous, so we need to flush it encFrames = nvEnc.Flush() for encFrame in encFrames:     encByteArray = bytearray(encFrame)     xcodeFile.write(encByteArray)

Reference message:



Add a Comment

Your email address will not be published. Required fields are marked *