#951: Conversion to RGB in VideoFrame.copyTo()

Visit on Github.

Opened May 1, 2024

こんにちは TAG-さん!

I'm requesting a TAG review of Conversion to RGB in VideoFrame.copyTo().

VideoFrame.copyTo() can convert pixel data to RGB pixel format

Converting YUV video frames to RGB is often required for processing them in libraries like TensorFlow.js and OpenCV.js. Previously the only possible way to achieve this was rendering the frame on a canvas.

Specifying VideoFrameCopyToOptions.format and VideoFrameCopyToOptions.colorSpace make it possible to asynchronously convert frames to RGB pixel format by calling VideoFrame.copyTo() without having to use an extra canvas.

Further details:

  • I have reviewed the TAG's Web Platform Design Principles
  • Relevant time constraints or deadlines: couple of weeks
  • The group where the work on this specification is currently being done: Media Working Group
  • This work is being funded by: Google LLC

Discussions

2024-09-02

Minutes

Question open to Lea about color spaces stuff in CSS. Architectural desire to ensure that color is treated consistently across the platform.

This really needs to be taken to the Media WG. A gist is not really good enough.

Is the name "copyTo" the right name? Or is this a color space transform? Are there other transforms that the platform should support? See The Design Principle issue on naming.

2024-09-09

Minutes

Martin: I think this is satisfied but there is a need for greater coordination across the platform for how color is handled... The CSS area is more advanced with color spaces, the media pipeline is more advanced with HDR. They're not talking to each other.

Yves: name might not be right ... because it's doing a conversion to RGB... instead of just copying to something...

Thanks for giving this opportunity to review this work. We see this as a useful addition to the platform.

We do observe that there is a lot of uncoordinated work on color across the platform. Our understanding of the situation is that CSS is quite advanced with its work on color spaces and the media pipeline (video and so forth) is more advanced with high dynamic range content. Having a uniform platform-wide would be desirable and we'd encourage you to engage with CSS folks on the subject to have that happen. You might consider proposing a TPAC session on this topic?

We do think that the name is a little misleading here as the "copy" part of the operation isn't the most important aspect; it's the conversion or transform that is the important action. Is this something that warrants a new API? copyTo looks to be relatively new, is it possible to choose a better name?

Finally, from a process perspective, we'd strongly encourage you to take this work to the Media Working Group repo rather than sitting in someone's private GitHub account.

Either way, this work looks like a useful contribution, so we're closing this as satisfied with concerns.

No objections and posted