How to set Framerate when reading feed from RTSP cam url using Gstreamer for a deepstream application?

Please provide complete information as applicable to your setup.

• Hardware Platform (dGPU)
• DeepStream Version 6.0
• JetPack Version (Not applicable)
• TensorRT Version 8.0.1.6
• NVIDIA GPU Driver Version 470.103.01
• Issue Type( questions)

I have a camera which run at 25fps, Need to access the feed from the same camera with reduced fps (5) using GST. we are using deepstream and hence i was looking for solutions in nvidia forums.

The following code is from nvidia deepstream sample apps.

I saw a post in nvidia forums they suggested to use videorate to throtle the fps. However i’m confused about placement of videorate property.Should it be placed after uri-decode-bin?

Could anyone help?

        GObject.threads_init()
        Gst.init(None)        
        
        pipeline = Gst.Pipeline()
        source_bin = create_source_bin(cam_url)
        pipeline.add(source_bin)
        filter = create_videorate_filter()
        pipeline.add(filter)

create_source_bin (Copied from deepstream python apps sample)

def create_source_bin(cam_url):
    bin_name = "source-bin-test"
    nbin = Gst.Bin.new(bin_name)
    # Source element for reading from the cam_url.
    uri_decode_bin = Gst.ElementFactory.make("uridecodebin", "uri-decode-bin")
    uri_decode_bin.set_property("uri", cam_url)    
    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))
    return nbin

My proposed videorate fiter with nvmm memory as seen from nvidia forum posts

def  create_videorate_filter():
    filter = Gst.ElementFactory.make('videorate', 'videorate')
    caps = Gst.caps_from_string("video/x-raw(memory:NVMM),framerate=5/1")
    filter.set_property("caps", caps)
    if not filter:
        sys.stderr.write(" Unable to create capsfilter \n")

    return filter

Is this the right thing to do?
Where should be the videorate filter placed?

Hi @user151731,

I think you should use “Gst-nvvideo4linux2” plugin and set “drop-frame-interval” property.
https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_gst-nvvideo4linux2.html

You can refer to below topic for sample python code and pipeline that can be used here:

Thanks

1 Like

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