Skip to content

node-av / lib / CodecContext

Class: CodecContext ​

Defined in: src/lib/codec-context.ts:75

Codec context for encoding and decoding.

Main structure for codec operations, containing all codec parameters and state. Handles encoding raw frames to packets and decoding packets to frames. Supports both software and hardware-accelerated codecs. Must be configured and opened before use.

Direct mapping to FFmpeg's AVCodecContext.

Example ​

typescript
import { CodecContext, Codec, FFmpegError } from 'node-av';
import { AV_CODEC_ID_H264, AV_PIX_FMT_YUV420P } from 'node-av/constants';

// Create decoder
const decoder = new CodecContext();
const codec = Codec.findDecoder(AV_CODEC_ID_H264);
decoder.allocContext3(codec);

// Configure from stream parameters
decoder.parametersToContext(stream.codecpar);

// Open decoder
let ret = await decoder.open2(codec);
FFmpegError.throwIfError(ret, 'open2');

// Decode packets
ret = await decoder.sendPacket(packet);
if (ret >= 0) {
  ret = await decoder.receiveFrame(frame);
  if (ret >= 0) {
    // Process decoded frame
  }
}

// Cleanup
decoder.freeContext();

See ​

Extends ​

Implements ​

Constructors ​

Constructor ​

new CodecContext(): CodecContext

Defined in: src/lib/codec-context.ts:76

Returns ​

CodecContext

Overrides ​

OptionMember<NativeCodecContext>.constructor

Properties ​

native ​

protected native: NativeCodecContext

Defined in: src/lib/option.ts:1059

Inherited from ​

OptionMember.native

Accessors ​

bitRate ​

Get Signature ​

get bitRate(): bigint

Defined in: src/lib/codec-context.ts:147

Average bitrate.

Target bitrate for encoding, detected bitrate for decoding. In bits per second.

Direct mapping to AVCodecContext->bit_rate.

Returns ​

bigint

Set Signature ​

set bitRate(value): void

Defined in: src/lib/codec-context.ts:151

Parameters ​
value ​

bigint

Returns ​

void


bitsPerCodedSample ​

Get Signature ​

get bitsPerCodedSample(): number

Defined in: src/lib/codec-context.ts:574

Number of bits per coded sample.

Bits per sample/pixel from the demuxer (needed by some codecs). For uncompressed formats, this is the bits per sample.

Direct mapping to AVCodecContext->bits_per_coded_sample.

Returns ​

number

Set Signature ​

set bitsPerCodedSample(value): void

Defined in: src/lib/codec-context.ts:578

Parameters ​
value ​

number

Returns ​

void


bitsPerRawSample ​

Get Signature ​

get bitsPerRawSample(): number

Defined in: src/lib/codec-context.ts:590

Number of bits per raw sample.

Bits per sample before compression/encoding. Only set when different from bitsPerCodedSample.

Direct mapping to AVCodecContext->bits_per_raw_sample.

Returns ​

number

Set Signature ​

set bitsPerRawSample(value): void

Defined in: src/lib/codec-context.ts:594

Parameters ​
value ​

number

Returns ​

void


channelLayout ​

Get Signature ​

get channelLayout(): ChannelLayout

Defined in: src/lib/codec-context.ts:616

Audio channel layout.

Describes channel configuration.

Direct mapping to AVCodecContext->ch_layout.

Returns ​

ChannelLayout

Set Signature ​

set channelLayout(value): void

Defined in: src/lib/codec-context.ts:620

Parameters ​
value ​

ChannelLayout

Returns ​

void


channels ​

Get Signature ​

get channels(): number

Defined in: src/lib/codec-context.ts:530

Number of audio channels.

Direct mapping to AVCodecContext->channels.

Returns ​

number

Set Signature ​

set channels(value): void

Defined in: src/lib/codec-context.ts:534

Parameters ​
value ​

number

Returns ​

void


chromaLocation ​

Get Signature ​

get chromaLocation(): AVChromaLocation

Defined in: src/lib/codec-context.ts:502

Chroma sample location.

Position of chroma samples.

Direct mapping to AVCodecContext->chroma_sample_location.

Returns ​

AVChromaLocation

Set Signature ​

set chromaLocation(value): void

Defined in: src/lib/codec-context.ts:506

Parameters ​
value ​

AVChromaLocation

Returns ​

void


codecId ​

Get Signature ​

get codecId(): AVCodecID

Defined in: src/lib/codec-context.ts:98

Codec identifier.

Direct mapping to AVCodecContext->codec_id.

Returns ​

AVCodecID

Set Signature ​

set codecId(value): void

Defined in: src/lib/codec-context.ts:102

Parameters ​
value ​

AVCodecID

Returns ​

void


codecTag ​

Get Signature ​

get codecTag(): number

Defined in: src/lib/codec-context.ts:113

Codec tag.

Additional codec tag used by some formats.

Direct mapping to AVCodecContext->codec_tag.

Returns ​

number

Set Signature ​

set codecTag(value): void

Defined in: src/lib/codec-context.ts:117

Parameters ​
value ​

string | number

Returns ​

void


codecTagString ​

Get Signature ​

get codecTagString(): string | null

Defined in: src/lib/codec-context.ts:135

Codec tag as string (FourCC).

Human-readable string representation of the codec tag. Returns the FourCC (Four Character Code) format.

Returns ​

string | null


codecType ​

Get Signature ​

get codecType(): AVMediaType

Defined in: src/lib/codec-context.ts:85

Type of codec (video/audio/subtitle).

Direct mapping to AVCodecContext->codec_type.

Returns ​

AVMediaType

Set Signature ​

set codecType(value): void

