I want to use "nvurisrcbin" into RTSP IN RTSP OUT How I can use it ? getting ERROR!

Please provide complete information as applicable to your setup.

**• Hardware Platform -----> GPU
**• DeepStream Version -------> 6.2
**• TensorRT Version ----------> 8.5
**• NVIDIA GPU Driver Version ------------> 535

def cb_newpad(decodebin, decoder_src_pad, data):
print(“In cb_newpad\n”)
caps = decoder_src_pad.get_current_caps()
print("caps --------------------> ",caps,decoder_src_pad)
# print("caps filter ------------------ caps -----> ",caps,decodebin,decoder_src_pad,data)
gststruct = caps.get_structure(0)
gstname = gststruct.get_name()
source_bin = data
features = caps.get_features(0)

# Need to check if the pad created by the decodebin is for video and not
# audio.
print("gstname=", gstname)
if gstname.find("video") != -1:
    # Link the decodebin pad only if decodebin has picked nvidia
    # decoder plugin nvdec_*. We do this by checking if the pad caps contain
    # NVMM memory features.
    print("features=", features)
    if features.contains("memory:NVMM"):
        # Get the source bin ghost pad
        bin_ghost_pad = source_bin.get_static_pad("src")
        if not bin_ghost_pad.set_target(decoder_src_pad):
                "Failed to link decoder src pad to source bin ghost pad\n"
            " Error: Decodebin did not pick nvidia decoder plugin.\n")

def decodebin_child_added(child_proxy, Object, name, user_data):
print(“Decodebin child added:”, name, “\n”)
if name.find(“decodebin”) != -1:
Object.connect(“child-added”, decodebin_child_added, user_data)

def create_source_bin(index, uri):
print(“Creating source bin”)

# Create a source GstBin to abstract this bin's content from the rest of the
# pipeline
bin_name = "source-bin-%02d" % index
nbin = Gst.Bin.new(bin_name)
if not nbin:
    sys.stderr.write(" Unable to create source bin \n")

# Source element for reading from the uri.
# We will use decodebin and let it figure out the container format of the
# stream and the codec and plug the appropriate demux and decode plugins.
# uri_decode_bin = Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")
uri_decode_bin = Gst.ElementFactory.make("nvurisrcbin", "uri-decode-bin")
if not uri_decode_bin:
    sys.stderr.write(" Unable to create uri decode bin \n")
uri_decode_bin.set_property("uri", uri)
uri_decode_bin.set_property("rtsp-reconnect-interval", 30)
uri_decode_bin.set_property("latency", 100)
uri_decode_bin.set_property("cudadec-memtype", 0)
# We set the input uri to the source element
# uri_decode_bin.set_property("uri", uri)
# Connect to the "pad-added" signal of the decodebin which generates a
# callback once a new pad for raw data has beed created by the decodebin
uri_decode_bin.connect("pad-added", cb_newpad, nbin)
uri_decode_bin.connect("child-added", decodebin_child_added, nbin)

# We need to create a ghost pad for the source bin which will act as a proxy
# for the video decoder src pad. The ghost pad will not have a target right
# now. Once the decode bin creates the video decoder and generates the
# cb_newpad callback, we will set the ghost pad target to the video decoder
# src pad.
Gst.Bin.add(nbin, uri_decode_bin)
bin_pad = nbin.add_pad(
        "src", Gst.PadDirection.SRC))
if not bin_pad:
    sys.stderr.write(" Failed to add ghost pad in source bin \n")
    return None
return nbin

THIS is I change in the code
getting this error “”“”“”
gststruct = caps.get_structure(0)
AttributeError: ‘NoneType’ object has no attribute ‘get_structure’

how I can solve this problem

You can refer to our demo code: deepstream_test_3.py

IN --------> deepstream_test_3.py Here When .mp4 file that time we are calling “nvurisrcbin”
and when It’s RTSP That time normal Uridecodebin , But How I can use “nvurisrcbin” for RTSP input and able to inference !

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

You can just use the rtsp source like: python3 deepstream_test_3.py -i rtsp:// --file-loop 1 ....

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.