Forking the output from tracker to a nvvidconv and streamdemux elements

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) Jetson Xavier AGX
• DeepStream Version 6.0.1
• JetPack Version (valid for Jetson only) 4.6
• TensorRT Version 8.2.1

Hi there,

I have n RTSP sources that are processed by Deepstream pipeline and produce another n RTSP streams (and it works fine) just like the following schema:

2 RTSP streams … → streammux → pgie → tracker → streamdemux → … perform stuff to create 2 RTSP streams

Now I need to get the output of the tracker, fork it and send it to another branch where I will create another RTSP stream, just like the following:

2 RTSP streams … → streammux → pgie → tracker:
→ streamdemux → … perform stuff to create 2 RTSP streams
→ nvvidconv → tiler … perform other stuff to create another RTSP stream

This is the code:

    print("Linking elements in the Pipeline")
    streammux.link(pgie)
    pgie.link(tracker)
    #Fork into several branches, as much as the number of stream in my batch
    tracker.link(streamdemux)
    for i in range(number_sources):
        print("demux source", i, "\n")
        srcpad1 = streamdemux.get_request_pad("src_%u"%i)
        if not srcpad1:
            sys.stderr.write(" Unable to get the src pad of streamdemux \n")
        sinkpad1 = nvvidconv[i].get_static_pad("sink")
        if not sinkpad1:
            sys.stderr.write(" Unable to get sink pad of nvvidconv \n")
        srcpad1.link(sinkpad1)
        nvvidconv[i].link(nvosd[i])
        nvosd[i].link(nvvidconv_postosd[i])
        nvvidconv_postosd[i].link(caps[i])
        caps[i].link(encoder[i])
        encoder[i].link(rtppay[i])
        rtppay[i].link(sink[i])
    #Fork for the tiler branch
    tracker.link(nvvidconv4tile)
    nvvidconv4tile.link(tiler)
    tiler.link(nvosd4tile)
    nvosd4tile.link(nvvidconv_postosd4tile)
    nvvidconv_postosd4tile.link(caps4tile)
    caps4tile.link(encoder4tile)
    encoder4tile.link(rtppay4tile)
    rtppay4tile.link(sink4tile)

The issue is: when a do a second link ( “tracker.link(nvvidconv4tile)” ) it returns False, GST_PAD_LINK_WAS_LINKED. So I guess I can’t do tracker.link(blablabla) and then another tracket.link(bububu). How do I link such branch?

You can try to add tee plugin to add a new branch. The tracker plugin can just link one plugin.

So this is the schema you proposed:
tracker → nvtee:
→ streamdemux
→ nvvidconv

I tried to link the first branch (nvtee → streamdemux). This is the code:

    tracker.link(teeforking)
    #teeforking.link(streamdemux)
    teesourcepad = teeforking.get_static_pad("vid_src")
    if not teesourcepad:
        sys.stderr.write(" Unable to get the src pad of teeforking \n")
    demuxsinkpad = streamdemux.get_static_pad("sink")
    if not demuxsinkpad:
        sys.stderr.write(" Unable to get the sink pad of demux \n")
    teesourcepad.link(demuxsinkpad)

Now, there is nothing getting out from pipeline. My linking seems to be OK, isn’t it? So, do you have any tip of what is wrong?

By the way, this is how I created the tee element and added it to pipeline:

teeforking = make_elm_or_print_err("nvtee", "nvtee")
pipeline.add(teeforking)

You can refer to our demo code: https://github.com/NVIDIA-AI-IOT/deepstream_python_apps/blob/master/apps/deepstream-test4/deepstream_test_4.py#L382

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