[Deepstream] About the multiple input stream using csi camera(nvarguscamerasrc)

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Nano Dev Kit
• DeepStream Version 6.0
• JetPack Version (valid for Jetson only) 4.6.2
• TensorRT Version 8.2.1.32
• Issue Type( questions, new requirements, bugs) Question

Hello,
I’m struggling to run the deepstream python app.
Unlike the default code, I want to put two CSI camera as input sources.

So I changed the default code like the one I attached.
deepstream_test_3.py (17.1 KB)
The only difference is written in the below code.

def create_source_bin(index,uri):
    print("Creating source bin")

    # Create a source GstBin to abstract this bin's content from the rest of the
    # pipeline
    bin_name="source-bin-%02d" %index
    print(bin_name)
    nbin=Gst.Bin.new(bin_name)
    if not nbin:
        sys.stderr.write(" Unable to create source bin \n")

    # Source element for reading from the uri.
    # We will use decodebin and let it figure out the container format of the
    # stream and the codec and plug the appropriate demux and decode plugins.
    if file_loop:
        # use nvurisrcbin to enable file-loop
        uri_decode_bin=Gst.ElementFactory.make("nvurisrcbin", "uri-decode-bin")
        uri_decode_bin.set_property("file-loop", 1)
        uri_decode_bin.set_property("cudadec-memtype", 0)
    else:
        uri_decode_bin=Gst.ElementFactory.make("nvarguscamerasrc", "src-elem")
        uri_decode_bin.set_property("sensor-id", index)
        uri_decode_bin.set_property("bufapi-version", True)
    if not uri_decode_bin:
        sys.stderr.write(" Unable to create uri decode bin \n")

    return uri_decode_bin

It works fine when using single CSI camera(dev/video0), but when I use two CSI camera,
seems like the second CSI camera(dev/video1) is not read.

Hope you could help me :)
Thanks in advance.

testing video0 video1 separately, can it run fine? how to run your code?

I really appreciate for the check fanzh :)
I found that running single CSI camera also doesn’t work. The previous test was taken in a wrong way.

python3 deepstream_test_3.py /dev/video0 /dev/video1
  • Testing video0, video1 separately
    Checked the connection of two CSI cameras by capturing frame(nvgstcapture)

So now, I got following question.

  • I changed the code for CSI camera using ‘‘nvarguscamerasrc’’. The camera seems to be connected but getting the stream does not work. By referring other forum about CSI camera, using “nvarguscamerasrc” looks like appropriate action but what is wrong with my pipeline? The log of command <python3 deepstream_test_3.py /dev/video0> is like below.
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: 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: 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 = 0 
   Camera mode  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Frame Number= 0 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Frame Number= 1 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Frame Number= 2 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Frame Number= 3 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Frame Number= 4 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
0:00:07.860641738   143     0x40b40a30 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: Internal data stream error.
0:00:07.860743878   143     0x40b40a30 WARN                 nvinfer gstnvinfer.cpp:2288:gst_nvinfer_output_loop:<primary-inference> error: streaming stopped, reason error (-5)
Error: gst-stream-error-quark: Internal data stream error. (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvinfer/gstnvinfer.cpp(2288): gst_nvinfer_output_loop (): /GstPipeline:pipeline0/GstNvInfer:primary-inference:
streaming stopped, reason error (-5)
Exiting app

Frame Number= 5 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
Frame Number= 6 Number of Objects= 0 Vehicle_count= 0 Person_count= 0
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success

sorry for the late reply, please refer to the following command, it works fine, it will test two argus cameras, DeepStream should support two argus cameras.
gst-launch-1.0 nvarguscamerasrc sensor-id=0 num-buffers=200 ! m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! nvvideoconvert ! nvmultistreamtiler width=1920 height=1080 ! nvvideoconvert ! nvdsosd ! nvvideoconvert ! video/x-raw(memory:NVMM),format=I420 ! nvv4l2h264enc bitrate=1000000 ! filesink location=test.264 nvarguscamerasrc sensor-id=1 num-buffers=200 ! m.sink_1

I share the result of the test.
Now I am trying to check two errors but if there are other reasons for the error, please share :)

  • Failed to load plugin ‘/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so’: librivermax.so.0: cannot open shared object file: No such file or directory
  • ERROR: from element /GstPipeline:pipeline0/GstNvStreamMux:m: Input buffer number of surfaces (0) must be equal to mux->num_surfaces_per_frame (1)
(gst-plugin-scanner:11): GStreamer-WARNING **: 07:19:35.419: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_inferserver.so': libtritonserver.so: cannot open shared object file: No such file or directory

(gst-plugin-scanner:11): GStreamer-WARNING **: 07:19:35.968: Failed to load plugin '/usr/lib/aarch64-linux-gnu/gstreamer-1.0/deepstream/libnvdsgst_udp.so': librivermax.so.0: cannot open shared object file: No such file or directory
Setting pipeline to PAUSED ...
Opening in BLOCKING MODE 
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Redistribute latency...
NvMMLiteOpen : Block : BlockType = 4 
===== NVMEDIA: NVENC =====
NvMMLiteBlockCreate : Block : BlockType = 4 
GST_ARGUS: Creating output stream
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
CONSUMER: Waiting until producer is connected...
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: 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: 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  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29.999999 
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
GST_ARGUS: Available Sensor modes :
CONSUMER: Producer has connected; continuing.
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: 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: 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 = 0 
   Camera mode  = 2 
   Output Stream W = 1920 H = 1080 
   seconds to Run    = 0 
   Frame Rate = 29.999999 
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/GstNvStreamMux:m: Input buffer number of surfaces (0) must be equal to mux->num_surfaces_per_frame (1)
        Set nvstreammux property num-surfaces-per-frame appropriately

Additional debug info:
/dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvmultistream/gstnvstreammux.c(485): gst_nvstreammux_chain (): /GstPipeline:pipeline0/GstNvStreamMux:m
Execution ended after 0:00:00.723641688
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
GST_ARGUS: Cleaning up
CONSUMER: Done Success
GST_ARGUS: Done Success
Setting pipeline to NULL ...
Freeing pipeline ...

There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks

it is warning log, please ignore it.

it is because that Input buffer number of surfaces is zero.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.