Using videomixer and alpha channel

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

Using videomixer and alpha channel

Eric Trousset

Hi,

 

I am using, videomixer to mixer to streams, but it seems the alpha channel is not used for the mixing, eg, part of the image with a 0 alpha aren’t transparent…

 

Is there a way to enable alpha transparency in the video mixer?

 

Also, I am using imagefreeze to display a still image. Is there a way to make this element to ask the source for a new image at some point?

 

Cheers,

Eric TROUSSET.


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

Re: Using videomixer and alpha channel

Sebastian Dröge-3
On Mi, 2013-11-20 at 12:10 +0100, Eric Trousset wrote:
> Hi,
>
> I am using, videomixer to mixer to streams, but it seems the alpha channel is not used for the mixing, eg, part of the image with a 0 alpha aren't transparent...
>
> Is there a way to enable alpha transparency in the video mixer?

Are you making sure that the video input to videomixer is still having
the alpha channel, i.e. there's no videoconvert element in front of it
that converts it to something without alpha channel?

The blending code in videomixer should use the alpha channel already.

> Also, I am using imagefreeze to display a still image. Is there a way to make this element to ask the source for a new image at some point?

There isn't, but it could be implemented with some custom event. Or
maybe all this should just handle the request-keyunit event. Nothing is
implemented yet for that.

--
Sebastian Dröge <[hidden email]>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

RE: Using videomixer and alpha channel

Eric Trousset


> -----Original Message-----
> From: Sebastian Dröge [mailto:[hidden email]]
> Sent: vendredi 22 novembre 2013 20:52
> To: Discussion of the development of and with GStreamer
> Subject: Re: Using videomixer and alpha channel
>
> On Mi, 2013-11-20 at 12:10 +0100, Eric Trousset wrote:
> > Hi,
> >
> > I am using, videomixer to mixer to streams, but it seems the alpha channel
> is not used for the mixing, eg, part of the image with a 0 alpha aren't
> transparent...
> >
> > Is there a way to enable alpha transparency in the video mixer?

>
> Are you making sure that the video input to videomixer is still having the
> alpha channel, i.e. there's no videoconvert element in front of it that
> converts it to something without alpha channel?
>
> The blending code in videomixer should use the alpha channel already.

Yes I had a videoconvert element. So I removed it but still, it seems the pixel alpha is not taken into account. I can see the checker background only if I set the pad's "alpha" property to some value.

>
> > Also, I am using imagefreeze to display a still image. Is there a way to make
> this element to ask the source for a new image at some point?
>
> There isn't, but it could be implemented with some custom event. Or maybe
> all this should just handle the request-keyunit event. Nothing is
> implemented yet for that.


That would be a great feature :)


>
> --
> Sebastian Dröge <[hidden email]> Centricular Ltd -
> http://www.centricular.com Expertise, Straight from the Source
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using videomixer and alpha channel

Lautaro Woites
Hi Eric,
             I had the same problem on gst 0.10. My pipeline had a videomixer with 2 inputs (an mkv file and a png with alpha).
My solution was to fix all the mixer's input caps to  "video/x-raw-rgb, alpha=255".





2013/11/25 Eric Trousset <[hidden email]>


> -----Original Message-----
> From: Sebastian Dröge [mailto:[hidden email]]
> Sent: vendredi 22 novembre 2013 20:52
> To: Discussion of the development of and with GStreamer
> Subject: Re: Using videomixer and alpha channel
>
> On Mi, 2013-11-20 at 12:10 +0100, Eric Trousset wrote:
> > Hi,
> >
> > I am using, videomixer to mixer to streams, but it seems the alpha channel
> is not used for the mixing, eg, part of the image with a 0 alpha aren't
> transparent...
> >
> > Is there a way to enable alpha transparency in the video mixer?

>
> Are you making sure that the video input to videomixer is still having the
> alpha channel, i.e. there's no videoconvert element in front of it that
> converts it to something without alpha channel?
>
> The blending code in videomixer should use the alpha channel already.

Yes I had a videoconvert element. So I removed it but still, it seems the pixel alpha is not taken into account. I can see the checker background only if I set the pad's "alpha" property to some value.

>
> > Also, I am using imagefreeze to display a still image. Is there a way to make
> this element to ask the source for a new image at some point?
>
> There isn't, but it could be implemented with some custom event. Or maybe
> all this should just handle the request-keyunit event. Nothing is
> implemented yet for that.


That would be a great feature :)


>
> --
> Sebastian Dröge <[hidden email]> Centricular Ltd -
> http://www.centricular.com Expertise, Straight from the Source
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


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

Re: Using videomixer and alpha channel

Sebastian Dröge-3
On Di, 2013-11-26 at 13:19 -0200, Lautaro Woites wrote:
> Hi Eric,
>              I had the same problem on gst 0.10. My pipeline had a
> videomixer with 2 inputs (an mkv file and a png with alpha).
> My solution was to fix all the mixer's input caps to  "video/x-raw-rgb,
> alpha=255".

That's only accidentially working for you and is the problem I mentioned
first. A converter dropping the alpha channel before videomixer. What
you tell it there is to create a RGB stream with alpha in the first byte
of each pixel.

--
Sebastian Dröge <[hidden email]>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: Using videomixer and alpha channel

Sebastian Dröge-3
In reply to this post by Eric Trousset
On Mo, 2013-11-25 at 10:26 +0100, Eric Trousset wrote:

> > Are you making sure that the video input to videomixer is still having the
> > alpha channel, i.e. there's no videoconvert element in front of it that
> > converts it to something without alpha channel?
> >
> > The blending code in videomixer should use the alpha channel already.
>
> Yes I had a videoconvert element. So I removed it but still, it seems
> the pixel alpha is not taken into account. I can see the checker
> background only if I set the pad's "alpha" property to some value.

That's weird and sounds like a bug. The blending operation done by
videomixer for ARGB/AYUV currently is
destination = source*alpha + destination*(1-alpha)
where alpha is the alpha property of the pad multiplied with the alpha
channel of source at the current position.

Should get a bug report I guess.

> > > Also, I am using imagefreeze to display a still image. Is there a way to make
> > this element to ask the source for a new image at some point?
> >
> > There isn't, but it could be implemented with some custom event. Or maybe
> > all this should just handle the request-keyunit event. Nothing is
> > implemented yet for that.
>
>
> That would be a great feature :)

Could you file a feature request at http://bugzilla.gnome.org against
GStreamer for that so it doesn't get lost?

--
Sebastian Dröge <[hidden email]>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: Using videomixer and alpha channel

Nicolas Dufresne-3
Le mercredi 27 novembre 2013 à 09:43 +0100, Sebastian Dröge a écrit :
Should get a bug report I guess.

Note that in current state, videomixer will color convert to the output format before blending. You need to make sure you vieomixer output format has alpha channel, otherwise you'll loose that information. Whether that is a bug, maybe, fixing it would mean that videomixer would do colortransform again at the output, it's probably better to simply add a converter after, but maybe fail the pipeline ?

Nicolas

p.s. I mean: source* -> videomixer ! videoconvert ! videosink
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Using videomixer and alpha channel

Eric Trousset

Merci !!!

 

Setting the output format of the mixer to ARGB format fixed my issue with the alpha blending !

 

Should I file this as a bug? Or maybe a line should be added to the documentation?

 

Cheers,

Eric

 

From: Nicolas Dufresne [mailto:[hidden email]]
Sent: mercredi 27 novembre 2013 15:10
To: Discussion of the development of and with GStreamer
Subject: Re: Using videomixer and alpha channel

 

Le mercredi 27 novembre 2013 à 09:43 +0100, Sebastian Dröge a écrit :

Should get a bug report I guess.


