Gstreamer Alpha channel on black

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Gstreamer Alpha channel on black

Andrew Silby-2

Hi, I’m trying to produce a video stream which is transparent if the image is black. I have a video feed which produces a black feed if there is no input from a video capture device. I would like to overlay this onto another video stream but not show the image if it is black.

 

I thought I would be able to do this by using the alpha plugin on the black video source specifying:

 

alpha method=custom target-r=0 target-g=0 target-b=0

 

but this doesn’t work.

 

The closest I can get is:

alpha method=custom target-r=0 target-b=0 target-g=0 black-sensitivity=128 white-sensitivity=0

 

This will make the black areas transparent but also anything slightly dark transparent as well. I really just want the black areas to be transparent

 

Any help greatly appreciated.

 

Thanks,

Andy


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer Alpha channel on black

Sebastian Dröge-3
On Mon, 2016-10-10 at 20:36 +0100, Andrew Silby wrote:

> Hi, I’m trying to produce a video stream which is transparent if the
> image is black. I have a video feed which produces a black feed if
> there is no input from a video capture device. I would like to
> overlay this onto another video stream but not show the image if it
> is black.
>  
> I thought I would be able to do this by using the alpha plugin on the
> black video source specifying:
>  
> alpha method=custom target-r=0 target-g=0 target-b=0
>  
> but this doesn’t work.
>  
> The closest I can get is:
> alpha method=custom target-r=0 target-b=0 target-g=0 black-
> sensitivity=128 white-sensitivity=0
>  
> This will make the black areas transparent but also anything slightly
> dark transparent as well. I really just want the black areas to be
> transparent
>  
> Any help greatly appreciated.
Please file a bug about this here
  https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer

The problem is most likely here that alpha is using the hue for color-
keying, which does not work for "colorless" values between white and
black.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (985 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer Alpha channel on black

Andrew Silby
Thanks Sebastian,

I'll file a bug about it.

In the meantime, is there any other way that I can mix the 2 video streams pip but not display the overlaid stream if black? Is alpha the best way of doing it?

Thanks very much for all your help and time.

Andrew
Reply | Threaded
Open this post in threaded view
|

Re: Gstreamer Alpha channel on black

Sebastian Dröge-3
On Mon, 2016-10-17 at 05:35 -0700, Andrew Silby wrote:
> Thanks Sebastian, 
>
> I'll file a bug about it.
>
> In the meantime, is there any other way that I can mix the 2 video streams
> pip but not display the overlaid stream if black? Is alpha the best way of
> doing it?

You could also detect the brightness of the stream somewhere, and based
on that disable the stream on the compositor element or whatever you're
using for mixing.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (949 bytes) Download Attachment