DeepStream4 Jetson nano multiple webcams issue

I have 4 Logitech webcams hooked up to my nano. Im running this:
deepstream-app -c source1_usb_dec_infer_resnet_int8.txt
I have tweeked it to run multiple web cams. I have webcams on Node=0, Node=1, node=2 and node=3.
I get and error when I try to run more than 2 webcams. Any combonation of 2 webcams works just fine. Its just when I try to run more than 2 I get this.

*
 INFO: <bus_callback:149>: Pipeline running

ERROR from src_elem: Device '/dev/video1' is busy
Debug info: gstv4l2object.c(3754): gst_v4l2_object_set_format_full (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstV4l2Src:src_elem:
Call to S_FMT failed for YUYV @ 640x480: Device or resource busy
ERROR from src_elem: Internal data stream error.
Debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstV4l2Src:src_elem:
streaming stopped, reason not-negotiated (-4)
Creating LL OSD context new
ERROR from src_elem: Failed to allocate required memory.
Debug info: gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
Buffer pool activation failed
ERROR from src_elem: Internal data stream error.
Debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
streaming stopped, reason not-negotiated (-4)
Quitting
App run failed

What is the best path forward to run multiple cameras. It doesn’t matter what kind?

Hi,

I am having the same issue. I need to use 3 usb cameras but only 2 can run at the same time or I get the following error

Creating LL OSD context new
ERROR from src_elem: Failed to allocate required memory.
Debug info: gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
Buffer pool activation failed
ERROR from src_elem: Internal data stream error.
Debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
streaming stopped, reason not-negotiated (-4)

Did anyone manage to fix the issue?

Hi,
Do you set batch-size=4 for 4 camera cases? Also source1_usb_dec_infer_resnet_int8.txt is for Xavier. Suggest you base on source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt for modification.

You may port [source*] from
source1_usb_dec_infer_resnet_int8.txt
to
source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt.

Hi @adventuredaisy , @timothe.frignac

Can you please share your configuration files as well to help us repro the issue ?

any time I attempt to use more than 2 webcams I always get this error

Creating LL OSD context new
ERROR from src_elem: Failed to allocate required memory.
Debug info: gstv4l2src.c(658): gst_v4l2src_decide_allocation (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
Buffer pool activation failed
ERROR from src_elem: Internal data stream error.
Debug info: gstbasesrc.c(3055): gst_base_src_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin2/GstV4l2Src:src_elem:
streaming stopped, reason not-negotiated (-4)
Quitting
App run failed

I am running:
source8_1080p_dec_infer-resnet_tracker_tiled_display_fp16_nano.txt.

I have tried setting the batch sizes to match the camera count

I have tried tweeking on the file but I cant seem to get more than 2 webcams to run without an error

here is config file:

Copyright (c) 2018 NVIDIA Corporation.  All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.

# Following properties are mandatory when engine files are not specified:
#   int8-calib-file(Only in INT8)
#   Caffemodel mandatory properties: model-file, proto-file, output-blob-names
#   UFF: uff-file, input-dims, uff-input-blob-name, output-blob-names
#   ONNX: onnx-file
#
# Mandatory properties for detectors:
#   num-detected-classes
#
# Optional properties for detectors:
#   enable-dbscan(Default=false), interval(Primary mode only, Default=0)
#   custom-lib-path,
#   parse-bbox-func-name
#
# Mandatory properties for classifiers:
#   classifier-threshold, is-classifier
#
# Optional properties for classifiers:
#   classifier-async-mode(Secondary mode only, Default=false)
#
# Optional properties in secondary mode:
#   operate-on-gie-id(Default=0), operate-on-class-ids(Defaults to all classes),
#   input-object-min-width, input-object-min-height, input-object-max-width,
#   input-object-max-height
#
# Following properties are always recommended:
#   batch-size(Default=1)
#
# Other optional properties:
#   net-scale-factor(Default=1), network-mode(Default=0 i.e FP32),
#   model-color-format(Default=0 i.e. RGB) model-engine-file, labelfile-path,
#   mean-file, gie-unique-id(Default=0), offsets, gie-mode (Default=1 i.e. primary),
#   custom-lib-path, network-mode(Default=0 i.e FP32)
#
# The values in the config file are overridden by values set through GObject
# properties.

[property]
gpu-id=0
net-scale-factor=0.0039215697906911373
model-file=../../models/Primary_Detector_Nano/resnet10.caffemodel
proto-file=../../models/Primary_Detector_Nano/resnet10.prototxt
model-engine-file=../../models/Primary_Detector_Nano/resnet10.caffemodel_b8_fp16.engine
labelfile-path=../../models/Primary_Detector_Nano/labels.txt
batch-size=8
process-mode=1
model-color-format=0
## 0=FP32, 1=INT8, 2=FP16 mode
network-mode=2
num-detected-classes=4
interval=0
gie-unique-id=1
output-blob-names=conv2d_bbox;conv2d_cov/Sigmoid
#parse-bbox-func-name=NvDsInferParseCustomResnet
#custom-lib-path=/path/to/libnvdsparsebbox.so
#enable-dbscan=1

[class-attrs-all]
threshold=0.2
group-threshold=1
## Set eps=0.7 and minBoxes for enable-dbscan=1
eps=0.2
#minBoxes=3
roi-top-offset=0
roi-bottom-offset=0
detected-min-w=0
detected-min-h=0
detected-max-w=0
detected-max-h=0

## Per class configuration
#[class-attrs-2]
#threshold=0.6
#eps=0.5
#group-threshold=3
#roi-top-offset=20
#roi-bottom-offset=10
#detected-min-w=40
#detected-min-h=40
#detected-max-w=400
#detected-max-h=800

Is that the config file you need?

Hi adventuredaisy,

We can reproduce this bug, the status will be updated once got a fix or workaround. Please stat tuned.

Yea Team !!!

Hi all,
I’ve the same problem on Nano and Xavier devkit…
I’ve connected 4 different Logitech C270 USB cameras as (with v4l2 they’re present as /dev/video0-1-2-3).
With the following configuration file on Xavier I’m not able to run deepstream with more than 2 cameras at a time.
I modified the configuration file “source2_csi_usb_dec_infer_resnet_int8.txt” to add the USB camera needed (plus batch-size=4):

# Copyright (c) 2018 NVIDIA Corporation.  All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl

[tiled-display]
enable=1
rows=2
columns=2
width=1280
height=960

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=25
camera-fps-d=1
camera-v4l2-dev-node=0

[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=25
camera-fps-d=1
camera-v4l2-dev-node=1

[source2]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=25
camera-fps-d=1
camera-v4l2-dev-node=2

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay
type=5
sync=1
display-id=0
offset-x=0
offset-y=0
width=0
height=0
overlay-id=1
source-id=0

[sink1]
enable=0
type=3
#1=mp4 2=mkv
container=1
#1=h264 2=h265 3=mpeg4
codec=1
sync=0
bitrate=2000000
output-file=out.mp4
source-id=0

[sink2]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay
type=4
#1=h264 2=h265
codec=1
sync=0
bitrate=4000000
# set below properties in case of RTSPStreaming
rtsp-port=8554
udp-port=5400

[osd]
enable=1
border-width=2
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0

[streammux]
##Boolean property to inform muxer that sources are live
live-source=1
batch-size=4
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
## Set muxer output width and height
width=640
height=480

# config-file property is mandatory for any gie section.
# Other properties are optional and if set will override the properties set in
# the infer config file.
[primary-gie]
enable=1
model-engine-file=../../models/Primary_Detector/resnet10.caffemodel_b4_int8.engine
#model-engine-file=../../models/Primary_Detector/resnet10.caffemodel_b30_int8.engine
#Required to display the PGIE labels, should be added even when using config-file
#property
batch-size=2
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=0
#Required by the app for SGIE, when used along with config-file property
gie-unique-id=1
config-file=config_infer_primary.txt

[tests]
file-loop=0

Any advice is really welcome :-)

Hi,
It can be bandwidth limitation on Nano since it utilizes one pair of USB2/USB3 of Nano and extends to 4 ports with a hub. Please check Nano Product design guide:
https://developer.nvidia.com/embedded/dlc/jetson-nano-product-design-guide

On Xavier, do you connect 4 USB cameras to the type-A port with a hub? There are two type-C ports on Xavier and you may try to connect USB cameras to the two ports.

Hi,
We can run the following config on Jetson Nano/DS4.0.1:

# Copyright (c) 2018 NVIDIA Corporation.  All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto.  Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.

[application]
enable-perf-measurement=1
perf-measurement-interval-sec=5
#gie-kitti-output-dir=streamscl

[tiled-display]
enable=1
rows=2
columns=2
width=1280
height=960
gpu-id=0
nvbuf-memory-type=0

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=0

[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=1

[source2]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=2

[source3]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP 5=CSI
type=1
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
camera-v4l2-dev-node=3

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=Overlay
type=5
sync=0
display-id=0
offset-x=0
offset-y=0
width=0
height=0
overlay-id=1
source-id=0

[osd]
enable=1
border-width=2
text-size=15
text-color=1;1;1;1;
text-bg-color=0.3;0.3;0.3;1
font=Serif
show-clock=0
clock-x-offset=800
clock-y-offset=820
clock-text-size=12
clock-color=1;0;0;0

[streammux]
##Boolean property to inform muxer that sources are live
live-source=1
batch-size=4
##time out in usec, to wait after the first buffer is available
##to push the batch even if the complete batch is not formed
batched-push-timeout=40000
## Set muxer output width and height
width=640
height=480

# config-file property is mandatory for any gie section.
# Other properties are optional and if set will override the properties set in
# the infer config file.
[primary-gie]
enable=1
model-engine-file=../../models/Primary_Detector_Nano/resnet10.caffemodel_b4_fp16.engine
#Required to display the PGIE labels, should be added even when using config-file
#property
batch-size=4
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=4
#Required by the app for SGIE, when used along with config-file property
gie-unique-id=1
config-file=config_infer_primary_nano.txt

[tests]
file-loop=0

We use the four USB cameras:
[two E-Con See3CAM_CU135]
https://www.e-consystems.com/4k-usb-camera.asp
[one Logitech c930e]


[one Rocketfish HD]
https://www.rocketfishproducts.com/pdp/RF-HDWEB10/1996128

I just downloaded the latest deepstream and installed on nano.

I tried 4 webcams and it still cant do more than 2 webcams.

I noticed that you are using"resnet10.caffemodel_b4_fp16.engine"

I can only find “resnet10.caffemodel_b8_fp16.engine” in …/…/models/Primary_Detector_Nano/ folder

Where is “resnet10.caffemodel_b4_fp16.engine” located or how is it generated?

I have duplicated the settings in your post.

# config-file property is mandatory for any gie section.
# Other properties are optional and if set will override the properties set in
# the infer config file.
[primary-gie]
enable=1
model-engine-file=../../models/Primary_Detector_Nano/resnet10.caffemodel_b4_fp16.engine
#Required to display the PGIE labels, should be added even when using config-file
#property
batch-size=4
#Required by the app for OSD, not a plugin property
bbox-border-color0=1;0;0;1
bbox-border-color1=0;1;1;1
bbox-border-color2=0;0;1;1
bbox-border-color3=0;1;0;1
interval=4
#Required by the app for SGIE, when used along with config-file property
gie-unique-id=1
config-file=config_infer_primary_nano.txt

“resnet10.caffemodel_b4_fp16.engine” is generated automaticly at first running with nvinfer config setting batch-size=4 and network-mode=2

Do you have “deepstream_source_bin.c” configured for ‘YUYV’ or ‘MJPG’ (compressed)?

Hi,
The default code should work fine for YUYV format. We have verified it with Logitech C930e.

For MJPEG, one user has shared his experience:
https://devtalk.nvidia.com/default/topic/1058754/deepstream-sdk/how-to-change-source-pixel-format-from-yuyv-to-mjpg/post/5369809/#5369809

you need to change something on deepstream-app.c?

Hi,

No. We verify it by running default deepstream-app and the config file.

Please not there is bandwidth limitation if you use USB2 cameras. A related post:
https://devtalk.nvidia.com/default/topic/1067850/deepstream-sdk/connected-more-than-two-usb-cameras-problem-on-deepstream-app-jetson-nano-dev-kit-/post/5410823/#5410823