DS 4.0 for Nano: No example for creating metadata for first plugin immediately after source.

I am writing a plugin that follows immediately after the source.

I want to send NvDsFrameMeta/NvDsObjectMeta downstream.

The examples use NvDsBatchMeta retrieved from the input GstBuffer
either using
to get NvDsFrameMeta objects from a pool.

But since this is the first non-source plugin in the pipeline,
the input GstBuffer does not have NvDsBatchMeta, so gst_buffer_get_nvds_batch_meta
and gst_buffer_get_nvds_batch_meta does not give me any NvDsBatchMeta

How do I inject NvDsBatchMeta/NvDsFrameMeta/NvDsObjectMeta into
the pipeline that is compatible with plugins like nvdsosd.

Hi frederickkl77n1,

We need to know the exact pipeline that you’re trying.
It seems that you have frame/obj level info generated before nvstreammux. However, batch meta is formed inside nvstreammux as batch creation takes place inside this component.
So, you can use dsexample tailored for it’s use case after nvstreammux and can acquire batch meta and fill in and attach frame or object meta.


We have this working in DS 1.5 TX2

uridecodebin ! plugin1 | nvtracker | plugin2 | nvosd | …

plugin1 sends metadata to plugin2 that is also compatible with
nvtracker and nvosd

We want to do something as close to this as possible
in Nano using DS 4.0.

You are suggesting something like this:

uridecodebin ! nvstreammux ! plugin1 | nvtracker | plugin2 | nvosd | …

Is there a way for plugin1 itself to inject metadata that is
compatible with nvtracker and nvosd?

Hi frederickkl77n1,

Deepstream-4.0 has new metadata design. This simplifies the overall metadata access compared to earlier Deepstream versions.
It has hierarchical structure where batch meta consists of framemeta, framemeta consists of object meta.

In Deepstream-4.0, nvstreammux is always required as it is going to create the batchmeta. Once this meta is created the remaining plugins will acquire framemeta, object meta from the respective metadata pool.
So, yes, user need to create following pipeline.
uridecodebin ! nvstreammux ! plugin1 | nvtracker | plugin2 | nvosd | …

In this pipeline plugin1 will acquire framemeta from batchmeta (provided API nvds_acquire_frame_meta_from_pool).
Then user can fill in the frame metadata and add it back to batchmeta.