Discussion:
Gstreamer Alpha channel on black
Andrew Silby
2016-10-10 19:36:00 UTC
Permalink
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
Sebastian Dröge
2016-10-13 08:17:16 UTC
Permalink
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
 
alpha method=custom target-r=0 target-g=0 target-b=0
 
but this doesn’t work.
 
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
Andrew Silby
2016-10-17 12:35:10 UTC
Permalink
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



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Gstreamer-Alpha-channel-on-black-tp4680016p4680083.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
Sebastian Dröge
2016-10-18 10:20:51 UTC
Permalink
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
Loading...