Encoding and decoding 4k videos on jetson xavier using opencv

Hi all,

I have a jetson xavier.
I have a small application, which reads a 4k 30 fps video using opencv, processes it and writes a processed video.
In my complete pipeline most of the time is being consumed in reading the video (I suppose most of it is going into decoding it). and writing the video (I suppose most of the time is going in encoding the video). I tried compiling opencv with CUDA and use opencv cv2.cudacodec_VideoReader and cv2.cudacodec_VideoWriter, but so far I have not been successful in using those. I have read that jetson has hardware based video encoding and decoding.

My question is
Is there any way I can take use of the hardware encoding decoding with opencv to reduce my processing time?

Please refer to this sample and try:
Displaying to the screen with OpenCV and GStreamer - #9 by DaneLLL

However it is uncertain if we can achieve 4Kp30 since BGR is not supported by hardware blocks so there are multiple buffer copy/conversion. These impact the performance. There is discussion in
[Gstreamer] nvvidconv, BGR as INPUT - #2 by DaneLLL

For optimal solution, we would suggest use gstreamer or jetson_multimedia_api. We also have VPI supporting some image filters:
VPI - Vision Programming Interface: Installation

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.