I am facing issues using GStreamer with OpenCV on Jetson Xavier NX.
I am trying to run a GStreamer pipeline through C++ using OpenCV. The following pipeline works using gst-launch-1.0:
gst-launch-1.0 v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=3840,height=2160' ! nvv4l2decoder mjpeg=1 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! video/x-raw ! fpsdisplaysink video-sink=fakesink sync=false text-overlay=false -v
This is working good and giving me 30fps. However, trying to run the same through C++ and OpenCV with the following:
cv::VideoCapture cap;
string pipeline;
pipeline = "v4l2src device=/dev/pal5 io-mode=2 ! 'image/jpeg,width=3840,height=2160' ! nvv4l2decoder mjpeg=1 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! video/x-raw ! appsink";
cap.open(pipeline, cv::CAP_GSTREAMER);
Using appsink instead of fakesink here.
is giving me the following errors:
(frame_capture:19071): GStreamer-CRITICAL **: 17:37:02.051: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(frame_capture:19071): GStreamer-CRITICAL **: 17:37:02.084: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
[ WARN:0] global /home/dreamvu/opencv/modules/videoio/src/cap_gstreamer.cpp (713) open OpenCV | GStreamer warning: Error opening bin: syntax error
[ WARN:0] global /home/dreamvu/opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
I suspect that the issue is in getting to the v4l2 source.
I have also tried running this with root access but still got the same issue.