Defined in: src/lib/codec-context.ts:89

Parameters ​
value ​

AVMediaType

Returns ​

void


colorPrimaries ​

Get Signature ​

get colorPrimaries(): AVColorPrimaries

Defined in: src/lib/codec-context.ts:457

Color primaries.

Chromaticity coordinates of source primaries.

Direct mapping to AVCodecContext->color_primaries.

Returns ​

AVColorPrimaries

Set Signature ​

set colorPrimaries(value): void

Defined in: src/lib/codec-context.ts:461

Parameters ​
value ​

AVColorPrimaries

Returns ​

void


colorRange ​

Get Signature ​

get colorRange(): AVColorRange

Defined in: src/lib/codec-context.ts:442

Color range.

MPEG (limited) or JPEG (full) range.

Direct mapping to AVCodecContext->color_range.

Returns ​

AVColorRange

Set Signature ​

set colorRange(value): void

Defined in: src/lib/codec-context.ts:446

Parameters ​
value ​

AVColorRange

Returns ​

void


colorSpace ​

Get Signature ​

get colorSpace(): AVColorSpace

Defined in: src/lib/codec-context.ts:487

YUV color space.

Color space for YUV content.

Direct mapping to AVCodecContext->colorspace.

Returns ​

AVColorSpace

Set Signature ​

set colorSpace(value): void

Defined in: src/lib/codec-context.ts:491

Parameters ​
value ​

AVColorSpace

Returns ​

void


colorTrc ​

Get Signature ​

get colorTrc(): AVColorTransferCharacteristic

Defined in: src/lib/codec-context.ts:472

Color transfer characteristic.

Transfer function (gamma).

Direct mapping to AVCodecContext->color_trc.

Returns ​

AVColorTransferCharacteristic

Set Signature ​

set colorTrc(value): void

Defined in: src/lib/codec-context.ts:476

Parameters ​
value ​

AVColorTransferCharacteristic

Returns ​

void


delay ​

Get Signature ​

get delay(): number

Defined in: src/lib/codec-context.ts:194

Codec delay.

Number of frames the decoder needs to output before first frame.

Direct mapping to AVCodecContext->delay.

Returns ​

number


extraData ​

Get Signature ​

get extraData(): Buffer<ArrayBufferLike> | null

Defined in: src/lib/codec-context.ts:235

Extra binary data for codec.

Contains codec-specific initialization data.

Direct mapping to AVCodecContext->extradata.

Returns ​

Buffer<ArrayBufferLike> | null

Set Signature ​

set extraData(value): void

Defined in: src/lib/codec-context.ts:239

Parameters ​
value ​

Buffer<ArrayBufferLike> | null

Returns ​

void


extraHWFrames ​

Get Signature ​

get extraHWFrames(): number

Defined in: src/lib/codec-context.ts:754

Number of extra hardware frames to allocate.

Specifies additional hardware frame buffers for decoders that need them. Useful for hardware decoders requiring frame buffering or reordering.

Direct mapping to AVCodecContext->extra_hw_frames.

Returns ​

number

Set Signature ​

set extraHWFrames(value): void

Defined in: src/lib/codec-context.ts:758

Parameters ​
value ​

number

Returns ​

void


flags ​

Get Signature ​

get flags(): AVCodecFlag

Defined in: src/lib/codec-context.ts:205

Codec flags.

Combination of AV_CODEC_FLAG_* values.

Direct mapping to AVCodecContext->flags.

Returns ​

AVCodecFlag

Set Signature ​

set flags(value): void

Defined in: src/lib/codec-context.ts:209

Parameters ​
value ​

AVCodecFlag

Returns ​

void


flags2 ​

Get Signature ​

get flags2(): AVCodecFlag2

Defined in: src/lib/codec-context.ts:220

Additional codec flags.

Combination of AV_CODEC_FLAG2_* values.

Direct mapping to AVCodecContext->flags2.

Returns ​

AVCodecFlag2

Set Signature ​

set flags2(value): void

Defined in: src/lib/codec-context.ts:224

Parameters ​
value ​

AVCodecFlag2

Returns ​

void


frameNumber ​

Get Signature ​

get frameNumber(): number

Defined in: src/lib/codec-context.ts:605

Current frame number.

Frame counter for debugging.

Direct mapping to AVCodecContext->frame_number.

Returns ​

number


framerate ​

Get Signature ​

get framerate(): Rational

Defined in: src/lib/codec-context.ts:426

Frame rate.

Frames per second for encoding.

Direct mapping to AVCodecContext->framerate.

Returns ​

Rational

Set Signature ​

set framerate(value): void

Defined in: src/lib/codec-context.ts:431

Parameters ​
value ​

Rational

Returns ​

void


frameSize ​

Get Signature ​

get frameSize(): number

Defined in: src/lib/codec-context.ts:558

Number of samples per audio frame.

Direct mapping to AVCodecContext->frame_size.

Returns ​

number

Set Signature ​

set frameSize(value): void

Defined in: src/lib/codec-context.ts:562

Parameters ​
value ​

number

Returns ​

void


globalQuality ​

Get Signature ​

get globalQuality(): number

Defined in: src/lib/codec-context.ts:669

Global quality for constant quality mode.

Used by encoders that support constant quality mode (e.g., -qscale in FFmpeg CLI). Set this value to enable constant quality encoding instead of constant bitrate. Valid range depends on the codec (e.g., 0-69 for MPEG-4, FF_LAMBDA_SCALE for others).

Direct mapping to AVCodecContext->global_quality.

Example ​
typescript
// MPEG-4 constant quality (lower = better quality)
codecContext.globalQuality = 5 * FF_QP2LAMBDA;
Returns ​

