Get to know MDN better
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 allocationSize() method of the VideoFrame interface returns the number of bytes required to hold the video as filtered by options passed into the method.
An object containing the following:
rect OptionalThe rectangle of pixels to copy from the VideoFrame. If unspecified the visibleRect will be used. This is in the format of a dictionary object containing:
A list containing the following values for each plane in the VideoFrame. Planes may not overlap. If unspecified the planes will be tightly packed:
offsetAn integer representing the offset in bytes where the given plane begins.
strideAn integer representing the number of bytes, including padding, used by each row of the plane.
format OptionalA pixel format for the pixel data in the destination. Can be set to "RGBA", "RGBX", "BGRA", "BGRX". If unspecified, the format will be used.
colorSpace OptionalSpecifies the color space of the pixel data in the destination. Can be set to "srgb" for the sRGB color space or "display-p3" for the display-p3 color space. Only applicable for RGB pixel formats. If unspecified, "srgb will be used.
An integer containing the number of bytes needed to hold the frame as specified by options.
In the following example the allocationSize is returned for the rectangle at top left with dimensions of 800 by 600.
| WebCodecs # dom-videoframe-allocationsize |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Aug 2, 2024 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.