How to handle if RTSP url is invalid or it got disrupted in between?

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) GPU
• DeepStream Version Deepstream 6.2
• Issue Type( questions, new requirements, bugs) question
• Language python

I was trying out runtim_source_add_delete in deepstream Python apps, and I added RTSP streams. Sometimes due to network issues or some other reason, the connection gets disrupted, and the application terminates. I am looking for some means to handle this issue, whether the inserted RTSP URL is incorrect or if the connection gets closed in between.

please refer to this topic.

I still, get this error

AttributeError: 'NoneType' object has no attribute 'get_structure'

from the function def cb_newpad(decodebin,pad,data): ( runtime_source_add_delete code in deepstream python apps)

from the error, the caps is empty.

but i am providing the right rstp url

i just replaced the uridecodebin with nvurisrcbin and added a additional line bin.set_property("uri",uri) in create_uridecode_bin() in runtime_source_add_delete code in deepstream python apps

and got this error

AttributeError: 'NoneType' object has no attribute 'get_structure'

from the function `def cb_newpad(decodebin,pad,data)

do I have to make any other changes if I replace uridecodebin with nvurisrcbin

please refer to for nvurisrcbin’s using.

i would like to add the source in runtime, if an invalid RTSP URL is added I get error at the bin.connect()


def cb_newpad(self,decodebin,pad,data):"In cb_newpad\n")

AttributeError: ‘NoneType’ object has no attribute ‘get_structure’

1 Like

Thanks for the sharing. can we know the caps’s struct size?

pardon mee, i dont understand, did u mean the codec or video size?

it seemed caps was null. I can’t reproduce this issue by testing without code modification. for example, rtsp:// is a valid RTSP source. when I tested rtsp://, the app did not trigger cb_newpad function. here is the log:
log-93.txt (2.5 KB)

running this command gives me a window with black screen
gst-launch-1.0 -v nvurisrcbin uri=rtsp://admin:123456@ rtsp-reconnect-interval=5 ! nveglglessink

can you narrow down this issue? it is camera problem or nvurisrcbin problem or pipeline isuse?

i believe the issue is with nvurisrcbin because it works fine with uridecodebin

  1. how did you test? is it black at the first frame? is it black after rtsp reconnection?
  2. can you dump some stream data? I will have a try. here is the command:
    gst-launch-1.0 rtspsrc location=rtsp:// ! rtph264depay ! h264parse ! mux. mpegtsmux name=mux ! filesink location=output.ts
  3. I can’t reproduce the issue after testing my stream. here is the commandline:
    gst-launch-1.0 nvurisrcbin uri=rtsp:// ! nvvideoconvert ! ‘video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12’ ! nvv4l2h264enc bitrate=1000000 ! filesink location=test.264

running this code for couple of seconds generated a file of almost 1MB

running this code generated generated a file of 0 byte

could you use that command to dump 3 minutes RTSP stream data and share with us? Thanks! we will use nvurisrcbin to check.

only thing changed in the above command is the rtsp URL and this is the generated file
output.ts (7.4 MB)

  1. I tested this output.ts in T4 + 6.2-devel docker container. nvurisrcbin can decode the file.
    test1 commandine: gst-launch-1.0 nvurisrcbin uri=file:///home/rec/output.ts ! fakesink
    test1.txt (2.0 KB)
    test2 commandline: gst-launch-1.0 nvurisrcbin uri=file:///home/rec/output.ts ! nvvideoconvert ! ‘video/x-raw(memory:NVMM), width=1920, height=1080, format=NV12’! nvv4l2h264enc bitrate=1000000 ! filesink location=test.264
    test2.txt (600 Bytes)

could you share more logs? please do “export GST_DEBUG=6” first to modify Gstreamer’s log level, then run again, you can redirect the logs to a file.

could you also provide this commandline’s GST_DEBUG=6 log?