You may check that your camera can provide 30 fps:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1920,height=1080,framerate=30/1,format=MJPG ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If not ok, check the USB speed for your camera with lsusb -t
.
If ok, the bottleneck may be the CPU JPG decoder, so try HW decoder:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1920,height=1080,framerate=30/1,format=MJPG ! nvv4l2decoder mjpeg=1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
# Or:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1920,height=1080,framerate=30/1,format=MJPG ! nvjpegdec ! 'video/x-raw(memory:NVMM),format=I420' ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
If not ok, you may try to add jpegparse before encoder.
If ok, you may add conversion to BGR:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1920,height=1080,framerate=30/1,format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v
# Or:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1920,height=1080,framerate=30/1,format=MJPG ! nvjpegdec ! 'video/x-raw(memory:NVMM),format=I420' ! nvvidconv ! video/x-raw,format=BGRx ! videoconvert ! video/x-raw,format=BGR ! fpsdisplaysink text-overlay=0 video-sink=fakesink -v