Skip to content

Encode VideoFrame with alpha #672

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

Closed
akre54 opened this issue May 12, 2023 · 4 comments
Closed

Encode VideoFrame with alpha #672

akre54 opened this issue May 12, 2023 · 4 comments

Comments

@akre54
Copy link

akre54 commented May 12, 2023

Hi there - I'm trying to encode / mux a video with alpha (the inverse of #377). I can get an RGBA VideoFrame but the resulting video file doesn't have transparency.

See my renderer code here: https://gist.github.com/akre54/e93ab2ce27999aecb109e38085f2e7a7

I've also tried using the examples from these repos:

https://github.com/w3c/webcodecs/tree/main/samples/video-decode-display
https://github.com/tidoust/media-tests/tree/main

Do I understand correctly that encoding with alpha isn't supported in any current browsers? Or is there something I'm missing. Thanks!

@akre54 akre54 changed the title Encode VideoFrame with alpha to Encode VideoFrame with alpha May 12, 2023
@Djuffin
Copy link
Contributor

Djuffin commented May 12, 2023

Chromium doesn't support encoding frames with alpha yet.

@akre54
Copy link
Author

akre54 commented May 12, 2023

Okay thank you for the fast response. Am I understanding correctly that this is an implementation question rather than a required change to the spec?

Are there any workarounds available, or is this a wontfix?

@Djuffin
Copy link
Contributor

Djuffin commented May 13, 2023

Correct. The spec seems to have all the parts needed, but nobody's implemented yet.
https://www.w3.org/TR/webcodecs/#dom-encodedvideochunkmetadata-alphasidedata
https://www.w3.org/TR/webcodecs/#dom-videoencoderconfig-alpha

Are there any workarounds available, or is this a wontfix?

I can't think of any workarounds other than manually encoding alpha channel with a separate encoder.

@akre54
Copy link
Author

akre54 commented May 15, 2023

Okay I'll give that a shot and possibly open a crbug. Thanks for your help

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

No branches or pull requests

2 participants