Note that in current state, videomixer will color convert to the output format before blending. You need to make sure you vieomixer output format has alpha channel, otherwise you'll loose that information. Whether that is a bug, maybe, fixing it would mean that videomixer would do colortransform again at the output, it's probably better to simply add a converter after, but maybe fail the pipeline ?

Nicolas

p.s. I mean: source* -> videomixer ! videoconvert ! videosink


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

Re: Using videomixer and alpha channel

Sebastian Dröge-3
On Mi, 2013-11-27 at 15:23 +0100, Eric Trousset wrote:
> Merci !!!
>
> Setting the output format of the mixer to ARGB format fixed my issue with the alpha blending !
>
> Should I file this as a bug? Or maybe a line should be added to the documentation?

Did you have to add a videoconvert element too, or just a capsfilter to
force ARGB output? videomixer tries to use an alpha format if any of
inputs is having an alpha channel... so if you just added the capsfilter
and changed nothing else this would be a bug.

--
Sebastian Dröge <[hidden email]>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

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

Re: Using videomixer and alpha channel

Nicolas Dufresne-3
In reply to this post by Eric Trousset
Le mercredi 27 novembre 2013 à 15:23 +0100, Eric Trousset a écrit :
Should I file this as a bug? Or maybe a line should be added to the documentation?

For everyone interest, we decided to produce an error if we are going to loose an alpha channel. Adding a videoconvert after mixer being the solution to this error.

Nicolas


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

RE: Using videomixer and alpha channel

Eric Trousset
In reply to this post by Sebastian Dröge-3


> -----Original Message-----
> From: Sebastian Dröge [mailto:[hidden email]]
> Sent: mercredi 27 novembre 2013 15:47
> To: Discussion of the development of and with GStreamer
> Subject: Re: Using videomixer and alpha channel
>
> On Mi, 2013-11-27 at 15:23 +0100, Eric Trousset wrote:
> > Merci !!!
> >
> > Setting the output format of the mixer to ARGB format fixed my issue with
> the alpha blending !
> >
> > Should I file this as a bug? Or maybe a line should be added to the
> documentation?
>
> Did you have to add a videoconvert element too, or just a capsfilter to force
> ARGB output? videomixer tries to use an alpha format if any of inputs is
> having an alpha channel... so if you just added the capsfilter and changed
> nothing else this would be a bug.

I had the videomixer directly linked to the autovideosink.
I fixed the issue by adding a videoconvert that I linked using gst_element_link_filtered with a caps "video/x-raw, format=(string)ARGB" (videomixer->filteredlink->videoconvert->videosink)
Maybe I could have linked the videomixer to the videosink directly using filtered link?

Eric T.

>
> --
> Sebastian Dröge <[hidden email]> Centricular Ltd -
> http://www.centricular.com Expertise, Straight from the Source
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Using videomixer and alpha channel

Nicolas Dufresne-3
Le mercredi 27 novembre 2013 à 16:45 +0100, Eric Trousset a écrit :
Maybe I could have linked the videomixer to the videosink directly using filtered link?
Actually you need the videoconvert before the sink, but you can remove the caps filter, videomixer will negotiate the best format for you. The thing is that very often is faster to operate in format like AYUV then ARGB, but it all depends on the input.

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

Re: Using videomixer and alpha channel

Sebastian Dröge-3
In reply to this post by Nicolas Dufresne-3
On Mi, 2013-11-27 at 10:36 -0500, Nicolas Dufresne wrote:
> Le mercredi 27 novembre 2013 à 15:23 +0100, Eric Trousset a écrit :
>
> > Should I file this as a bug? Or maybe a line should be added to the
> > documentation?
>
>
> For everyone interest, we decided to produce an error if we are going to
> loose an alpha channel. Adding a videoconvert after mixer being the
> solution to this error.

For reference:
https://bugzilla.gnome.org/show_bug.cgi?id=719431

Will also be in the 1.2.2 release.

--
Sebastian Dröge <[hidden email]>
Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (985 bytes) Download Attachment