number

Set Signature ​

set globalQuality(value): void

Defined in: src/lib/codec-context.ts:673

Parameters ​
value ​

number

Returns ​

void


gopSize ​

Get Signature ​

get gopSize(): number

Defined in: src/lib/codec-context.ts:339

Group of pictures size.

Maximum number of frames between keyframes.

Direct mapping to AVCodecContext->gop_size.

Returns ​

number

Set Signature ​

set gopSize(value): void

Defined in: src/lib/codec-context.ts:343

Parameters ​
value ​

number

Returns ​

void


hasBFrames ​

Get Signature ​

get hasBFrames(): number

Defined in: src/lib/codec-context.ts:399

Number of frames delay in decoder.

For codecs with B-frames.

Direct mapping to AVCodecContext->has_b_frames.

Returns ​

number


height ​

Get Signature ​

get height(): number

Defined in: src/lib/codec-context.ts:324

Picture height in pixels.

Direct mapping to AVCodecContext->height.

Returns ​

number

Set Signature ​

set height(value): void

Defined in: src/lib/codec-context.ts:328

Parameters ​
value ​

number

Returns ​

void


hwDeviceCtx ​

Get Signature ​

get hwDeviceCtx(): HardwareDeviceContext | null

Defined in: src/lib/codec-context.ts:729

Hardware device context.

Reference to hardware device for acceleration.

Direct mapping to AVCodecContext->hw_device_ctx.

Returns ​

HardwareDeviceContext | null

Set Signature ​

set hwDeviceCtx(value): void

Defined in: src/lib/codec-context.ts:742

Parameters ​
value ​

HardwareDeviceContext | null

Returns ​

void


hwFramesCtx ​

Get Signature ​

get hwFramesCtx(): HardwareFramesContext | null

Defined in: src/lib/codec-context.ts:769

Hardware frames context.

Reference to hardware frames for GPU memory.

Direct mapping to AVCodecContext->hw_frames_ctx.

Returns ​

HardwareFramesContext | null

Set Signature ​

set hwFramesCtx(value): void

Defined in: src/lib/codec-context.ts:782

Parameters ​
value ​

HardwareFramesContext | null

Returns ​

void


isOpen ​

Get Signature ​

get isOpen(): boolean

Defined in: src/lib/codec-context.ts:791

Check if codec is open.

True if the codec has been opened.

Returns ​

boolean


level ​

Get Signature ​

get level(): number

Defined in: src/lib/codec-context.ts:265

Codec level.

Level within the specified profile.

Direct mapping to AVCodecContext->level.

Returns ​

number

Set Signature ​

set level(value): void

Defined in: src/lib/codec-context.ts:269

Parameters ​
value ​

number

Returns ​

void


maxBFrames ​

Get Signature ​

get maxBFrames(): number

Defined in: src/lib/codec-context.ts:369

Maximum number of B-frames.

B-frames between non-B-frames.

Direct mapping to AVCodecContext->max_b_frames.

Returns ​

number

Set Signature ​

set maxBFrames(value): void

Defined in: src/lib/codec-context.ts:373

Parameters ​
value ​

number

Returns ​

void


mbDecision ​

Get Signature ​

get mbDecision(): number

Defined in: src/lib/codec-context.ts:384

Macroblock decision mode.

Algorithm for macroblock decision.

Direct mapping to AVCodecContext->mb_decision.

Returns ​

number

Set Signature ​

set mbDecision(value): void

Defined in: src/lib/codec-context.ts:388

Parameters ​
value ​

number

Returns ​

void


pixelFormat ​

Get Signature ​

get pixelFormat(): AVPixelFormat

Defined in: src/lib/codec-context.ts:354

Pixel format.

Format of the video frames.

Direct mapping to AVCodecContext->pix_fmt.

Returns ​

AVPixelFormat

Set Signature ​

set pixelFormat(value): void

Defined in: src/lib/codec-context.ts:358

Parameters ​
value ​

AVPixelFormat

Returns ​

void


pktTimebase ​

Get Signature ​

get pktTimebase(): Rational

Defined in: src/lib/codec-context.ts:178

Packet time base.

Time base of the packets from/to the demuxer/muxer.

Direct mapping to AVCodecContext->pkt_timebase.

Returns ​

Rational

Set Signature ​

set pktTimebase(value): void

Defined in: src/lib/codec-context.ts:183

Parameters ​
value ​

Rational

Returns ​

void


profile ​

Get Signature ​

get profile(): AVProfile

Defined in: src/lib/codec-context.ts:250

Codec profile.

FF_PROFILE_* value indicating codec profile.

Direct mapping to AVCodecContext->profile.

Returns ​

AVProfile

Set Signature ​

set profile(value): void

Defined in: src/lib/codec-context.ts:254

Parameters ​
value ​

AVProfile

Returns ​

void


qMax ​

Get Signature ​

get qMax(): number

Defined in: src/lib/codec-context.ts:646

Maximum quantizer.

Maximum quantization parameter.

Direct mapping to AVCodecContext->qmax.

Returns ​

number

Set Signature ​

set qMax(value): void

Defined in: src/lib/codec-context.ts:650

Parameters ​
value ​

number

Returns ​

void


qMin ​

Get Signature ​

get qMin(): number

Defined in: src/lib/codec-context.ts:631

Minimum quantizer.

Minimum quantization parameter.

Direct mapping to AVCodecContext->qmin.

Returns ​

number

Set Signature ​

set qMin(value): void

Defined in: src/lib/codec-context.ts:635

Parameters ​
value ​

number

Returns ​

void


rcBufferSize ​

Get Signature ​

