# Overlay in stream

**URL:** <https://openvidu.discourse.group/t/overlay-in-stream/158>\
**Category:** How to implement?\
**Tags:** v2\
**Created:** [February 19, 2020, 7:23am UTC](https://openvidu.discourse.group/t/overlay-in-stream/158 "2020-02-19T07:23:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![vivekkairi](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/vivekkairi/32/94_2.png) [@vivekkairi](https://openvidu.discourse.group/u/vivekkairi)\
**Post date:** [February 19, 2020, 7:23am UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/1 "2020-02-19T07:23:04Z")

</div>

So I’m making a one to many streaming website using OpenVidu and I want to give PUBLISHER option to add image overlay in the video means both image and video should be streamed to the SUBSCRIBERS. Any leads for that?

---

<div class="post-metadata">

**Author:** ![vivekkairi](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/vivekkairi/32/94_2.png) [@vivekkairi](https://openvidu.discourse.group/u/vivekkairi)\
**Post date:** [February 22, 2020, 1:53pm UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/2 "2020-02-22T13:53:40Z")

</div>

@pabloFuente Any help would be appreciated

---

<div class="post-metadata">

**Author:** ![pabloFuente](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/pablofuente/32/2536_2.png) [@pabloFuente](https://openvidu.discourse.group/u/pabloFuente)\
**Post date:** [February 22, 2020, 2:42pm UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/3 "2020-02-22T14:42:07Z")

</div>

Yes, this is possible by making use of OpenVidu Filters: [https://openvidu.io/docs/advanced-features/filters/](https://openvidu.io/docs/advanced-features/filters/)

It is not listed right now in OpenVidu [GStreamer filters](https://openvidu.io/docs/advanced-features/filters/#gstreamer-filters) just because we didn’t go through all of available GStreamer plugins, but there’s a very interesting one called **gdkpixbufoverlay**.

It allows you to precisely overlay an image file into a video stream. I’ve already tried it and it works great. Besides, it is listed under “plugins-good” list of Gstreamer (it has also a “plugins-bad” list that contains plugins that might be buggy), so it should work perfectly fine. Following the OpenVidu docs of Gstreamer filters, an example of gdkpixbufoverlay usage could be:

`gdkpixbufoverlay location=/images/my-image.png offset-x=10 offset-y=10 overlay-height=200 overlay-width=200`

The full method the Publisher should call is:

```auto
publisher.stream.applyFilter("GStreamerFilter", {
  "command": "gdkpixbufoverlay location=/images/my-image.png offset-x=10 offset-y=10 overlay-height=200 overlay-width=200"
});

```

Filters are applied on the server side, so Kurento process must have access to the image you set in `location` parameter. In the example, Kurento should have read access over file `/images/my-image.png`

I’ll add this cool Gstreamer filter to the list in OpenVidu documentation, as I think is something many people will find useful.

Regards

---

<div class="post-metadata">

**Author:** ![vivekkairi](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/vivekkairi/32/94_2.png) [@vivekkairi](https://openvidu.discourse.group/u/vivekkairi)\
**Post date:** [February 22, 2020, 3:33pm UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/4 "2020-02-22T15:33:11Z")

</div>

Thanks a lot 😄

---

<div class="post-metadata">

**Author:** ![vivekkairi](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/vivekkairi/32/94_2.png) [@vivekkairi](https://openvidu.discourse.group/u/vivekkairi)\
**Post date:** [March 8, 2020, 11:11am UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/5 "2020-03-08T11:11:24Z")

</div>

```
publisher.stream.applyFilter("GStreamerFilter", {
  "command": "gdkpixbufoverlay location=/tmp/qwe.jpeg"
});

```

Stream.ts:296 Applying filter to stream phw9gcritjkksbfl\_CAMERA\_YIWKS  
Promise {}  
Session.ts:935` Media error: {"error":"UNEXPECTED_PIPELINE_ERROR: Could not load overlay image. (gstgdkpixbufoverlay.c(508): gst_gdk_pixbuf_overlay_start (): /GstPipeline:pipeline16/KmsFilterElement:kmsfilterelement17/GstGdkPixbufOverlay:gdkpixbufoverlay15:\nFailed to open file '/tmp/qwe.jpeg': No such file or directory)(errCode=5)"}`

@pabloFuente /tmp/qwe.jpeg is having 777 permissions and the file is present in that location. Any leads on what could be the issue?

The Kurento server is running as root by the following command  
`docker run -p 4443:4443 --rm -e openvidu.secret=secret openvidu/openvidu-server-kms:2.11`

---

<div class="post-metadata">

**Author:** ![sabrimev](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/sabrimev/32/1066_2.png) [@sabrimev](https://openvidu.discourse.group/u/sabrimev)\
**Post date:** [November 25, 2020, 7:13am UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/6 "2020-11-25T07:13:39Z")

</div>

I am having the same issue 😕

---

<div class="post-metadata">

**Author:** ![micael.gallego](https://yyz2.discourse-cdn.com/free1/user_avatar/openvidu.discourse.group/micael.gallego/32/2_2.png) [@micael.gallego](https://openvidu.discourse.group/u/micael.gallego)\
**Post date:** [November 26, 2020, 5:16pm UTC](https://openvidu.discourse.group/t/overlay-in-stream/158/7 "2020-11-26T17:16:05Z")

</div>

The image has to be accessible from Kurento Media Server.

As KMS is dockerized, the best way is publishing the image in a web page.

Other way can be using a volume in Docker.

Finally, you can also create the image overlay in the browser instead of using a server filter.

Regards
