Send a modified frame collected by pyds.get_nvds_buf_surface downstream?

So currently in my pipeline (python) I am trying to implement some kind of blurring on the bounding boxes.
I have been able to get the frame using the following code in osd_sink_pad_buffer_probe

surface = pyds.get_nvds_buf_surface(hash(gst_buffer), frame_meta.batch_id)
frame = np.array(surface, copy=True, order='C')
frame = cv2.cvtColor(frame, cv2.COLOR_RGBA2BGRA) 

# some other modifications

But after modifying the frame, how can I add it back to the pipeline?
I’ve gone though the implementation in dsexample but it’s slightly confusing how the blur is being done and the buffer is being updated. I want to try to stick to the python implementation only so it would be great if there is a solution via python itself.

I’ve tried looking in the forums but can’t seem to find any examples for this.

Any help would be highly appreciated.

• Hardware Platform (Jetson)
• DeepStream Version (5.0)
• JetPack Version (4.4)


Hi @marmikshah
Sorry for delay!

You needs to add nvvideoconvert component after OSD to convert to BGRA and work on that.

Hi @mchi,
Thanks for your reply.
Sorry, I am a little confused here. Currently I’m already able to get the frame in osd_pad_probe function and I can even modify the frame. But the only problem is that those changes are not being shown when I view the recorded video.
It seems when I draw something on the frame, it’s not getting updated in the gst buffer.


Hi @marmikshah,
It’s expected because the opencv code actually operates on a new buffer, that is, the operation does not affect the buffer trasnferring in DS pipeline.


Hi @mchi,

I am facing the same issue. I understand the opencv code operates on a new buffer, but can I update the nvds_buf_surface with the modified frame and send that further downstream?