Reading and Modifying Buffers in a Pipeline

Sebastian Dröge sebastian at
Thu Nov 12 07:56:17 UTC 2020

On Thu, 2020-11-12 at 11:39 +0500, Hassan Muhammad wrote:
> Thank you for your prompt response. It has been really helpful. I
> have taken a look over the plugin writing tutorial that you have
> referenced and it seems to me that this may be the most appropriate
> solution to modifying buffers in a non-intrusive manner i.e. within
> an element between source and sink pads.

It would at least be the cleanest solution. You also don't have to
write a full plugin but can also do just an element as part of your

>  One thing I'd like to ask is, would mapping buffer read/writable and
> performing some operation on the buffer (i.e. like you did converting
> BGRx colorspace to GRAY8) impose any significant performance penalty
> on the pipeline when specifically rendering HD or FHD videos?Sorry if
> this seems like a silly question, I'm actually new to gstreamer and
> only starting to get the hang of how it works. Thanks again for your
> help.

Mapping a buffer writable might cause it to be copied if the buffer's
memory is also in use elsewhere. Apart from that, if you need to modify
the individual pixels then there's not much else you can do.

By using the overlaycomposition element this could potentially be more
efficient if the overlayed frames end up in an element (e.g. a sink)
that can handle the overlaying separately.

Sebastian Dröge, Centricular Ltd ·

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the gstreamer-devel mailing list