get rcBufferSize(): number

Defined in: src/lib/codec-context.ts:684

Rate control buffer size.

Decoder bitstream buffer size.

Direct mapping to AVCodecContext->rc_buffer_size.

Returns ​

number

Set Signature ​

set rcBufferSize(value): void

Defined in: src/lib/codec-context.ts:688

Parameters ​
value ​

number

Returns ​

void


rcMaxRate ​

Get Signature ​

get rcMaxRate(): bigint

Defined in: src/lib/codec-context.ts:699

Maximum bitrate.

Maximum bitrate in bits per second.

Direct mapping to AVCodecContext->rc_max_rate.

Returns ​

bigint

Set Signature ​

set rcMaxRate(value): void

Defined in: src/lib/codec-context.ts:703

Parameters ​
value ​

bigint

Returns ​

void


rcMinRate ​

Get Signature ​

get rcMinRate(): bigint

Defined in: src/lib/codec-context.ts:714

Minimum bitrate.

Minimum bitrate in bits per second.

Direct mapping to AVCodecContext->rc_min_rate.

Returns ​

bigint

Set Signature ​

set rcMinRate(value): void

Defined in: src/lib/codec-context.ts:718

Parameters ​
value ​

bigint

Returns ​

void


sampleAspectRatio ​

Get Signature ​

get sampleAspectRatio(): Rational

Defined in: src/lib/codec-context.ts:410

Sample aspect ratio.

Pixel width/height ratio.

Direct mapping to AVCodecContext->sample_aspect_ratio.

Returns ​

Rational

Set Signature ​

set sampleAspectRatio(value): void

Defined in: src/lib/codec-context.ts:415

Parameters ​
value ​

Rational

Returns ​

void


sampleFormat ​

Get Signature ​

get sampleFormat(): AVSampleFormat

Defined in: src/lib/codec-context.ts:545

Audio sample format.

Format of audio samples.

Direct mapping to AVCodecContext->sample_fmt.

Returns ​

AVSampleFormat

Set Signature ​

set sampleFormat(value): void

Defined in: src/lib/codec-context.ts:549

Parameters ​
value ​

AVSampleFormat

Returns ​

void


sampleRate ​

Get Signature ​

get sampleRate(): number

Defined in: src/lib/codec-context.ts:517

Audio sample rate.

Samples per second.

Direct mapping to AVCodecContext->sample_rate.

Returns ​

number

Set Signature ​

set sampleRate(value): void

Defined in: src/lib/codec-context.ts:521

Parameters ​
value ​

number

Returns ​

void


threadCount ​

Get Signature ​

get threadCount(): number

Defined in: src/lib/codec-context.ts:281

Thread count for codec.

Number of threads to use for decoding/encoding. 0 for automatic selection.

Direct mapping to AVCodecContext->thread_count.

Returns ​

number

Set Signature ​

set threadCount(value): void

Defined in: src/lib/codec-context.ts:285

Parameters ​
value ​

number

Returns ​

void


threadType ​

Get Signature ​

get threadType(): AVThreadType

Defined in: src/lib/codec-context.ts:298

Thread type for codec.

Which multithreading methods to use.

  • FF_THREAD_FRAME (1): Decode more than one frame at once
  • FF_THREAD_SLICE (2): Decode more than one part of a single frame at once

Direct mapping to AVCodecContext->thread_type.

Returns ​

AVThreadType

Set Signature ​

set threadType(value): void

Defined in: src/lib/codec-context.ts:302

Parameters ​
value ​

AVThreadType

Returns ​

void


timeBase ​

Get Signature ​

get timeBase(): Rational

Defined in: src/lib/codec-context.ts:162

Time base for timestamps.

Fundamental unit of time in seconds for this context.

Direct mapping to AVCodecContext->time_base.

Returns ​

Rational

Set Signature ​

set timeBase(value): void

Defined in: src/lib/codec-context.ts:167

Parameters ​
value ​

Rational

Returns ​

void


width ​

Get Signature ​

get width(): number

Defined in: src/lib/codec-context.ts:311

Picture width in pixels.

Direct mapping to AVCodecContext->width.

Returns ​

number

Set Signature ​

set width(value): void

Defined in: src/lib/codec-context.ts:315

Parameters ​
value ​

number

Returns ​

void

Methods ​

[dispose]() ​

[dispose](): void

Defined in: src/lib/codec-context.ts:1473

Dispose of the codec context.

Implements the Disposable interface for automatic cleanup. Equivalent to calling freeContext().

Returns ​

void

Example ​

typescript
{
  using ctx = new CodecContext();
  ctx.allocContext3(codec);
  await ctx.open2();
  // Use context...
} // Automatically freed when leaving scope

Implementation of ​

Disposable.[dispose]


allocContext3() ​

allocContext3(codec?): void

Defined in: src/lib/codec-context.ts:816

Allocate codec context.

Allocates and initializes the context for the given codec.

Direct mapping to avcodec_alloc_context3().

Parameters ​

codec? ​

Codec | null = null

Codec to use (null for default)

Returns ​

void

Example ​

typescript
import { Codec } from 'node-av';
import { AV_CODEC_ID_H264 } from 'node-av/constants';

const codec = Codec.findDecoder(AV_CODEC_ID_H264);
ctx.allocContext3(codec);

See ​


clearFlags() ​

clearFlags(...flags): void

Defined in: src/lib/codec-context.ts:1326

Clear codec flags.

Clears one or more flags using bitwise AND NOT. Allows clearing multiple flags without manually performing bitwise operations.

Parameters ​

flags ​

...AVCodecFlag[]

One or more flag values to clear

Returns ​

void

Example ​

