w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.

Home Page:https://w3c.github.io/webcodecs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encode VideoFrame with alpha

akre54 opened this issue · comments

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!

Chromium doesn't support encoding frames with alpha yet.

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?

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.

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