I use the below gst-launch:
nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,framerate=21/1,format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! nvcomp. nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,framerate=21/1,format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! nvcomp. nvcompositor name=nvcomp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=1920 sink_0::height=1080 sink_1::xpos=1920 sink_1::ypos=0 sink_1::width=1920 sink_1::height=1080 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! 'video/x-raw,format=RGBA' ! videoconvert ! 'video/x-raw,format=BGR' ! appsink
it work on terminal but when I try the below code for python it wont work :
cv2.VideoCapture("nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,framerate=21/1,format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! nvcomp. nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1920,height=1080,framerate=21/1,format=NV12' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! nvcomp. nvcompositor name=nvcomp sink_0::xpos=0 sink_0::ypos=0 sink_0::width=1920 sink_0::height=1080 sink_1::xpos=1920 sink_1::ypos=0 sink_1::width=1920 sink_1::height=1080 ! 'video/x-raw(memory:NVMM)' ! nvvidconv ! 'video/x-raw,format=RGBA' ! videoconvert ! 'video/x-raw,format=BGR' ! appsink", cv2.CAP_GSTREAMER)
i have this error on execution :
(python3:2227): GStreamer-CRITICAL **: 00:43:01.790: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.792: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.792: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.792: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.795: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.795: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
(python3:2227): GStreamer-CRITICAL **: 00:43:01.797: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (711) open OpenCV | GStreamer warning: Error opening bin: syntax error
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
and the result of print(cv.getBuildInformation())
is :
...
Video I/O:
FFMPEG: YES
avcodec: YES (57.107.100)
avformat: YES (57.83.100)
avutil: YES (55.78.100)
swscale: YES (4.8.100)
avresample: NO
GStreamer: YES (1.14.5)
v4l/v4l2: YES (linux/videodev2.h)
...