Skip to content

node-av / lib / avImageAllocArrays

Function: avImageAllocArrays() ​

avImageAllocArrays(width, height, pixFmt, align): object

Defined in: src/lib/utilities.ts:741

Allocate image arrays.

Allocates image data as separate plane arrays.

Parameters ​

width ​

number

Image width

height ​

number

Image height

pixFmt ​

AVPixelFormat

Pixel format

align ​

number

Buffer alignment

Returns ​

object

Object with data planes, line sizes, and total size

data ​

data: Buffer<ArrayBufferLike>[]

linesizes ​

linesizes: number[]

size ​

size: number

Example ​

typescript
const { data, linesizes, size } = avImageAllocArrays(
  1920, 1080, AV_PIX_FMT_YUV420P, 32
);
console.log(`Allocated ${data.length} planes, total ${size} bytes`);