How to define different nvvideoconvert for each rtsp stream in deepstream python apps?

• Hardware Platform (Jetson / GPU) : jetson
• DeepStream Version : 5.0 ga
• JetPack Version (valid for Jetson only) : 4.4
• TensorRT Version : 7.1.x

Hi all,
If I want to have difference nvvideoconvert element for difference rtsp sources, How I can to define this? My goal is to define difference ROI(src-crop, dest-crop) property of nvvideoconvert for each RTSP stream?

In this link, all of streams have same nvvideoconvert with same property, but I want to define different property of this element for each stream.

Hi,
The stream multiplexer element (nvstreammux) takes multiple incoming streams and adds them into a single one. All the converters in that example are added after the stream mux, which means they can not operate each stream individually.

You can add the croping element (videocrop or nvvideoconvert) just after the source bin (pipeline.add(source_bin)) to operate each stream before it gets into the stream mux. Here are some example pipelines:

With videocrop:

... ! nvvideoconvert ! videocrop left=0 right=640 top=0 bottom=240 ! nvvideoconvert ! 'video/x-raw(memory:NVMM), width=640, height=480' ! ...

With nvvideoconvert:

... ! nvvideoconvert src-crop=0:0:1280:720 ! 'video/x-raw(memory:NVMM),width=1280,height=720' ! ...

Some smaller resolutions might give you problems with nvvideoconvert as discussed here but otherways is the way to go, since videocrop is slower.

1 Like

Thanks so much, @miguel.taylor,
Q1- I added nvvideoconvert after pipeline.add(source_bin) with different names like this ?

nvvidconv = Gst.ElementFactory.make(“nvvideoconvert”, “convertor{i}”.format(i))
pipeline.add(nvvidconv)

Q2- Where and How I linked these nvvidonv elements?


source_bin=create_source_bin(i, uri_name)
nvvidconv = Gst.ElementFactory.make(“nvvideoconvert”, “convertor{i}”.format(i))
nvvidconv.set_property(‘src-crop’, … )
source_bin.linked(nvvidconv)
pipeline.add(source_bin)
pipeline.add(nvvidconv)

Is it correct?

Q3- What are difference between src-crop and dest-crop?

Q4- since videocrop is slower. This is only for CPU?

Q1- Yes, exactly
Q2- The example is linking each source bin to a new pad in streamux:

        padname="sink_%u" %i
        sinkpad= streammux.get_request_pad(padname) 
        ...
        srcpad=source_bin.get_static_pad("src")
        ...
        srcpad.link(sinkpad)

You need to replace this logic to link each source bin to a nvvideoconvert and then the converter to the streammux

Q3- I don’t know =/
Q4- videocrop uses CPU and needs an extra memory copy

Your mean is that:

    padname="sink_%u" %i
    sinkpad= streammux.get_request_pad(padname) 
    ...
    srcpad=source_bin.get_static_pad("src")
    ...
    srcpad.link(sinkpad)

Modify to this:

    ...
    srcpad=source_bin.get_static_pad("src")
    ...
    srcpad.link(nvvidcon)

If so, we don’t need the below codeos?

padname=“sink_%u” %i
sinkpad= streammux.get_request_pad(padname)

Something like this:

    padname="sink_%u" %i
    streammux_sinkpad= streammux.get_request_pad(padname) 
    source_srcpad=source_bin.get_static_pad("src")
    nvvidconv_srcpad=source_bin.get_static_pad("src")
    nvvidconv_sinkpad=source_bin.get_static_pad("sink")
    source_srcpad.link(nvvidconv_sinkpad)
    nvvidconv_srcpad.link(streammux_sinkpad)

Thanks so much,

nvvidconv_srcpad=source_bin.get_static_pad("src")
nvvidconv_sinkpad=source_bin.get_static_pad("sink")

These are must to be the below codes.

nvvidconv_srcpad=nvvidcon.get_static_pad("src")
nvvidconv_sinkpad=nvvidcon.get_static_pad("sink")
1 Like

I know this is an older post, but I found it useful. However did this completely work for you? When I use the same ROI for each stream it works fine, but when I use differents ROI’s for each stream I am getting segmentation faults, did you encounter this?