typescript
import { AV_CODEC_FLAG_PSNR } from 'node-av/constants';

// Clear specific flag
codecContext.clearFlags(AV_CODEC_FLAG_PSNR);

See ​


clearFlags2() ​

clearFlags2(...flags): void

Defined in: src/lib/codec-context.ts:1409

Clear codec flags2.

Clears one or more flags2 values using bitwise AND NOT. Allows clearing multiple flags without manually performing bitwise operations.

Parameters ​

flags ​

...AVCodecFlag2[]

One or more flag2 values to clear

Returns ​

void

Example ​

typescript
import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';

// Clear specific flag2
codecContext.clearFlags2(AV_CODEC_FLAG2_FAST);

See ​


flushBuffers() ​

flushBuffers(): void

Defined in: src/lib/codec-context.ts:973

Flush codec buffers.

Resets the internal codec state. Used when seeking or switching streams.

Direct mapping to avcodec_flush_buffers().

Returns ​

void

Example ​

typescript
// Flush when seeking
ctx.flushBuffers();
// Codec is now ready for new data

freeContext() ​

freeContext(): void

Defined in: src/lib/codec-context.ts:836

Free the codec context.

Releases all resources. The context becomes invalid.

Direct mapping to avcodec_free_context().

Returns ​

void

Example ​

typescript
ctx.freeContext();
// Context is now invalid

See ​


getNative() ​

getNative(): NativeCodecContext

Defined in: src/lib/codec-context.ts:1453

Internal

Get the underlying native CodecContext object.

Returns ​

NativeCodecContext

The native CodecContext binding object

Implementation of ​

NativeWrapper.getNative


getOption() ​

Get an option value from this object.

Uses the AVOption API to retrieve options.

Direct mapping to av_opt_get* functions.

Param ​

name

Option name

Param ​

type

Option type (defaults to AV_OPT_TYPE_STRING)

Param ​

searchFlags

Search flags (default: AV_OPT_SEARCH_CHILDREN)

Example ​

typescript
import { AV_OPT_TYPE_STRING, AV_OPT_TYPE_RATIONAL, AV_OPT_TYPE_PIXEL_FMT, AV_OPT_TYPE_INT64 } from 'node-av/constants';

// String options (default)
const preset = obj.getOption('preset');
const codec = obj.getOption('codec', AV_OPT_TYPE_STRING);

// Typed options
const framerate = obj.getOption('framerate', AV_OPT_TYPE_RATIONAL); // Returns {num, den}
const pixFmt = obj.getOption('pix_fmt', AV_OPT_TYPE_PIXEL_FMT); // Returns AVPixelFormat
const bitrate = obj.getOption('bitrate', AV_OPT_TYPE_INT64); // Returns bigint

Call Signature ​

getOption(name, type?, searchFlags?): string | null

Defined in: src/lib/option.ts:1288

Parameters ​
name ​

string

type? ​

AVOptionTypeString

searchFlags? ​

AVOptionSearchFlags

Returns ​

string | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): string | null

Defined in: src/lib/option.ts:1289

Parameters ​
name ​

string

type ​

AVOptionTypeColor

searchFlags? ​

AVOptionSearchFlags

Returns ​

string | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1292

Parameters ​
name ​

string

type ​

AVOptionTypeInt

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): bigint | null

Defined in: src/lib/option.ts:1293

Parameters ​
name ​

string

type ​

AVOptionTypeInt64

searchFlags? ​

AVOptionSearchFlags

Returns ​

bigint | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1294

Parameters ​
name ​

string

type ​

AVOptionTypeUint

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): bigint | null

Defined in: src/lib/option.ts:1295

Parameters ​
name ​

string

type ​

AVOptionTypeUint64

searchFlags? ​

AVOptionSearchFlags

Returns ​

bigint | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1296

Parameters ​
name ​

string

type ​

AVOptionTypeFlags

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): boolean | null

Defined in: src/lib/option.ts:1297

Parameters ​
name ​

string

type ​

AVOptionTypeBool

searchFlags? ​

AVOptionSearchFlags

Returns ​

boolean | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1298

Parameters ​
name ​

string

type ​

AVOptionTypeDuration

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1299

Parameters ​
name ​

string

type ​

AVOptionTypeConst

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1302

Parameters ​
name ​

string

type ​

AVOptionTypeDouble

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): number | null

Defined in: src/lib/option.ts:1303

Parameters ​
name ​

string

type ​

AVOptionTypeFloat

searchFlags? ​

AVOptionSearchFlags

Returns ​

number | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): IRational | null

Defined in: src/lib/option.ts:1306

Parameters ​
name ​

string

type ​

AVOptionTypeRational

searchFlags? ​

AVOptionSearchFlags

Returns ​

IRational | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): IRational | null

Defined in: src/lib/option.ts:1307

Parameters ​
name ​

string

type ​

AVOptionTypeVideoRate

searchFlags? ​

AVOptionSearchFlags

Returns ​

IRational | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): AVPixelFormat | null

Defined in: src/lib/option.ts:1308

Parameters ​
name ​

string

type ​

AVOptionTypePixelFmt

searchFlags? ​

AVOptionSearchFlags

Returns ​

AVPixelFormat | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): AVSampleFormat | null

Defined in: src/lib/option.ts:1309

Parameters ​
name ​

string

type ​

AVOptionTypeSampleFmt

searchFlags? ​

AVOptionSearchFlags

Returns ​

AVSampleFormat | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): IDimension | null

Defined in: src/lib/option.ts:1310

Parameters ​
name ​

string

type ​

AVOptionTypeImageSize

searchFlags? ​

AVOptionSearchFlags

