Skip to content

node-av / lib / avIsHardwarePixelFormat

Function: avIsHardwarePixelFormat() ​

avIsHardwarePixelFormat(pixFmt): boolean

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

Check if pixel format is hardware accelerated.

Returns whether the pixel format represents hardware-accelerated frames (GPU memory) rather than software frames (system memory).

Direct mapping to av_pix_fmt_desc_get() with hwaccel check.

Parameters ​

pixFmt ​

AVPixelFormat

Pixel format to check

Returns ​

boolean

True if hardware format, false if software format

Example ​

typescript
import { AV_PIX_FMT_YUV420P, AV_PIX_FMT_CUDA } from 'node-av/constants';

const isSoftware = avIsHardwarePixelFormat(AV_PIX_FMT_YUV420P); // Returns false
const isHardware = avIsHardwarePixelFormat(AV_PIX_FMT_CUDA);    // Returns true

See ​

av_pix_fmt_desc_get - FFmpeg Doxygen