10 bit YUV formats / accessing pixel data #631
Replies: 4 comments 10 replies
-
This is #384 (comment) - adding high bit depth (HBD) pixel types is a work in progress. Once we have a PR for adding the pixel types (just needs to be sent) it shouldn't be hard to add for software decoded cases. Hardware decoded cases will take some time since we don't have HBD readback paths and HBD canvas is a work in progress: whatwg/html#299 |
Beta Was this translation helpful? Give feedback.
-
You could also try WebGPU rather than WebGL. It supports 0-copy import and color space conversion. For now you still need the "--enable-unsafe-webgpu --disable-dawn-features=disallow_unsafe_apis" cmdline options to enable the WebGPU support. Chrome will officially release WebGPU soon. You can also read the sample for reference. |
Beta Was this translation helpful? Give feedback.
-
I encountered a similar issue, but with H.265 video with yuv420p10le pixel format. I tried WebGPU approach with VideoFrame as external texture, but I don't think current setup provides what I need. however, in my case, what I need is not canvas/webgpu correctly render the image, rather I want unclampped 10 bit rgb or original YUV data and let me do the YUVtoRGB conversion and SDR tone-mapping myself, since the HDR video includes dynamic metadata like HDR10+ and DolbyVision, and it not likely be supported natively by the user-agent. |
Beta Was this translation helpful? Give feedback.
-
anyone know if there's a way to encode YUV 4:2:2? Is it just a specific HEVC encoder level I'd need to use? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I have been experimenting with webcodecs to decode h264 video and generally things have been easy. One issue I have run into is when decoding 10bit videos, the returned VideoFrame has a null format field (I'm assuming that's because all the video formats listed are 8bit). I can pass the decoded videoFrame to texImage2D() and render in GL but the Yuv to RGB color conversion (which was done magically by texImage2D to my surprise) seems to be a little off (like its assuming the wrong bt601 color space instead of bt709, or maybe full range data, not really sure). Unfortunately I can't figure out how to access the raw YUV bytes directly from the VideoFrame since CopyTo() doesnt work if format is null.. Is there some way to get access to the underlying yuv bytes so I can do the color conversion in a shader myself? or any thought on adding more formats for 10bit ? or ways to supply the colorspace info for proper yuv2rgb conversion?
thanks!
Paul
Beta Was this translation helpful? Give feedback.
All reactions