Returns ​

IDimension | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): ChannelLayout | null

Defined in: src/lib/option.ts:1311

Parameters ​
name ​

string

type ​

AVOptionTypeChLayout

searchFlags? ​

AVOptionSearchFlags

Returns ​

ChannelLayout | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): Dictionary | null

Defined in: src/lib/option.ts:1312

Parameters ​
name ​

string

type ​

AVOptionTypeDict

searchFlags? ​

AVOptionSearchFlags

Returns ​

Dictionary | null

Inherited from ​

OptionMember.getOption

Call Signature ​

getOption(name, type, searchFlags?): string | null

Defined in: src/lib/option.ts:1313

Parameters ​
name ​

string

type ​

AVOptionTypeBinary

searchFlags? ​

AVOptionSearchFlags

Returns ​

string | null

Inherited from ​

OptionMember.getOption


hasFlags() ​

hasFlags(...flags): boolean

Defined in: src/lib/codec-context.ts:1354

Check if codec has specific flags.

Tests whether all specified flags are set using bitwise AND.

Parameters ​

flags ​

...AVCodecFlag[]

One or more flag values to check

Returns ​

boolean

true if all specified flags are set, false otherwise

Example ​

typescript
import { AV_CODEC_FLAG_QSCALE } from 'node-av/constants';

if (codecContext.hasFlags(AV_CODEC_FLAG_QSCALE)) {
  console.log('QSCALE flag is set');
}

See ​


hasFlags2() ​

hasFlags2(...flags): boolean

Defined in: src/lib/codec-context.ts:1437

Check if codec has specific flags2.

Tests whether all specified flags2 are set using bitwise AND.

Parameters ​

flags ​

...AVCodecFlag2[]

One or more flag2 values to check

Returns ​

boolean

true if all specified flags2 are set, false otherwise

Example ​

typescript
import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';

if (codecContext.hasFlags2(AV_CODEC_FLAG2_FAST)) {
  console.log('FAST flag2 is set');
}

See ​


listOptions() ​

listOptions(): OptionInfo[]

Defined in: src/lib/option.ts:1428

List all available options for this object.

Uses the AVOption API to enumerate all options. Useful for discovering available settings and their types.

Direct mapping to av_opt_next() iteration.

Returns ​

OptionInfo[]

Array of option information objects

Example ​

typescript
const options = obj.listOptions();
for (const opt of options) {
  console.log(`${opt.name}: ${opt.help}`);
  console.log(`  Type: ${opt.type}, Default: ${opt.defaultValue}`);
  console.log(`  Range: ${opt.min} - ${opt.max}`);
}

See ​

OptionInfo For option metadata structure

Inherited from ​

OptionMember.listOptions


open2() ​

open2(codec?, options?): Promise<number>

Defined in: src/lib/codec-context.ts:868

Open the codec.

Initializes the codec for encoding/decoding. Must be called before processing frames/packets.

Direct mapping to avcodec_open2().

Parameters ​

codec? ​

Codec | null = null

Codec to open with (null to use already set)

options? ​

Dictionary | null = null

Codec-specific options

Returns ​

Promise<number>

0 on success, negative AVERROR on error:

  • AVERROR_EINVAL: Invalid parameters
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';

const ret = await ctx.open2(codec);
FFmpegError.throwIfError(ret, 'open2');
// Codec is now open and ready

See ​


open2Sync() ​

open2Sync(codec?, options?): number

Defined in: src/lib/codec-context.ts:900

Open the codec synchronously. Synchronous version of open2.

Initializes the codec for encoding/decoding. Must be called before processing frames/packets.

Direct mapping to avcodec_open2().

Parameters ​

codec? ​

Codec | null = null

Codec to open with (null to use already set)

options? ​

Dictionary | null = null

Codec-specific options

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EINVAL: Invalid parameters
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';

const ret = ctx.open2Sync(codec);
FFmpegError.throwIfError(ret, 'open2Sync');
// Codec is now open and ready

See ​

open2 For async version


parametersFromContext() ​

parametersFromContext(params): number

Defined in: src/lib/codec-context.ts:954

Fill parameters from codec context.

Copies codec parameters from context to stream. Used when setting up encoders.

Direct mapping to avcodec_parameters_from_context().

Parameters ​

params ​

CodecParameters

Destination codec parameters

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EINVAL: Invalid parameters

Example ​

typescript
import { FFmpegError } from 'node-av';

const ret = ctx.parametersFromContext(stream.codecpar);
FFmpegError.throwIfError(ret, 'parametersFromContext');

See ​

parametersToContext For the reverse


parametersToContext() ​

parametersToContext(params): number

Defined in: src/lib/codec-context.ts:927

Fill codec context from parameters.

Copies codec parameters from stream to context. Used when setting up decoders.

Direct mapping to avcodec_parameters_to_context().

Parameters ​

params ​

CodecParameters

Source codec parameters

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EINVAL: Invalid parameters

Example ​

typescript
import { FFmpegError } from 'node-av';

const ret = ctx.parametersToContext(stream.codecpar);
FFmpegError.throwIfError(ret, 'parametersToContext');

See ​

parametersFromContext For the reverse


receiveFrame() ​

receiveFrame(frame): Promise<number>

Defined in: src/lib/codec-context.ts:1078

Receive decoded frame.

Gets a decoded frame from the decoder. Call after sendPacket().

Direct mapping to avcodec_receive_frame().

Parameters ​

frame ​

Frame

Frame to receive into

Returns ​

Promise<number>

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Need more input
  • AVERROR_EOF: All frames have been output
  • AVERROR_EINVAL: Invalid decoder state

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';

