GStreamer transparency

Hey y’all I am trying to stream either transparent webm or transparent gif (can use other file types as well it is not important which), but I came to problem with starting webm matroskademuxer adds black background, in gif using avdemux_gif adds white background… Is there any way at all to transport a video or gif from filesrc to udpsink to udpsrc to d3dvideosink without losing transparency.

I am using windows

I tried to stream video over udp with transparency:

We are missing support to WebM alpha encoding and muxing. Remember that alpha support is done by adding an extra monochrome stream. This how WebM alpha works, but also (unsupported in GStreamer) H.264 and HEVC works. With this in mind, you certainly do a custom streaming solution, by adding a video filter that splits the alpha channel into its own stream. We have filters to combine these later if your decoders can do planar yuv.

1 Like

I have tried to do it a bit differently so I have done:

gst-launch-1.0 filesrc location=tiger.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! alpha method=green ! pngenc ! multifilesink location="frame-%05d.png"

I removed green screen and added it to .png files than I played those png files:

gst-launch-1.0 -v multifilesrc location=frame-%05d.png index=0 stop-index=50 loop=true ! pngdec ! videoconvert ! videorate ! video/x-raw,framerate=30/1 ! videoconvert ! d3dvideosink

This works fine, but uses too much resources so I thought of combining those two:

gst-launch-1.0 filesrc location=tiger.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! videorate ! alpha method=green ! d3dvideosink

Now this has a black background

I have also tried to use: codecalpha, but it does not work at all.

I don’t personally know if d3dvideosink support transparent windows. With glimagesink, you have to set ignore-alpha property to false, and must use wayland (no X11), should work on windows.

1 Like