- cuda >= 11.2
- numpy >= 1.7
- python >= 3.6
- gcc >= 7.5
- make >= 4.1
pip install pynvcodec
from nvcodec import VideoSource, VideoDecoder, VideoEncoder
source = VideoSource("rtmp://RTMP_URL")
h264_data = source.read()
decoder = VideoDecoder()
# output OpenCV format frame
frames = decoder.decode(h264_data)
# output SDL format frame
frames = decoder.decode(h264_data, 1)
encoder = VideoEncoder(width, height)
h264_data = encoder.encode(frame)