# Applying a mask over an image/video stream using GStreamer

**URL:** <https://discourse.gstreamer.org/t/applying-a-mask-over-an-image-video-stream-using-gstreamer/2205>\
**Category:** General Discussion\
**Created:** [August 20, 2024, 12:35pm UTC](https://discourse.gstreamer.org/t/applying-a-mask-over-an-image-video-stream-using-gstreamer/2205 "2024-08-20T12:35:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rz-Rz](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/rz-rz/32/690_2.png) [@Rz-Rz](https://discourse.gstreamer.org/u/Rz-Rz)\
**Post date:** [August 20, 2024, 12:35pm UTC](https://discourse.gstreamer.org/t/applying-a-mask-over-an-image-video-stream-using-gstreamer/2205/1 "2024-08-20T12:35:10Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Honey\_Patouceul](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/honey_patouceul/32/365_2.png) [@Honey\_Patouceul](https://discourse.gstreamer.org/u/Honey_Patouceul)\
**Post date:** [August 20, 2024, 12:51pm UTC](https://discourse.gstreamer.org/t/applying-a-mask-over-an-image-video-stream-using-gstreamer/2205/2 "2024-08-20T12:51:27Z")

</div>

You may have a look to this topic: [Pipeline with multiple video streams overlayed and alpha masked](https://discourse.gstreamer.org/t/pipeline-with-multiple-video-streams-overlayed-and-alpha-masked/2130/1).

For a simple case you may alternately try element `gdkpixbufoverlay`:

```auto
# 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

```

---

<div class="post-metadata">

**Author:** ![Rz-Rz](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/rz-rz/32/690_2.png) [@Rz-Rz](https://discourse.gstreamer.org/u/Rz-Rz)\
**Post date:** [August 27, 2024, 12:28pm UTC](https://discourse.gstreamer.org/t/applying-a-mask-over-an-image-video-stream-using-gstreamer/2205/3 "2024-08-27T12:28:17Z")

</div>

Thank you for this, solved my problem
