files/en-us/web/api/videoframe/allocationsize/index.md
{{APIRef("Web Codecs API")}}{{AvailableInWorkers("window_and_dedicated")}}
The allocationSize() method of the {{domxref("VideoFrame")}} interface returns the number of bytes required to hold the video as filtered by options passed into the method.
allocationSize()
allocationSize(options)
options {{optional_inline}}
rect {{optional_inline}}
VideoFrame. If unspecified the {{domxref("VideoFrame.visibleRect","visibleRect")}} will be used. This is in the format of a dictionary object containing:
x: The x-coordinate.y: The y-coordinate.width: The width of the frame.height: The height of the frame.layout {{optional_inline}}
VideoFrame. Planes may not overlap. If unspecified the planes will be tightly packed:
offset
stride
format {{Optional_Inline}}
destination. Can be set to "RGBA", "RGBX", "BGRA", "BGRX". If unspecified, the {{domxref("VideoFrame.format","format")}} will be used.colorSpace {{Optional_Inline}}
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.
const videoRect = {
x: 0,
y: 0,
width: 800,
height: 600,
};
let size = VideoFrame.allocationSize({ rect: videoRect });
{{Specifications}}
{{Compat}}