Nvuriscrbin is not able to reconnect the camera

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson
• DeepStream Version 6.3
• JetPack Version (valid for Jetson only) 5.1.3
• TensorRT Version
• NVIDIA GPU Driver Version (valid for GPU only)
• Issue Type( questions, new requirements, bugs)
• How to reproduce the issue ? (This is for bugs. Including which sample app is using, the configuration files content, the command line used and other details for reproducing)
• Requirement details( This is for new requirement. Including the module name-for which plugin or for which sample application, the function description)

I am using this code to create source

def create_source_bin(uri: str, index: int) -> Gst.Bin:
    """Create a Gstreamer Source Bin

    Args:
        uri (str): input uri
        index (int): index of the source bin

    Raises:
        Exception: if unable to create source bin
        Exception: if unable to create uri decode bin

    Returns:
        Gst.Bin: Gstreamer Source Bin
    """
    logger.info("Creating source bin")

    bin_name = f"source-bin-{index:02d}"
    logger.info(bin_name)
    nbin = Gst.Bin.new(bin_name)
    if not nbin:
        logger.error(" Unable to create source bin \n")
        raise Exception("Unable to create source bin")

    uri_decode_bin = Gst.ElementFactory.make("nvurisrcbin", "uri-decode-bin")
    uri_decode_bin.set_property("file-loop", 0)
    uri_decode_bin.set_property("cudadec-memtype", 0)
    uri_decode_bin.set_property('latency', 0)
    uri_decode_bin.set_property("rtsp-reconnect-interval", 10)
    # uri_decode_bin.set_property("rtsp-reconnect-attempts", 50)

    if not uri_decode_bin:
        logger.error(" Unable to create uri decode bin \n")
        raise Exception("Unable to create uri decode bin")

    uri_decode_bin.set_property("uri", uri)
    uri_decode_bin.connect("pad-added", cb_newpad, nbin)
    uri_decode_bin.connect("child-added", decodebin_child_added, nbin)

    Gst.Bin.add(nbin, uri_decode_bin)
    bin_pad = nbin.add_pad(
        Gst.GhostPad.new_no_target("src", Gst.PadDirection.SRC)
    )
    if not bin_pad:
        logger.error(" Failed to add ghost pad in source bin \n")
        return None
    return nbin

but it is not able to reconnect the camera, even the camera was up, and I have verified it using cv2.

2025-04-28 07:15:48,288 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

2025-04-28 07:16:08,289 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
2025-04-28 07:16:28,290 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

2025-04-28 07:16:48,291 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

2025-04-28 07:17:08,291 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
2025-04-28 07:17:28,292 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05} 

2025-04-28 07:17:48,292 : INFO: PID 1:  PERF: {0: 0.0, 1: 17.05}

Can you upgrade to the latest DeepStream 7.1 GA version?

How did you verify the failure? Can you provide the app and steps?

I reconnected the camera using opencv in a separate script, and it was working. I restarted the deepstream pipeline and nvurisrcbin was able to connect the rtsp camera. I am using deepstream-imagedata-mutlistream sample application based pipeline.

Few days ago, the camera was disconnected, but at that time nvurisrcbin was able to reconnect it.

I don’t understand the relationship of the opencv, nvurisrcbin and the camera you have mentioned.

And what happened to the camera when it is disconnected?

There wasn’t any issue with the camera, it was working fine, but the camera was disconnected from the deepstream pipeline, and nvurisrcbin was trying to connect it. It was failing again and again.

Just to verify if the camera was working properly I used this code to verify, and the camera was up.

import cv2
source = 'rtsp_url'
cap = cv2.VideoCapture(source)
if not cap.isOpened():
    return False
    
ret, frame = cap.read()
print("Resolution:", frame.shape, " FPS:", cap.get(cv2.CAP_PROP_FPS))
cap.release()

How did you disconnect the camera?

It was automatically disconnected.

We need to know the reason of the disconnection.
Is there any error log for the reconnection failure?

There wasn’t any issue in the camera, but both cameras got disconnected without any error. and on restarting the deepstream pipeline both cameras are working.