const ret = await ctx.receiveFrame(frame);
if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
  // No frame available
} else {
  FFmpegError.throwIfError(ret, 'receiveFrame');
  // Process decoded frame
}

See ​

sendPacket To send packets for decoding


receiveFrameSync() ​

receiveFrameSync(frame): number

Defined in: src/lib/codec-context.ts:1114

Receive decoded frame synchronously. Synchronous version of receiveFrame.

Gets a decoded frame from the decoder. Call after sendPacketSync().

Direct mapping to avcodec_receive_frame().

Parameters ​

frame ​

Frame

Frame to receive into

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Need more input
  • AVERROR_EOF: All frames have been output
  • AVERROR_EINVAL: Invalid decoder state

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';

const ret = ctx.receiveFrameSync(frame);
if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
  // No frame available
} else {
  FFmpegError.throwIfError(ret, 'receiveFrameSync');
  // Process frame
}

See ​

receiveFrame For async version


receivePacket() ​

receivePacket(packet): Promise<number>

Defined in: src/lib/codec-context.ts:1219

Receive encoded packet.

Gets an encoded packet from the encoder. Call after sendFrame().

Direct mapping to avcodec_receive_packet().

Parameters ​

packet ​

Packet

Packet to receive into

Returns ​

Promise<number>

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Need more input
  • AVERROR_EOF: All packets have been output
  • AVERROR_EINVAL: Invalid encoder state

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';

const ret = await ctx.receivePacket(packet);
if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
  // No packet available
} else {
  FFmpegError.throwIfError(ret, 'receivePacket');
  // Process encoded packet
}

See ​

sendFrame To send frames for encoding


receivePacketSync() ​

receivePacketSync(packet): number

Defined in: src/lib/codec-context.ts:1255

Receive encoded packet synchronously. Synchronous version of receivePacket.

Gets an encoded packet from the encoder. Call after sendFrameSync().

Direct mapping to avcodec_receive_packet().

Parameters ​

packet ​

Packet

Packet to receive into

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Need more input
  • AVERROR_EOF: All packets have been output
  • AVERROR_EINVAL: Invalid encoder state

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN, AVERROR_EOF } from 'node-av';

const ret = ctx.receivePacketSync(packet);
if (ret === AVERROR_EAGAIN || ret === AVERROR_EOF) {
  // No packet available
} else {
  FFmpegError.throwIfError(ret, 'receivePacketSync');
  // Process packet
}

See ​

receivePacket For async version


sendFrame() ​

sendFrame(frame): Promise<number>

Defined in: src/lib/codec-context.ts:1149

Send frame to encoder.

Submits raw frame for encoding. Call receivePacket() to get encoded packets.

Direct mapping to avcodec_send_frame().

Parameters ​

frame ​

Frame | null

Frame to encode (null to flush)

Returns ​

Promise<number>

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Must receive packets first
  • AVERROR_EOF: Encoder has been flushed
  • AVERROR_EINVAL: Invalid encoder state
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN } from 'node-av';

const ret = await ctx.sendFrame(frame);
if (ret === AVERROR_EAGAIN) {
  // Need to receive packets first
} else {
  FFmpegError.throwIfError(ret, 'sendFrame');
}

See ​

receivePacket To get encoded packets


sendFrameSync() ​

sendFrameSync(frame): number

Defined in: src/lib/codec-context.ts:1184

Send frame to encoder synchronously. Synchronous version of sendFrame.

Submits raw frame for encoding. Call receivePacketSync() to get encoded packets.

Direct mapping to avcodec_send_frame().

Parameters ​

frame ​

Frame | null

Frame to encode (null to flush)

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Must receive packets first
  • AVERROR_EOF: Encoder has been flushed
  • AVERROR_EINVAL: Invalid encoder state
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN } from 'node-av';

const ret = ctx.sendFrameSync(frame);
if (ret === AVERROR_EAGAIN) {
  // Need to receive packets first
  ctx.receivePacketSync(packet);
}

See ​

sendFrame For async version


sendPacket() ​

sendPacket(packet): Promise<number>

Defined in: src/lib/codec-context.ts:1008

Send packet to decoder.

Submits encoded data for decoding. Call receiveFrame() to get decoded frames.

Direct mapping to avcodec_send_packet().

Parameters ​

packet ​

Packet | null

Packet to decode (null to flush)

Returns ​

Promise<number>

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Must receive frames first
  • AVERROR_EOF: Decoder has been flushed
  • AVERROR_EINVAL: Invalid decoder state
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN } from 'node-av';

const ret = await ctx.sendPacket(packet);
if (ret === AVERROR_EAGAIN) {
  // Need to receive frames first
} else {
  FFmpegError.throwIfError(ret, 'sendPacket');
}

See ​

receiveFrame To get decoded frames


sendPacketSync() ​

sendPacketSync(packet): number

Defined in: src/lib/codec-context.ts:1043

Send packet to decoder synchronously. Synchronous version of sendPacket.

Submits compressed data for decoding. Call receiveFrameSync() to get decoded frames.

Direct mapping to avcodec_send_packet().

Parameters ​

packet ​

Packet | null

Packet to decode (null to flush)

Returns ​

number

0 on success, negative AVERROR on error:

  • AVERROR_EAGAIN: Must receive frames first
  • AVERROR_EOF: Decoder has been flushed
  • AVERROR_EINVAL: Invalid decoder state
  • AVERROR_ENOMEM: Memory allocation failure

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AVERROR_EAGAIN } from 'node-av';

const ret = ctx.sendPacketSync(packet);
if (ret === AVERROR_EAGAIN) {
  // Need to receive frames first
  ctx.receiveFrameSync(frame);
}

