How to capture RTSP live stream in deepstream for running inference

Hello there,

I canot access RTSP live stream.

This is my deepstream configuration file:

source1_usb_dec_infer_resnet_int8.txt
################################################################################

Copyright (c) 2018-2020, NVIDIA CORPORATION. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a

copy of this software and associated documentation files (the “Software”),

to deal in the Software without restriction, including without limitation

the rights to use, copy, modify, merge, publish, distribute, sublicense,

and/or sell copies of the Software, and to permit persons to whom the

Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in

all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR

IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,

FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL

THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING

FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER

DEALINGS IN THE SOFTWARE.

################################################################################

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

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

[source0]
enable=1
#Type - 1=CameraV4L2 2=URI 3=MultiURI 4=RTSP
#type=1
type=4
uri=rtsp://admin:Netcon%40123@192.168.10.200:8554/cam/realmonitor?channel=1&subtype=0
camera-width=640
camera-height=480
camera-fps-n=30
camera-fps-d=1
#camera-v4l2-dev-node=0
#camera-v4l2-dev-node=1

[sink0]
enable=1
#Type - 1=FakeSink 2=EglSink/nv3dsink(Jetson only) 3=File 4=RTSPStreaming 5=nvdrmvideosink
type=2
sync=0
#conn-id=0
display-id=0
offset-x=0
offset-y=0
width=0
height=0
#plane-id=1
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
encoder type 0=Hardware 1=Software
enc-type=0
sync=0
bitrate=2000000
#H264 Profile - 0=Baseline 2=Main 4=High
#H265 Profile - 0=Main 1=Main10

set profile only for hw encoder, sw encoder selects profile based on sw-preset

profile=0
output-file=out.mp4
source-id=0

[sink2]
enable=0
#Type - 1=FakeSink 2=EglSink 3=File 4=RTSPStreaming 5=nvdrmvideosink
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

set profile only for hw encoder, sw encoder selects profile based on sw-preset

profile=0

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=1
##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=1280
height=720

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.

[primary-gie]
enable=1
model-engine-file=…/…/models/Primary_Detector/resnet10.caffemodel_b1_gpu0_int8.engine
#Required to display the PGIE labels, should be added even when using config-file
#property
batch-size=1
#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_yoloV8.txt
[tests]
file-loop=0

And I am facing error like, **PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
**PERF: 0.00 (0.00)
ERROR from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(6323): gst_rtsp_src_receive_response (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
Could not receive message. (Timeout while waiting for server response)
ERROR from src_elem0: Could not read from resource.
Debug info: gstrtspsrc.c(6421): gst_rtspsrc_try_send (): /GstPipeline:pipeline/GstBin:multi_src_bin/GstBin:src_sub_bin0/GstRTSPSrc:src_elem0:
Could not receive message. (Timeout while waiting for server response)
** INFO: <reset_source_pipeline:1706>: Resetting source 0

Kindly help me to solve the issue.

GST_DEBUG=3 gst-launch-1.0 rtspsrc location=“rtsp://admin:Netcon%40123@192.168.10.200:8554/cam/realmonitor?channel=1&subtype=0” latency=500 ! decodebin ! videoconvert ! autovideosink

Setting pipeline to PAUSED …
Pipeline is live and does not need PREROLL …
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://admin:Netcon%40123@192.168.10.200:8554/cam/realmonitor?channel=1&subtype=0
Progress: (open) Retrieving server options
0:00:20.062454008 10585 0xaaaada7c2240 WARN rtspsrc gstrtspsrc.c:6323:gst_rtsp_src_receive_response: error: Could not receive message. (Timeout while waiting for server response)
0:00:20.062620095 10585 0xaaaada7c2240 WARN rtspsrc gstrtspsrc.c:6421:gst_rtspsrc_try_send: error: Could not receive message. (Timeout while waiting for server response)
ERROR: from element /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0: Could not read from resource.
Additional debug info:
gstrtspsrc.c(6323): gst_rtsp_src_receive_response (): /GstPipeline:pipeline0/GstRTSPSrc:rtspsrc0:
Could not receive message. (Timeout while waiting for server response)
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
0:00:20.062788390 10585 0xaaaada7c2240 WARN rtspsrc gstrtspsrc.c:7973:gst_rtspsrc_open: can’t get sdp
0:00:20.062821735 10585 0xaaaada7c2240 WARN rtspsrc gstrtspsrc.c:6032:gst_rtspsrc_loop: we are not connected
Freeing pipeline …

This problem has nothing to do with deepstream.

It should only be caused by the excessive network delay of the rtsp camera.

Or increase the value of the tcp-timeout property of rtspsrc, but this may not solve the problem

gst-launch-1.0 rtspsrc location=xxx tcp-timeout=80000000