Deepstream 5.0 Gst-nvdsanalytics access meta data in Python

I am trying to use the new Gst-nvdsanalytics plugin to gather line counting data and send it to azure IOT using the msg conv and broker.

I have my python script (a combination of deepstream-test3 and 4) working and can see the analytics lines and counts on the osd and data to going to azure IOT hub.

How do I access the analytics data to send it to azure? I am after the frame analytics information. From the plugin docs I have this: The analytics output (Frame level) is encapsulated in the NvDsAnalyticsFrameMeta structure and is added as user meta with meta_type set to NVDS_USER_FRAME_META_NVDSANALYTICS.The user meta is added to the frame_user_meta_list member of NvDsFrameMeta. Code below:

batch_meta = pyds.gst_buffer_get_nvds_batch_meta(hash(gst_buffer))
l_frame = batch_meta.frame_meta_list

frame_meta = pyds.NvDsFrameMeta.cast(

l_user = frame_meta.frame_user_meta_list

After that I am not sure, any help would be much appreciated :)

Still having issues here. Looking at the python docs I can see that the following casting functions are available:


When i look at the deepstream_nvdsanalytics_test.cpp example I see that the frame analytics data is accessed using:
NvDsAnalyticsFrameMeta *meta =(NvDsAnalyticsFrameMeta *) user_meta->user_meta_data;

Does that mean I cannot access the analytics data using the Python bindings because there is no NvDsAnalyticsFrameMeta.cast in python bindings?

Hey Customer,
nvdsanalytics is a new plugin added in DS5.0, currently we cannot access NvDsAnalyticsFrameMeta in python app, just like what you said we need to add Python bingdings to support it in upcoming release.

1 Like

Thanks, will wait for the next release of the python bindings. Understand that time frames on development are hard but is this a week, month, 6 months timeline?

1 Like

Same question here, we need to access NvDsAnalyticsFrameMeta in python app, otherwise we cannot get the number of line crossing objects etc. Do you guys have release roadmap? Thanks.

1 Like

Not yet support this in DS5.0-GA?


1 Like

Deepstream 5.0 is released still no casting functions available, how do we access the metadata or will have to wait for it.

I was wondering if anyone has an example to set the nvdsanayltics plugin parameters,

Im assuming it would go after the pgie->tracker->nvdsanalytics

Below is my thinking for how we would set each streams properties

# Set properties of tracker
config = configparser.ConfigParser()'config_nvdsanalytics.txt')
for key in config:
    # print('key',key)
    # print('val',config[key])
    section = config[key]
    if == "property":
        for sec_key,val in section.items():
            if key == 'enable':
                dsA = config.get('enable', sec_key)
                analytics.set_property('enable', dsA)
            if key == 'config-width':
                dsA_width = config.get('config-width', sec_key)
                analytics.set_property('config-width', dsA_width)
            if key == 'config-height':
                dsA_height = config.get('config-height', sec_key)
                analytics.set_property('config-height', dsA_height)
        if 'stream' in
            for sec_key,val in section.items():
                #section <Section: roi-filtering-stream-0>
                #sec_key enable 1
                #sec_key roi-rf 295;643;579;634;642;913;56;828
                #sec_key inverse-roi 0
                #sec_key class-id -1
                analytics.set_property(sec_key, val)

Nevermind I completely over thought it, I found reference from “deepstream_nvdsanalytics_test.cpp”

if it helps anyone else the solution is simply
analytics.set_property( “config-file”, “config_nvdsanalytics.txt”)

Is there an update on this?
This may make me switch to the c++ api

Pls refer Deepstream 5.0 python bindings for Gst-nvdsanalytics access meta data

1 Like