Applying a mask over an image/video stream using GStreamer

I’m trying to apply a mask in GStreamer but I can’t find much documentation on this specific use case. The idea is that I have a mask file and I want to apply it on an image/stream. I believe I could use the videomixer but I’m not sure if that’s the right way to do it. I am using GStreamer in C++. Also I heard of compositor plugin not sure if it can be useful.

You may have a look to this topic: Pipeline with multiple video streams overlayed and alpha masked.

For a simple case you may alternately try element gdkpixbufoverlay:

# Assuming your mask is in png/alpha format and has size 640x480
gst-launch-1.0 videotestsrc ! video/x-raw,width=640,height=480 ! gdkpixbufoverlay location=mask.png ! videoconvert ! xvimagesink

Thank you for this, solved my problem