Error when running deepstream-app with multiple RTSP input

Issue

Hi,
I attempted to run a simple deepstream application with:
Input: 4 RTSP streams
Output: 4 RTSP streams

With 3 RTSP streams for input and output, the app ran OK.

deepstream-app -c config_rtsp_3.txt 

 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8010/ds-test ***
 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8011/ds-test ***
 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8012/ds-test ***

Runtime commands:
        h: Print this help
        q: Quit
        p: Pause
        r: Resume

** INFO: <bus_callback:181>: Pipeline ready
** INFO: <bus_callback:167>: Pipeline running

**PERF:  FPS 0 (Avg)    FPS 1 (Avg)     FPS 2 (Avg)
**PERF:  26.32 (26.08)  26.55 (26.30)   26.32 (26.08)
**PERF:  25.20 (25.72)  25.00 (25.72)   25.20 (25.72)
**PERF:  24.79 (25.40)  24.79 (25.40)   24.99 (25.47)

However when the number of sources increase to 4, the application crashed with the following errors: could not write to resource.

deepstream-app -c config_rtsp_4.txt 

 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8010/ds-test ***
 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8011/ds-test ***
 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8012/ds-test ***
 *** DeepStream: Launched RTSP Streaming at rtsp://localhost:8013/ds-test ***

Runtime commands:
        h: Print this help
        q: Quit
        p: Pause
        r: Resume

** INFO: <bus_callback:181>: Pipeline ready

ERROR from src_elem3: Could not write to resource.
Debug info: gstrtspsrc.c(7023): gst_rtspsrc_setup_streams_start (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Error (500): Internal Server Error
** INFO: <reset_source_pipeline:1433>: Resetting source 3
WARNING from src_elem3: Could not read from resource.
Debug info: gstrtspsrc.c(5293): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Unhandled return value -7.
ERROR from src_elem3: Could not read from resource.
Debug info: gstrtspsrc.c(5361): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Could not receive message. (System error)
ERROR from src_elem3: Internal data stream error.
Debug info: gstrtspsrc.c(5653): gst_rtspsrc_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
streaming stopped, reason error (-5)
ERROR from src_elem3: Could not write to resource.
Debug info: gstrtspsrc.c(7023): gst_rtspsrc_setup_streams_start (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Error (500): Internal Server Error
WARNING from src_elem3: Could not read from resource.
Debug info: gstrtspsrc.c(5293): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Unhandled return value -7.
ERROR from src_elem3: Could not read from resource.
Debug info: gstrtspsrc.c(5361): gst_rtspsrc_loop_udp (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Could not receive message. (System error)
ERROR from src_elem3: Internal data stream error.
Debug info: gstrtspsrc.c(5653): gst_rtspsrc_loop (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
streaming stopped, reason error (-5)

**PERF:  FPS 0 (Avg)    FPS 1 (Avg)     FPS 2 (Avg)     FPS 3 (Avg)
**PERF:  26.67 (26.65)  26.17 (26.15)   26.17 (26.15)   0.00 (0.00)
**PERF:  25.00 (25.76)  25.00 (25.54)   25.20 (25.64)   0.00 (0.00)
**PERF:  25.17 (25.50)  25.17 (25.35)   24.97 (25.35)   0.00 (0.00)
^C** ERROR: <_intr_handler:140>: User Interrupted.. 

Quitting
App run successful

Can you please help me how to solve this problem?
My config.txt file is attached below and can run with the command:

deepstream-app -c config_rtsp_4.txt

config_rtsp_3.txt

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


[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[source2]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0


[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8010
udp-port=5401

[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8011
udp-port=5402

[sink2]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8012
udp-port=5403





[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=0
batch-size=30
##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=1920
height=1080
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0
## If set to TRUE, system timestamp will be attached as ntp timestamp
## If set to FALSE, ntp timestamp from rtspsrc, if available, will be attached
# attach-sys-ts-as-ntp=1

# 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.

[tests]
file-loop=0

config_rtsp_4.txt

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


[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[source1]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[source2]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[source3]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
type=4
uri=rtsp://admin:gggggg@172.16.1.118:554
num-sources=1
#drop-frame-interval=2
gpu-id=0
# (0): memtype_device   - Memory type Device
# (1): memtype_pinned   - Memory type Host Pinned
# (2): memtype_unified  - Memory type Unified
cudadec-memtype=0

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8010
udp-port=5401

[sink1]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8011
udp-port=5402

[sink2]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8012
udp-port=5403

[sink3]
enable=1
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming
type=4
#1=h264 2=h265
codec=1
#encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=4000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10
profile=0
# set below properties in case of RTSPStreaming
rtsp-port=8013
udp-port=5404



[streammux]
gpu-id=0
##Boolean property to inform muxer that sources are live
live-source=0
batch-size=30
##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=1920
height=1080
##Enable to maintain aspect ratio wrt source, and allow black borders, works
##along with width, height properties
enable-padding=0
nvbuf-memory-type=0
## If set to TRUE, system timestamp will be attached as ntp timestamp
## If set to FALSE, ntp timestamp from rtspsrc, if available, will be attached
# attach-sys-ts-as-ntp=1

# 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.

[tests]
file-loop=0

Environment

• Hardware Platform: Tesla T4
• DeepStream Version: 5.0
• TensorRT Version: 7.2.1
• NVIDIA GPU: Driver Version 455.32, CUDA Version 11.1
• OS: Ubuntu 18.04

I can not reproduce the same failure in our T4 enviroment with your second config file(use our own rtsp source).

Thank you. So:

  1. Did the second config work fine in your T4 environment? In that case, can you show the information of your environment?

  2. I tried upgrade to DS 5.1 but still got the same error. Every URI for rtsp source is the same, however deepstream-app can only run at maximum 3 streams for number of sources that > 3, the other streams encountered the above error

ERROR from src_elem3: Could not write to resource.
Debug info: gstrtspsrc.c(7023): gst_rtspsrc_setup_streams_start (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin3/GstRTSPSrc:src_elem3:
Error (500): Internal Server Error

I think the problem is somehow related to the hardware, but im not sure. Do you have any suggestions for this type of error? Thank u

  1. Yes. the second config file works well. Run with deepstream5.1 on T4
  2. What is the format and resolution of your rtsp stream? I tried with 1080p h264 stream. There is no limitation in our software. The error in your log shows rtsp connection failure.

I tried running with another rtsp stream URI and it worked. I think the problem is now solved. Thank you!