See ​

sendPacket For async version


setFlags() ​

setFlags(...flags): void

Defined in: src/lib/codec-context.ts:1300

Set codec flags.

Sets one or more flags using bitwise OR. Allows setting multiple flags without manually performing bitwise operations.

Parameters ​

flags ​

...AVCodecFlag[]

One or more flag values to set

Returns ​

void

Example ​

typescript
import { AV_CODEC_FLAG_QSCALE, AV_CODEC_FLAG_PSNR } from 'node-av/constants';

// Set multiple flags at once
codecContext.setFlags(AV_CODEC_FLAG_QSCALE, AV_CODEC_FLAG_PSNR);

See ​


setFlags2() ​

setFlags2(...flags): void

Defined in: src/lib/codec-context.ts:1383

Set codec flags2.

Sets one or more flags2 values using bitwise OR. Allows setting multiple flags without manually performing bitwise operations.

Parameters ​

flags ​

...AVCodecFlag2[]

One or more flag2 values to set

Returns ​

void

Example ​

typescript
import { AV_CODEC_FLAG2_FAST } from 'node-av/constants';

// Set multiple flags2 at once
codecContext.setFlags2(AV_CODEC_FLAG2_FAST);

See ​


setHardwarePixelFormat() ​

setHardwarePixelFormat(hwFormat, swFormat?): void

Defined in: src/lib/codec-context.ts:1276

Set hardware pixel format.

Configures hardware acceleration pixel formats. Used in get_format callback for hardware decoding.

Parameters ​

hwFormat ​

AVPixelFormat

Hardware pixel format

swFormat? ​

AVPixelFormat

Software pixel format (optional)

Returns ​

void

Example ​

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

ctx.setHardwarePixelFormat(AV_PIX_FMT_CUDA, AV_PIX_FMT_NV12);

setOption() ​

Set an option on this object.

Uses the AVOption API to set options. Available options depend on the specific object type.

Direct mapping to av_opt_set* functions.

Param ​

name

Option name

Param ​

value

Option value

Param ​

type

Option type; when omitted, the option's declared type is looked up via av_opt_find and the value converted accordingly

Param ​

searchFlags

Search flags (default: AV_OPT_SEARCH_CHILDREN)

Example ​

typescript
import { FFmpegError } from 'node-av';
import { AV_OPT_TYPE_STRING, AV_OPT_TYPE_INT64, AV_OPT_TYPE_RATIONAL, AV_OPT_TYPE_PIXEL_FMT } from 'node-av/constants';

// Untyped - the option's declared type is inferred
let ret = obj.setOption('preset', 'fast');
FFmpegError.throwIfError(ret, 'set preset');

ret = obj.setOption('codec', 'h264', AV_OPT_TYPE_STRING);
FFmpegError.throwIfError(ret, 'set codec');

// Integer options
ret = obj.setOption('bitrate', 2000000, AV_OPT_TYPE_INT64);
FFmpegError.throwIfError(ret, 'set bitrate');

ret = obj.setOption('threads', 4, AV_OPT_TYPE_INT);
FFmpegError.throwIfError(ret, 'set threads');

// Complex types with proper types
ret = obj.setOption('framerate', {num: 30, den: 1}, AV_OPT_TYPE_RATIONAL);
FFmpegError.throwIfError(ret, 'set framerate');

ret = obj.setOption('pix_fmt', AV_PIX_FMT_YUV420P, AV_OPT_TYPE_PIXEL_FMT);
FFmpegError.throwIfError(ret, 'set pixel format');

Call Signature ​

setOption(name, value): number

Defined in: src/lib/option.ts:1066

Parameters ​
name ​

string

value ​

string | number | bigint | boolean | null | undefined

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1067

Parameters ​
name ​

string

value ​

string

type ​

AVOptionTypeString

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1068

Parameters ​
name ​

string

value ​

string

type ​

AVOptionTypeColor

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1071

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeInt

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1072

Parameters ​
name ​

string

value ​

bigint

type ​

AVOptionTypeInt64

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1073

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeUint

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1074

Parameters ​
name ​

string

value ​

bigint

type ​

AVOptionTypeUint64

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1075

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeFlags

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1076

Parameters ​
name ​

string

value ​

boolean

type ​

AVOptionTypeBool

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1077

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeDuration

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1078

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeConst

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1081

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeDouble

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1082

Parameters ​
name ​

string

value ​

number

type ​

AVOptionTypeFloat

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1085

Parameters ​
name ​

string

value ​

IRational

type ​

AVOptionTypeRational

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1086

Parameters ​
name ​

string

value ​

IRational

type ​

AVOptionTypeVideoRate

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1087

Parameters ​
name ​

string

value ​

AVPixelFormat

type ​

AVOptionTypePixelFmt

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1088

Parameters ​
name ​

string

value ​

AVSampleFormat

type ​

AVOptionTypeSampleFmt

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1089

Parameters ​
name ​

string

value ​

IDimension

type ​

AVOptionTypeImageSize

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1090

Parameters ​
name ​

string

value ​

number | bigint

type ​

AVOptionTypeChLayout

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1091

Parameters ​
name ​

string

value ​

Buffer

type ​

AVOptionTypeBinary

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1092

Parameters ​
name ​

string

value ​

number[]

type ​

AVOptionTypeBinaryIntArray

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption

Call Signature ​

setOption(name, value, type, searchFlags?): number

Defined in: src/lib/option.ts:1093

Parameters ​
name ​

string

value ​

Dictionary

type ​

AVOptionTypeDict

searchFlags? ​

AVOptionSearchFlags

Returns ​

number

Inherited from ​

OptionMember.setOption