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
• 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?

        pipeline = Gst.Pipeline()
        source_bin = create_source_bin(cam_url)
        filter = create_videorate_filter()

create_source_bin (Copied from deepstream python apps sample)

def create_source_bin(cam_url):
    bin_name = "source-bin-test"
    nbin =
    # 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.

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


1 Like

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