Luma -> Alpha with v1.18
Nicolas Dufresne
nicolas at ndufresne.ca
Fri Jan 7 13:10:29 UTC 2022
Le jeudi 06 janvier 2022 à 16:21 -0800, amindfv at mailbox.org a écrit :
> On Thu, Jan 06, 2022 at 11:30:25AM -0500, Nicolas Dufresne wrote:
> > Le mercredi 05 janvier 2022 à 14:19 -0800, amindfv--- via gstreamer-devel a
> > écrit :
> > > I'm looking for a way to use the luma plane of one video as the alpha plane of another.
> > >
> > > It appears the "alphacombine" element (https://gstreamer.freedesktop.org/documentation/codecalpha/alphacombine.html?gi-language=c) can do this, but it's too new even for the unstable release of GStreamer, and for a variety of reasons I'm stuck on the latest stable (1.18).
> > >
> > > What I'm trying to do is also possible in ffmpeg with "extractplanes=y" + "alphamerge".
> > >
> > > I'd welcome any way to do this, no matter how much of a hack. Big pipeline? Fine. Somehow using GPU/shaders? No prob.
> >
> > Perhaps you can copy and build the codecalpha plugin into your project ? Note
> > that alphacombine is a "simple" implementation, not suitable for every use
> > cases, as it does not synchronize the inputs (this is to avoid adding large
> > threading overhead introduce by the sycnhronization).
> >
>
> When you say it doesn't perform synchronization, that wouldn't prevent me from doing precise synchronization elsewhere, right?
It will expect the exact same number of color and alpha frames. So if you have
the same framerate and a reliable source of frames, it should stay aligned
forever. Optionally, it also supports gap even for alpha, since this is allowed
by WebM Alpha specification. But you cannot have an alpha frame without a color
frame.
>
> In other words, I can be sure that frame number N of stream #1 is paired with frame number N of stream #2 (assuming identical frame rates), it's just that alphacombine won't be the element doing that synchronization? Or are there cases where I can't be sure the frames don't get out of sync?
>
> > All it does is take two I420 buffers, append then and declare this as A420
> > (updating the GstVideoMeta).
>
> That's actually perfect for my needs, I think (hope!).
>
> Tom
More information about the gstreamer-devel
mailing list