Attempting to connect to NVIDIA Nano cameras log error

The cameras work once on startup using a gstreamer pipeline -

“gst-launch-1.0 nvarguscamerasrc ! ‘video/x-raw(memory:NVMM),width=1280,height=720,framerate=15/1’ ! nvvidconv flip-method=2 ! tee name=t1 t1. ! queue silent=true ! nvv4l2h264enc bitrate=8000000 ! h264parse config-interval=1 ! queue silent=true leaky=downstream ! rndbuffersize max=65000 ! udpsink host=127.0.0.1 port=5001 sync=false t1. ! queue silent=true ! nvjpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000 sync=false”

and

“nvarguscamerasrc sensor-id=1 ! video/x-raw(memory:NVMM),width=1280,height=720,framerate=15/1, format=NV12, framerate=15/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert”

as well as the default provided nvargus command.

After launching a few times, they log “Error generated. /dvs/git/dirty/git-master_linux/multimedia/nvgstreamer/gst-nvarguscamera/gstnvarguscamerasrc.cpp, execute:543 Failed to create CaptureSession” every subsequent connection attempt. This is fixed by restarting the nano.

Hi,
Please share your release version( $ head -1 /etc/nv_tegra_release ) and steps for reproducing the issue, such as running gst-launch command or a simple test code.

And information of the camera board(Raspberry Pi camera V2 or others).

Release Version: # R32 (release), REVISION: 3.1, GCID: 18186506, BOARD: t210ref, EABI: aarch64, DATE: Tue Dec 10 06:58:34 UTC 2019

Steps to Reproduce Issue:

  1. Run gst-launch-1.0 nvarguscamerasrc sensor-id=1 ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=15/1, format=NV12, framerate=15/1' ! nvvidconv flip-method=2 ! video/x-raw, format=BGRx ! videoconvert
    Logs:
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
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: 3264 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: 3264 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: 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: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; 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 = 120.000005 
GST_ARGUS: PowerService: requested_clock_Hz=3024000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
ERROR: from element /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline0/GstNvArgusCameraSrc:nvarguscamerasrc0:
streaming stopped, reason not-linked (-1)
Execution ended after 0:00:01.108775515
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...
GST_ARGUS: 
PowerServiceHwVic::cleanupResources
  1. ROS2:

Setup and install ROS GSCAM2.
Run
export gscam_config='nvarguscamerasrc sensor-id=1 ! video/x-raw(memory:NVMM), width=1280, height=720, format=NV12, framerate=15/1 ! nvvidconv flip-method=2 ! video/x-raw, format=BGRx ! videoconvert' && ros2 launch gscam gscam_main

Hi,
The sensor-id looks not right. It should be 0 Or you have two cameras being connected?

And the pipeline should be with sink such as fakesink

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=15/1, format=NV12, framerate=15/1' ! nvvidconv flip-method=2 ! video/x-raw, format=BGRx ! videoconvert ! fakesink

Yes, we have two cameras connected. The pipeline is appended into the ROS Gstream node, which apends its own sink. That being said, the behavior still occurs with a autovideosink or udpsink appended. I’ve noticed that it consistently occurs with this commands:

gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=512,height=288,framerate=15/1' ! nvvidconv flip-method=2 ! tee name=t1 t1. ! queue silent=true ! nvv4l2h264enc bitrate=8000000 ! h264parse config-interval=1 ! queue silent=true leaky=downstream ! rndbuffersize max=65000 ! udpsink host=127.0.0.1 port=5001 sync=false t1. ! queue silent=true ! nvjpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000 sync=false`

Hi,
It should be an issue in nvjpegenc. Please take a look at:
https://elinux.org/L4T_Jetson/r32.3.x_patch
[GSTREAMER]streaming using jpegenc halts after a short delay
And apply the prebuilt lib.

After applying that patch, the gstreamer behavior is a bit more consistent, but it still fails sporadically (around every 10 launches).

Hi,
Please share how we can reproduce the failure. Do you run

  1. Excute
gst-launch-1.0 nvarguscamerasrc sensor-id=0 ! 'video/x-raw(memory:NVMM),width=512,height=288,framerate=15/1' ! nvvidconv flip-method=2 ! tee name=t1 t1. ! queue silent=true ! nvv4l2h264enc bitrate=8000000 ! h264parse config-interval=1 ! queue silent=true leaky=downstream ! rndbuffersize max=65000 ! udpsink host=127.0.0.1 port=5001 sync=false t1. ! queue silent=true ! nvjpegenc ! rtpjpegpay ! udpsink host=127.0.0.1 port=5000 sync=false`
  1. Ctrl +C to exit the pipeline
  2. Do step 1 2 repeatedly and the issue is hit once ~10 trials.

Correct, it actually fails every other time with that command now, the behavior is inconsistent. It seems to be that pipeline specifically, as I’m now using a different pipeline in code which hasn’t had any problems yet.

  1. Be sure to start with a mode (resolution/fps) listed by v4l2-ctl -d /dev/video0 --list-formats-ext.
  2. You might try to specify caps 'video/x-raw(memory:NVMM), format=NV12 (or I420 for older L4T releases) before tee t1
  3. You might try to specify caps ‘video/x-raw(memory:NVMM), format=I420’ before nvjpengenc, so in recent relases you may use a nvvidconv for converting NV12 to I420, both in NVMM memory.

I tried 1 and 2. For 3, what do you meaning using nvvid conv to convert NV12 to I420?

Yes this is what I meant. However, I have just tried your command and it seems it is rather related to previous gstreamer pipeline failing to close properly.

I can reliably launch and stop your pipeline many times with EOS (use -e with gst-launch-1.0).

Yeah it seems to be working consistently now after a few restarts, thanks for the help!