Gst-nvmsgconv
The Gst-nvmsgconv plugin parses NVDS_EVENT_MSG_META (NvDsEventMsgMeta) type metadata attached to the buffer as user metadata of frame meta and generates the schema payload. For the batched buffer, metadata of all objects of a frame must be under the corresponding frame meta.
The generated payload (NvDsPayload) is attached back to the input buffer as NVDS_PAYLOAD_META type user metadata.
DeepStream 4.0.1 supports two variations of the schema, full and minimal. The Gst-nvmsgconv plugin can be configured to use either one of the schemas.
By default, the plugin uses the full DeepStream schema to generate the payload in JSON format. The full schema supports elaborate semantics for object detection, analytics modules, events, location, and sensor. Each payload has information about a single object.
You can use the minimal variation of the schema to communicate minimal information with the back end. This provides a small footprint for the payload to be transmitted from DeepStream to a message broker. Each payload can have information for multiple objects in the frame.
Inputs and Outputs
• Inputs
• Gst Buffer with NvDsEventMsgMeta
• Control parameters
• config
• msg2p-lib
• payload-type
• comp-id
• Output
• Same Gst Buffer with additional NvDsPayload metadata. This metadata contains information about the payload generated by the plugin.
Features
The following table summarizes the features of the plugin.
Features of the Gst-nvmsgconv plugin |
Feature | Description | Release |
Payload in JSON format | Message payload is generated in JSON format | DS 3.0 |
Supports DeepStream schema specification | DeepStream schema spec implementation for messages | DS 3.0 |
Custom schema specification | Provision for custom schemas for messages | DS 3.0 |
Key-value file parsing for static properties | Read static properties of sensor/place/module in the form of key-value pair from a text file | DS 3.0 |
CSV file parsing for static properties | Read static properties of sensor/place/module from a CSV file | DS 3.0 |
DeepStream 4.0.1 minimalistic schema | Minimal variation of the DeepStream message schema | DS 4.0 |
Gst Properties
The following table describes the Gst-nvmsgconv plugin’s Gst properties.
Gst-nvmsgconv plugin, Gst properties |
Property | Meaning | Type and Range | Example Notes | Platforms |
config | Absolute pathname of a configuration file that defines static properties of various sensors, places, and modules. | String | config=msgconv_config.txt or config=msgconv_config.csv | dGPU Jetson |
msg2p-lib | Absolute pathname of the library containing a custom implementation of the nvds_msg2p_* interface for custom payload generation. | String | msg2p-lib=libnvds_msgconv_custom.so | dGPU Jetson |
payload-type | Type of schema payload to be generated. Possible values are: PAYLOAD_DEEPSTREAM: Payload using DeepStream schema. PAYLOAD_DEEPSTREAM_MINIMAL: Payload using minimal DeepStream schema. PAYLOAD_CUSTOM: Payload using custom schemas. | Integer, 0 to 4,294,967,295 | payload-type=0 or payload-type=257 | dGPU Jetson |
comp-id | Component ID of the plugin from which metadata is to be processed. | Integer, 0 to 4,294,967,295 | comp-id=2 Default is NvDsEventMsgMeta | dGPU Jetson |
Schema Customization
This plugin can be used to implement a custom schema in two ways:
• By modifying the payload generator library: To perform a simple customization of DeepStream schema fields, modify the low level payload generation library file sources/libs/nvmsgconv/nvmsgconv.cpp.
• By implementing the nvds_msg2p interface: If a library that implements the custom schema needs to be integrated with the DeepStream SDK, wrap the library in the nvds_msg2p interface and set the plugin’s msg2p-lib property to the library’s name. Set the payload-type property to PAYLOAD_CUSTOM.
See sources/libs/nvmsgconv/nvmsgconv.cpp for an example implementation of the nvds_msg2p interface.
Payload with Custom Objects
You can add a group of custom objects to the NvDsEventMsgMeta structure in the extMsg field and specify their size in the extMsgSize field. The meta copy (copy_func) and free (release_func) functions must handle the custom fields accordingly.
The payload generator library handles some standard types of objects (Vehicle, Person, Face, etc.) and generates the payload according to the schema selected. To handle custom object types, you must modify the payload generator library nvmsgconv.cpp.
See deepstream-test4 for details about adding custom objects as NVDS_EVENT_MSG_META user metadata with buffers for generating a custom payload to send to back end.