2025-04-30 01:06:14,843 : INFO: PID 1:  PERF: {0: 4.7, 1: 4.6} 

2025-04-30 01:06:34,845 : INFO: PID 1:  PERF: {0: 4.65, 1: 4.7} 

2025-04-30 01:06:54,845 : INFO: PID 1:  PERF: {0: 8.2, 1: 8.2} 

2025-04-30 01:07:14,846 : INFO: PID 1:  PERF: {0: 9.2, 1: 9.25} 

2025-04-30 01:07:34,846 : INFO: PID 1:  PERF: {0: 8.75, 1: 8.7} 

2025-04-30 01:07:54,847 : INFO: PID 1:  PERF: {0: 8.05, 1: 8.0} 

2025-04-30 01:08:14,848 : INFO: PID 1:  PERF: {0: 8.35, 1: 8.4} 

2025-04-30 01:08:34,849 : INFO: PID 1:  PERF: {0: 9.45, 1: 9.45} 

2025-04-30 01:08:54,850 : INFO: PID 1:  PERF: {0: 22.6, 1: 22.6} 

2025-04-30 01:09:14,853 : INFO: PID 1:  PERF: {0: 21.3, 1: 21.35} 

WARNING: [TRT]: Using an engine plan file across different models of devices is not recommended and is likely to affect performance or even cause errors.
INFO: [FullDims Engine Info]: layers num: 4
0   INPUT  kFLOAT input           3x640x640       min: 1x3x640x640     opt: 2x3x640x640     Max: 2x3x640x640     
1   OUTPUT kFLOAT boxes           8400x4          min: 0               opt: 0               Max: 0               
2   OUTPUT kFLOAT scores          8400x1          min: 0               opt: 0               Max: 0               
3   OUTPUT kFLOAT classes         8400x1          min: 0               opt: 0               Max: 0               

Opening in BLOCKING MODE 
Opening in BLOCKING MODE 
Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
Resetting source rtsp://root:optera123@10.8.207.127/axis-media/media.amp?fps=18
2025-04-30 01:09:39,449 : INFO: PID 1: Warning: gst-stream-error-quark: No data from source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18 since last 10 sec. Trying reconnection (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvdsbins/gstdsnvurisrcbin.cpp(1266): watch_source_status (): /GstPipeline:pipeline0/GstBin:source-bin-00/GstDsNvUriSrcBin:uri-decode-bin

2025-04-30 01:09:39,450 : INFO: PID 1:  PERF: {0: 2.6, 1: 2.56} 

2025-04-30 01:09:39,520 : INFO: PID 1: Warning: gst-stream-error-quark: No data from source rtsp://root:optera123@10.8.207.127/axis-media/media.amp?fps=18 since last 15 sec. Trying reconnection (1): /dvs/git/dirty/git-master_linux/deepstream/sdk/src/gst-plugins/gst-nvdsbins/gstdsnvurisrcbin.cpp(1266): watch_source_status (): /GstPipeline:pipeline0/GstBin:source-bin-01/GstDsNvUriSrcBin:uri-decode-bin

2025-04-30 01:09:59,449 : INFO: PID 1:  PERF: {0: 0.15, 1: 0.2} 

2025-04-30 01:10:19,449 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:10:39,450 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
Resetting source rtsp://root:optera123@10.8.207.127/axis-media/media.amp?fps=18
2025-04-30 01:10:59,451 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:11:19,452 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:11:39,453 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
Resetting source rtsp://root:optera123@10.8.207.127/axis-media/media.amp?fps=18


2025-04-30 01:11:59,453 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:12:19,454 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:12:39,454 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

Resetting source rtsp://root:optera123@10.8.207.117/axis-media/media.amp?fps=18
Resetting source rtsp://root:optera123@10.8.207.127/axis-media/media.amp?fps=18
2025-04-30 01:12:59,455 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

2025-04-30 01:13:19,455 : INFO: PID 1:  PERF: {0: 0.0, 1: 0.0} 

Please use “export GST_DEBUG=rtspsrc:7” to enable the DeepStream RTSP related log, and please provide the log for time when the camera disconnected.

And please check with your camera whether it release the session when it is disconnected.

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