OpenCV VideoCapture capture one frame take more than 600ms in Jetson Nano

About the warning, it is normal. A live stream has no duration so current position cannot be computed. This is harmelss.

Note that you are using quite high resolution and this might be much for Nano at high framerate. I don’t see any framerate specified in your code, you may specify one provided by your camera in 2592x1944 resolution.

I’d guess the main bottleneck is cv::imshow. It is CPU only and not very efficient on Jetson. Try commenting it and see if timing imporves. If yes, you would try to display with a cv::videoWriter using a pipeline to a videosink such as here.

The other possible bottleneck is videoconvert that runs on CPU. One possible optimization could be to do part of the conversion with HW, so that videoconvert has just to remove the extra 4th byte :

v4l2src device=/dev/video0 ! video/x-raw,width=2592,height=1944,format=UYVY ! nvvidconv ! video/x-raw(memory:NVMM), format=UYVY ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw,format=BGR ! appsink

Note that there are 2 nvvidconv because it expects at least one of its input or output to be in NVMM memory. The first one copies into NVMM memory and second one converts into BGRx into standard memory.

1 Like