Jetson orin nano developer kit:jetpack 6.2.1/ 36.4.7: nvarguscamerasrc fails to load the camera with id = 1 when launched for the second time

im using two imx219 csi cameras from waveshare with my jetson orin nano with latest jetpack 6.2.1

i cannot able to succesfully get the video stream from both the cameras for inference

i’m using nvargus for getting the streams as suggested online,

both the camera stream launches on a fresh os boot once closed and re launched the camera with id 1 is failing to launch.

here is the complete sequence to recreate the problem

boot into os

run script for camera 0

roavai@ubuntu:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! queue ! nvvidconv ! xvimagesink name=sink0
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 4 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:sink0: Output window was closed
Additional debug info:
../sys/xvimage/xvimagesink.c(568): gst_xv_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstXvImageSink:sink0
Execution ended after 0:00:23.926001830
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Freeing pipeline ...

closed the camera stream by pressing x button of the window.

run script for camera 1

roavai@ubuntu:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! queue ! nvvidconv ! xvimagesink name=sink0
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 1 
   Camera mode  = 4 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:sink0: Output window was closed
Additional debug info:
../sys/xvimage/xvimagesink.c(568): gst_xv_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstXvImageSink:sink0
Execution ended after 0:00:10.049005087
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Freeing pipeline ...

works just like camera 0

camera 0 second time

roavai@ubuntu:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! queue ! nvvidconv ! xvimagesink name=sink0
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 0 
   Camera mode  = 4 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Redistribute latency...
ERROR: from element /GstPipeline:pipeline0/GstXvImageSink:sink0: Output window was closed
Additional debug info:
../sys/xvimage/xvimagesink.c(568): gst_xv_image_sink_handle_xevents (): /GstPipeline:pipeline0/GstXvImageSink:sink0
Execution ended after 0:00:08.240670875
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Freeing pipeline ...

works just like before

camera 1 second time

roavai@ubuntu:~$ gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! queue ! nvvidconv ! xvimagesink name=sink0
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1640 x 1232 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;

GST_ARGUS: Running with following settings:
   Camera index = 1 
   Camera mode  = 4 
   Output Stream W = 1280 H = 720 
   seconds to Run    = 0 
   Frame Rate = 59.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
nvbuf_utils: dmabuf_fd -1 mapped entry NOT found
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadExecute:734 NvBufSurfaceFromFd Failed.
Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, threadFunction:245 (propagating)
Redistribute latency...
Got EOS from element "pipeline0".
Execution ended after 0:00:04.012839109
Setting pipeline to NULL ...
GST_ARGUS: Cleaning up

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.217: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.268: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.318: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.368: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.619: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.670: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.770: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:19.971: gst_video_center_rect: assertion 'src->h != 0' failed

(gst-launch-1.0:4626): GStreamer-Video-CRITICAL **: 15:16:20.021: gst_video_center_rect: assertion 'src->h != 0' failed
GST_ARGUS: Done Success
Freeing pipeline ...

opens the window with black feed for few seconds and closses with the above error.

im trying really hard but could not find a solution. im new to jetson, help me regarding this.

thank you

How about terminal the gst-launch-1.0 by “CTRL + C” in the console command line?

same behaviour

Could you verify by v4l2-ctl while the camera 1 failed.

v4l2-ctl --stream-mmap -c bypass_mode=0 /dev/video0
v4l2-ctl --stream-mmap -c bypass_mode=0 /dev/video1

with just the v4l2 it working alright as shown in the above picture,
i also made a small python script to preview debayered images from both cameras simultaneously using openCV and it worked fine too but obviously the image quality was bad due to lack of ISP, but the moment i use nvargus library everything starts breaking.
I really need a way to use these two cameras to get proper dual camera streams, please help.

Add “sync=false -e” to the command line to try.

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! queue ! nvvidconv ! xvimagesink sync=false -e

same problem
ran the script you provided
first image: run on fresh os boot
second image: run seconf time without os reboot