How to get NvDsFrameMeta* after nvstreamdemux

Please provide complete information as applicable to your setup.

• Hardware Platform (Jetson / GPU) AGX
• DeepStream Version 5.0

The title explains my question, pretty well, but here are the details:
In my pipeline I use nvstreammux, which adds NvDsBatchMeta to the buffers. In one of the probe callback I also add “user metadatas” to the frames, using the nvds_add_user_meta_to_frame api function. Even later I have a nvstreamdemux element. I need to access my user metadata after that element. How to do it properly?

The following page does not mention, what is the type of the metadata after nvstreamdemux: Gst-nvstreamdemux — DeepStream 6.0 Release documentation It only tells, that the “related” metadata to source n is attached. I would expect it to be NvDsFrameMeta. However I cannot find it anywhere how to get it.

I only found the following function: gst_buffer_get_nvds_meta. This function returns NvDsMeta*. I could not find any information or examples about how to convert it to NvDsFrameMeta, or how to extract user meta from it. Any guideline is appretiated!

NvDsFrameMeta is a part of NvDSBatchMeta. Please get it from NvDSBatchMeta. NvDSBatchMeta can be available by gst_buffer_get_nvds_batch_meta(). Almost every deepstream sample codes show the usage of gst_buffer_get_nvds_batch_meta().

https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_plugin_metadata.html#nvdsbatchmeta-basic-metadata-structure

Please get refer codes from /opt/nvidia/deepstream/deepstream/sources

Hi Fiona, thank you for your reply.

I am aware of the NvDsBatchMeta, and how to get NvDsFrameMeta from it, I did it several times. But you have NvDsBatchMeta only between nvstreammux (which creates/attaches it), and nvstreamdemux (which breaks it down). According to the page I linked above, after nvstreamdemux you do not have NvDsBatchMeta anymore, which makes sense, since you do not have batches anymore, the individual frames are processed on separate branches, not in batches anymore, that is the purpose of nvstreamdemux.

Yes, but for the above reason they are useless for me, because they all invoke it before nvstreamdemux. On the other hand, I could not find any samples about how to get the user metadata after nvstreamdemux, when the frames are not in batches anymore.

So let me rephase my question: I have a pipeline, with multiple source streams. I mux them with nvstreammux. After that, I get the NvDsBatchMeta and from it I also get NvDsFrameMetas, as you also recommended. I modify NvDsFrameMetas, and I also attach my NvDsUserMetas for it, as I already mentioned in my opening post. So far everything is so good.
Then later I demux my batched stream nvstreamdemux. After that point I’m lost, however the page I linked (in my opening post) states that “all meta related to source N” is placed in the output N, it does not mention, how can I get it, what’s the C type of it (I assume NvDsFrameMeta, but I’m not sure), I do not know how to recover the NvDsUserMeta, that’s why I’m here.
Thanks for your help in advance.

After nvstreamdemux, NvDsBatchMeta is attached to Gst Buffer corresponding to each source. as mentioned by Fiona, just access the meta data as mentioned by Fiona.

Yup, I figured it out too. The documentation is misleading (there is a place for improvement there), but there is definitely an NvDsBatchMeta attached to the buffers living the separate src pads of nvdsstreamdemux.
Anyone needs help about it in the future, you can check the the source code of the nvdsosd element (it comes with deepstream), (this element is supposed to be used after nvdsstreamdemux (or tiler)), so you can see there, how to get the meta.

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