How to set drop-frame-interval in Python all

Please provide complete information as applicable to your setup.

**• Hardware Platform (Jetson / GPU)**RTX4080
• DeepStream Version7.0
In c application, we can set drop-frame-interval to adjust fps and drop frames.
In Python app, how can I set drop-frame-interval?

1 Like

Do you mean using uridecodebin?
Refer the deepstream_test_3.py sample.

Just like:

uri_decode_bin.connect("child-added",decodebin_child_added,nbin)

def decodebin_child_added(child_proxy,Object,name,user_data):
    print("Decodebin child added:", name, "\n")
    if(name.find("decodebin") != -1):
        Object.connect("child-added",decodebin_child_added,user_data)

    if "source" in name:
        source_element = child_proxy.get_by_name("source")
        if source_element.find_property('drop-on-latency') != None:
            Object.set_property("drop-on-latency", True)

No what I meaned is that I can set drop-frame-interval in config file.
drop-frame-interval = 2 means every 2 frames is dropped in streaming so that I can reduce fps.
How to set similar thing in python app?

Python currently does not support settings in the configuration file, which is a feature of deepstream-app.

You need to use the code above to do the similar job.

Can I modify in code? Which part should I modify?

If you are using uridecodebin, please refer to the above code.

What I did was

def decodebin_child_added(child_proxy, Object, name, user_data):
    print("Decodebin child added:", name, "\n")
    if name.find("decodebin") != -1:
        Object.connect("child-added", decodebin_child_added, user_data)

    if not platform_info.is_integrated_gpu() and name.find("nvv4l2decoder") != -1:
        # Use CUDA unified memory in the pipeline so frames can be easily accessed on CPU in Python.
        # 0: NVBUF_MEM_CUDA_DEVICE, 1: NVBUF_MEM_CUDA_PINNED, 2: NVBUF_MEM_CUDA_UNIFIED
        # Dont use direct macro here like NVBUF_MEM_CUDA_UNIFIED since nvv4l2decoder uses a
        # different enum internally
        Object.set_property("cudadec-memtype", 2)

    if "source" in name:
        source_element = child_proxy.get_by_name("source")
        Object.set_property("drop-frame-interval", 3)
        if source_element.find_property('drop-on-latency') != None:
            Object.set_property("drop-on-latency", True)

Put drop-frame-interval", 3, but it doesn’t change. I am using rtsp streaming. My code is using deepstream-imagedata-multistream

I see the message as
TypeError: object of type GstRTSPSrc' does not have property drop-frame-interval’

def decodebin_child_added(child_proxy,Object,name,user_data):
    print("Decodebin child added:", name, "\n")
    if(name.find("decodebin") != -1):
        Object.connect("child-added",decodebin_child_added,user_data)

    if "nvv4l2decoder" in name:
        if Object.find_property('drop-frame-interval') != None:
            Object.set_property("drop-frame-interval", 10)

    if "source" in name:
        source_element = child_proxy.get_by_name("source")
        if source_element.find_property('drop-on-latency') != None:
            Object.set_property("drop-on-latency", True)

I did like that and it works. Thanks

if(name.find("nvv4l2decoder") != -1):
        Object.set_property("drop-frame-interval", 3)

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