Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebM with alpha showing black background instead of transparent. #43736

Closed
reyjakai opened this issue Nov 21, 2020 · 9 comments
Closed

WebM with alpha showing black background instead of transparent. #43736

reyjakai opened this issue Nov 21, 2020 · 9 comments

Comments

@reyjakai
Copy link

Godot version:
v3.2.3.stable.official

OS/device including version:
GLES3

Issue description:
Playing a .webm file that was encoded with an alpha channel has a black background in godot. This is how I'm planning on doing all attack and battle animations, and it's much cheaper on memory than using a .png spritesheet.

Steps to reproduce:

  1. Create a VideoPlayer node.
  2. Add a .webm file to the VideoPlayer node.

Minimal reproduction project:
WebM Alpha.zip

@Calinou
Copy link
Member

Calinou commented Nov 21, 2020

I don't think support for transparent WebM was ever implemented. Not that our current WebM playback support is too reliable anyway: https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+webm+label%3Abug

The goal is to eventually move video support out of core and into a FFmpeg-based plugin. Video playback is hard.

@Calinou
Copy link
Member

Calinou commented Nov 22, 2020

Closing in favor of godotengine/godot-proposals#1070, as feature proposals are now tracked in the Godot proposals repository.

@Yesyoor
Copy link

Yesyoor commented Dec 1, 2020

Hey is it possible for this to get solved in the next two months? I need this feature for a recent project.
I was able to load webm files and play them - only if they were converted to webm v.8 first - but the transparent parts turn out black, not transparent. I need those transparent videos to animate materials. A mask would also be fine though.

Another good work around I thought of would be to use animated textures, splitting the video into separate png files first, preserving the transparent parts. But assigning all those hundreds of textures frame by frame is not really a serious option. Even worse, after every assignment Godot needs time to reimport that png (idk why tbh). Is it possible to load multiple png files as frames for an animated texture at once?

@Calinou
Copy link
Member

Calinou commented Dec 1, 2020

Hey is it possible for this to get solved in the next two months? I need this feature for a recent project.

Nobody really knows how to implement this, unfortunately.

If you only need materials with additive blending, you can already have a transparent video displaying this way (since that's how additive blending works). Black will appear to be fully transprent.

Alternatively, you can use a chroma keying shader on a CanvasItemMaterial or SpatialMaterial.

@Yesyoor
Copy link

Yesyoor commented Dec 13, 2020

Hey is it possible for this to get solved in the next two months? I need this feature for a recent project.

Nobody really knows how to implement this, unfortunately.

If you only need materials with additive blending, you can already have a transparent video displaying this way (since that's how additive blending works). Black will appear to be fully transprent.

Alternatively, you can use a chroma keying shader on a CanvasItemMaterial or SpatialMaterial.

Yes, thanks a lot for the hint to use a shader. That worked fine. Now I just need a better video editing software to create masks and cut out greenscreen stuff. :)

@Calinou
Copy link
Member

Calinou commented Dec 13, 2020

Now I just need a better video editing software to create masks and cut out greenscreen stuff. :)

I think Olive has chroma keying features, even in its current stable version (0.1, not the 0.2 rewrite).

@Yesyoor
Copy link

Yesyoor commented Dec 16, 2020

Now I just need a better video editing software to create masks and cut out greenscreen stuff. :)

I think Olive has chroma keying features, even in its current stable version (0.1, not the 0.2 rewrite).

Hey thanks for the hint, I checked it out already.
Unfortunately the problem seems to be the video encoding process itself. My source video is mov and I can t convert it to webm without losses, so I always get borders around my mask. these are pixels that used to be transparent and most players can t handle it, including Godot and most video players.
I don t know why Godot has to use such a video format and doesn't leave other options. It is really a pain and I am trying to find a workaround for days now... I wish I could just write my own input stream and buffer the video from any format I want like in most frameworks.

@Calinou
Copy link
Member

Calinou commented Dec 16, 2020

I don t know why Godot has to use such a video format and doesn't leave other options.

Most other video codecs like H.264 are patent-encumbered. Supporting them in an open source engine is risky in countries where software patents are followed, such as the United States.

That said, there are plans to remove built-in video playback functionality in profit of an official GDNative add-on based on FFmpeg. FFmpeg is larger, but is much more compatible and has the potential to be less buggy.

@Yesyoor
Copy link

Yesyoor commented Jan 25, 2021

I don t know why Godot has to use such a video format and doesn't leave other options.

Most other video codecs like H.264 are patent-encumbered. Supporting them in an open source engine is risky in countries where software patents are followed, such as the United States.

That said, there are plans to remove built-in video playback functionality in profit of an official GDNative add-on based on FFmpeg. FFmpeg is larger, but is much more compatible and has the potential to be less buggy.

That was quite a good hint. I finally managed it, preprocessing the video in several video editors such as adobe after effects > shortcut > then used ffmpeg to convert lossless and i had a video with my pixelperfect magenta mask applied and was able to key it out using a shader :) now I have a transparent video playing inside a sphere mesh displaying serveral layer in front and beyond it 🤠

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants