So it seems your camera only provides MJPG format, and has a 720p mode @120 fps, I assume this is what you want.
So first try to display your camera with:
gst-launch-1.0 v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! videoconvert ! xvimagesink
If this doesn’t work, try adding jpegparse:
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! jpegparse ! nvv4l2decoder mjpeg=1 ! nvvidconv ! videoconvert ! xvimagesink
If this doesn’t work, please post the output of previous command.
If you can see the video, you would measure the framerate that this pipeline can acheive:
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! fpsdisplaysink video-sink=fakesink text-overlay=false
If ok, add nvvidconv to BGRx:
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw, format=BGRx ! fpsdisplaysink video-sink=fakesink text-overlay=false
If ok, add videoconvert to BGR:
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! fpsdisplaysink video-sink=fakesink text-overlay=false
If ok, you would try such gstreamer pipeline for opencv to get color frames:
const char* gst_str="v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw, format=BGRx ! videoconvert ! video/x-raw, format=BGR ! appsink";
cv::videoCapture cap(gst_str, cv::CAP_GSTREAMER);
Be aware that opencv videoio is not so fast on jetson, so you may have to choose other options.
If you intend to process monochrome, you would instead try such pipeline:
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=I420' ! nvvidconv ! video/x-raw, format=GRAY8 ! videoconvert ! xvimagesink
gst-launch-1.0 -v v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! 'video/x-raw(memory:NVMM), format=I420' ! nvvidconv ! video/x-raw, format=GRAY8 ! fpsdisplaysink video-sink=fakesink text-overlay=false
and if this works, you would open camera for reading one channel frames from opencv with:
const char* gst_str="v4l2src device=/dev/video0 io-mode=2 ! image/jpeg,width=1280,height=720, framerate=120/1, format=MJPG ! nvv4l2decoder mjpeg=1 ! nvvidconv ! video/x-raw(memory:NVMM), format=I420 ! nvvidconv ! video/x-raw, format=GRAY8 ! appsink";
cv::videoCapture cap(gst_str, cv::CAP_GSTREAMER);
Let us know what works or not.