Since September 2024, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Dedicated Web Workers.
The VideoColorSpace interface of the WebCodecs API represents the color space of a video.
VideoColorSpace()Creates a new VideoColorSpace object.
VideoColorSpace.primaries Read only
A string containing the color primary describing the color gamut of a video sample.
VideoColorSpace.transferA string containing the transfer characteristics of video samples.
VideoColorSpace.matrixA string containing the matrix coefficients describing the relationship between sample component values and color coordinates.
VideoColorSpace.fullRangeA Boolean. If true indicates that full-range color values are used.
VideoColorSpace.toJSON()Returns a JSON representation of the VideoColorSpace object.
In the following example, colorSpace is a VideoColorSpace object returned from VideoFrame. The object is then printed to the console.
let colorSpace = VideoFrame.colorSpace; console.log(colorSpace);
| Specification |
|---|
| WebCodecs> # videocolorspace> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
VideoColorSpace |
94 | 94 | 130 | 80 | 17 | 94 | 130 | 66 | 17 | 17.0 | 94 | 17 |
VideoColorSpace |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
fullRange |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
matrix |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
primaries |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
toJSON |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
transfer |
94 | 94 | 130 | 80 | 15.4 | 94 | 130 | 66 | 15.4 | 17.0 | 94 | 15.4 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/VideoColorSpace