w3c / webcodecs

WebCodecs is a flexible web API for encoding and decoding audio and video.
https://w3c.github.io/webcodecs/
Other
953 stars 135 forks source link

Implicit color space conversion is not possible when calling glTexSubImage2D in Webassembly app. #640

Closed sasmaster closed 1 year ago

sasmaster commented 1 year ago

Hi. I am implementing a kind of hybrid decoding solution using C++ (Emscripten) and JS. Demuxer is running on the C++ side as well as WebGL surface updates,but decoding is done on Js side using webcodecs VideoDecoder. Cool feature I have noticed is that in Js app gl.texSubImage2D takes care of converting YUV NV12 into RGB(A), but it doesn't happen when calling this methods in Emscripten. Is it something that can be once day moved to the "lower level" APis in the browser so that wasm developers won't have to implement color space conversions? Thanks.

dalecurtis commented 1 year ago

I think this is a likely a question for the texSubImage2D bindings in WASM and not WebCodecs. I suspect it's not operating on a VideoFrame object but raw bytes, so would need some sort of understanding of a YUV format to support this. Again that's a bit outside of WebCodecs, so I'm going to close this.