# Pipeline with multiple video streams overlayed and alpha masked

**URL:** <https://discourse.gstreamer.org/t/pipeline-with-multiple-video-streams-overlayed-and-alpha-masked/2130>\
**Category:** Newcomers\
**Created:** [August 7, 2024, 11:41am UTC](https://discourse.gstreamer.org/t/pipeline-with-multiple-video-streams-overlayed-and-alpha-masked/2130 "2024-08-07T11:41:43Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![ti-guru](https://discourse.gstreamer.org/user_avatar/discourse.gstreamer.org/ti-guru/32/766_2.png) [@ti-guru](https://discourse.gstreamer.org/u/ti-guru)\
**Post date:** [August 7, 2024, 11:41am UTC](https://discourse.gstreamer.org/t/pipeline-with-multiple-video-streams-overlayed-and-alpha-masked/2130/1 "2024-08-07T11:41:43Z")

</div>

Hi,

I’m trying to build a pipeline in gstreamer that overlays multiple video streams from v4l2src and udpsrc+rtpvrawdepay on a background image where one of the streams is alpha masked with an image. Digging through the documentation and Stack Overflow didn’t show any (obvious) plugins or examples that describe this case. E.g. the [alpha](https://gstreamer.freedesktop.org/documentation/alpha/index.html?gi-language=c) plugin does chroma keying, but I’d like to use a png image to define the regions being masked in the stream.

In ffmpeg I would use a complex filter to overlay video streams onto a background image with [alphaextract](https://ffmpeg.org/ffmpeg-filters.html#alphaextract) and alphamerge to mask one of the stream:

```auto
ffmpeg -i input1.mp4 -i input2.mp4 -i background.png -i mask.png -filter_complex "[0:v]scale=640:480:force_original_aspect_ratio=decrease[camera];[3]alphaextract[mask];[1][mask]alphamerge[crop];[crop]scale=1800:1012:force_original_aspect_ratio=decrease[stream];[2][camera]overlay=40:300[canvas];[canvas][stream]overlay=650:100" output.mp4

```

Any help pointing me in the right direction would be much appreciated!

---

_[View the full topic](https://discourse.gstreamer.org/t/pipeline-with-multiple-video-streams-overlayed-and-alpha-masked/2130)._
