Skip to content

node-av / lib / avGetCodecName

Function: avGetCodecName()

avGetCodecName(codecId): null | string

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

Get codec name from codec ID.

Returns the canonical codec name corresponding to the codec ID.

Direct mapping to avcodec_get_name().

Parameters

codecId

AVCodecID

Codec ID from AVCodecID enum

Returns

null | string

Codec name string or null

Example

typescript
import { AV_CODEC_ID_H264, AV_CODEC_ID_HEVC } from 'node-av/constants';
import { avGetCodecName } from 'node-av/lib';

const h264Name = avGetCodecName(AV_CODEC_ID_H264);  // Returns "h264"
const hevcName = avGetCodecName(AV_CODEC_ID_HEVC);  // Returns "hevc"
const unknownName = avGetCodecName(99999);          // Returns null

See

avcodec_get_name - FFmpeg Doxygen