I was wondering how can I properly use the gst_buffer_add_nvds_meta with python. I saw this related post:
but i don’t think there is a solution yet. I’m creating a custom gstream plugin with python and i need to copy the NvDsBatchMeta from the input buffer to the output buffer.
Here is how i’m currently trying to copy the NvDsBatchMeta to the output buffer:
TypeError: gst_buffer_add_nvds_meta(): incompatible function arguments. The following argument types are supported:
1. (buffer: _GstBuffer, meta_data: capsule, user_data: capsule, copy_func: void* (void*, void*), release_func: void (void*, void*)) -> _NvDsMeta
Invoked with: <Gst.Buffer object at 0x739b93d35760 (GstBuffer at 0x739b0802b000)>, <pyds.NvDsBatchMeta object at 0x739b93d3dd70>, None, c_void_p(1414320), c_void_p(1414325)
So my question is how can I properly invoke the gst_buffer_add_nvds_meta with python or if there is any alternative approach on how can i copy the NvDsMeta from the input buffer to the output buffer.
Hi,
Thanks for the reply! I’m trying to override the do_transform function from the GstBase.BaseTransform class to create a custom plugin. where would your code fit in the do_transform function and where would i get the gst_meta and nvdsmeta-quark parameters? Also i could not find the GstMetaTransformCopy in python nor tre transform_func
On Python you can implement something like this to just copy the metadata from inbuf
def do_transform(self, inbuf, outbuf):
# Get the size of the input buffer
size = inbuf.get_size()
# Copy all metadata from the input buffer to the output buffer
inbuf.copy_into(outbuf, Gst.BufferCopyFlags.META, 0, size)
return Gst.FlowReturn.OK
This only copies the metadata, assuming that the outbuf has been properly allocated beforehand.
If that option doesn’t suit you and you prefer just the DeepStream meta, you can use the following equivalent functions instead:
Because the issue is that i need to get the image from the input buffer, change the image dimensions and add channels to it (basically reduce the width and height of the image and add an extra channel), and then fill the output buffer with the new image. But the issue is that i need to copy the metadata to the output buffer so that the rest of the elements of the pipeline can access the metadata. Otherwise the next element after the custom plugin will complain that the metadata is not present:
[gst-stream-error-quark: GstNvTiler: FATAL ERROR; NvDsMeta->NvDsBatchMeta missing in the input buffer (1)]
There is no update from you for a period, assuming this is not an issue anymore. Hence we are closing this topic. If need further support, please open a new one. Thanks