How to add rtsp source settings like latency, rtsp-reconnect-interval-sec, gpu-id etc. in deepstream-nvdsanalytics-test

I would like to configure rtsp resources in this test, but I cannot figure out where in the code I should do it, and I did not find a similar solution among the presented examples. I guess it must be somewhere in create_source_bin but I can’t figure out exactly where…
Could you help me with this
Thanks.

static GstElement *
create_source_bin(guint index, gchar *uri) {
    GstElement *bin = NULL, *uri_decode_bin = NULL;
    gchar bin_name[16] = {};

    g_snprintf(bin_name, 15, "source-bin-%02d", index);
    /* Create a source GstBin to abstract this bin's content from the rest of the
     * pipeline */
    bin = gst_bin_new(bin_name);

    /* 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_element_factory_make("uridecodebin", "uri-decode-bin");

    if (!bin || !uri_decode_bin) {
        g_printerr("One element in source bin could not be created.\n");
        return NULL;
    }

    /* We set the input uri to the source element */
    g_object_set(G_OBJECT(uri_decode_bin), "uri", uri, NULL);

    /* 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 */
    g_signal_connect(G_OBJECT(uri_decode_bin), "pad-added",
                     G_CALLBACK(cb_newpad), bin);
    g_signal_connect(G_OBJECT(uri_decode_bin), "child-added",
                     G_CALLBACK(decodebin_child_added), bin);

    gst_bin_add(GST_BIN(bin), uri_decode_bin);

    /* 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. */
    if (!gst_element_add_pad(bin, gst_ghost_pad_new_no_target("src",
                                                              GST_PAD_SRC))) {
        g_printerr("Failed to add ghost pad in source bin\n");
        return NULL;
    }

    return bin;
}

Hi,
The samples is implemented with uridecodebin. You would need to manually construct the pipeline to

rtspsrc ! rtph264 depay ! h264parse ! nvv4l2decoder ! ...

And configure properties to the plugins.

You may refer to create_rtsp_src_bin() in

deepstream-5.0\sources\apps\apps-common\src\deepstream_source_bin.c
1 Like

“rtspsrc” has timeout and retry ,Can it achieve rtsp-reconnect-interval?
Waiting for your reply

rtspsrc Properties

Hi gharbv,

Please help to open a new topic with more details. Thanks

Hi!
I’m working with secure RTSP inputs (rtsps://), and DS-5.1 python bindings.
Now I want to add tls-validation-flags=insecure to the rtsp configuration.
Is there an example for building and configuring rtsp in pyhon?

Hi xtianhb.glb,

Please help to open a new topic if it’s still an issue. Thanks