mediacapture-extensions icon indicating copy to clipboard operation
mediacapture-extensions copied to clipboard

mediastream cannot handle webcam data stream in yuv pixel format correctly

Open Danjuanlab opened this issue 1 year ago • 0 comments

Currently using webrtc to open the local webcam device, only when the pixel format of the webcam is srgb or mjpeg, the color rendered to the canvas or video is correct. When the connected webcam is a hardware camera capture card, or an obs virtual camera. Both of these are transmitted in yuv pixel format. When the GPU hardware acceleration of the browser is turned off, the colors rendered to the video and canvas are wrong. When the browser hardware acceleration is turned on, the color rendering in the video tag is correct, but the canvas is still wrong.

Since the mediastream object does not provide restrictions such as pixel format or color space, and so far I have not found any method to directly read the raw data byte stream in the mediaStream, so as a developer, it is impossible to judge whether the webcam opened by the user is What pixel format, and then do subsequent color conversion.

image image

屏幕截图 2022-03-14 112300333

Danjuanlab avatar May 19 '23 03:05 Danjuanlab