Skip to content

node-av / lib / avGetHardwareDeviceTypeFromName

Function: avGetHardwareDeviceTypeFromName()

avGetHardwareDeviceTypeFromName(name): AVHWDeviceType

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

Get hardware device type from name.

Looks up the hardware device type enum from its string name. Returns AV_HWDEVICE_TYPE_NONE if the name is not recognized.

Direct mapping to av_hwdevice_find_type_by_name().

Parameters

name

FFHWDeviceType

Hardware device type name (e.g. "videotoolbox", "cuda")

Returns

AVHWDeviceType

Hardware device type enum, or AV_HWDEVICE_TYPE_NONE if not found

Example

typescript
import { avGetHardwareDeviceTypeFromName } from 'node-av/lib';

const type1 = avGetHardwareDeviceTypeFromName("videotoolbox"); // Returns AV_HWDEVICE_TYPE_VIDEOTOOLBOX
const type2 = avGetHardwareDeviceTypeFromName("cuda");         // Returns AV_HWDEVICE_TYPE_CUDA
const none = avGetHardwareDeviceTypeFromName("invalid");       // Returns AV_HWDEVICE_TYPE_NONE

See

av_hwdevice_find_type_by_name - FFmpeg Doxygen