You may try to find where is the bottleneck. First check what your V4L can provide:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=YUY2,framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If this doesn’t show 30 fps, there is a problem with your USB cam. Be sure it is connected at least in USB2 (USB3 would be better) with lsusb -t
. You may also try v4l2src property io-mode=2:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! video/x-raw,width=1920,height=1080,format=YUY2,framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If the capture can run 30 fps, check the YUV to RGB conversion:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=YUY2,framerate=30/1 ! videoconvert ! video/x-raw,format=BGR ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If this is where it slows down, you may try to perform the YUV → BGRx with HW:
gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw,width=1920,height=1080,format=YUY2,framerate=30/1 ! nvvidconv ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If this is ok, then the problem may be with opencv. Don’t use imshow and try lower modes provided by your camera.