node-av / api / DemuxerOptions
Interface: DemuxerOptions<F>
Defined in: src/api/demuxer.ts:155
Options for Demuxer opening.
Type Parameters
F
F extends DemuxerFormat | string & object = DemuxerFormat | string & object
Properties
bufferSize?
optionalbufferSize?:number
Defined in: src/api/demuxer.ts:164
Buffer size for reading/writing operations.
This option allows you to specify the buffer size used for I/O operations.
Default
65536configure?
optionalconfigure?: (context) =>void
Defined in: src/api/demuxer.ts:264
Configure the underlying format context just after the input is opened.
Called with the input FormatContext after avformat_open_input and avformat_find_stream_info (so the streams are available) and before any packets are read. Use it to inspect or tweak the open input context or its streams directly. Most input-side tuning (probesize, analyzeduration, protocol options, …) is better passed via DemuxerOptions.options, which is applied at open time.
Parameters
context
Returns
void
Example
await Demuxer.open('input.mp4', {
configure: (fmt) => {
console.log(`Opened ${fmt.streams.length} streams`);
},
});copyTs?
optionalcopyTs?:boolean
Defined in: src/api/demuxer.ts:232
Copy timestamps from input to output.
When enabled, timestamps are passed through without modification. This disables most timestamp discontinuity corrections except for PTS wrap-around detection in discontinuous formats.
Matches FFmpeg CLI's -copyts option.
Default
falsedtsDeltaThreshold?
optionaldtsDeltaThreshold?:number
Defined in: src/api/demuxer.ts:207
DTS delta threshold in seconds.
Timestamp discontinuity detection threshold for formats with AVFMT_TS_DISCONT flag. When DTS delta exceeds this value, it's considered a discontinuity.
Matches FFmpeg CLI's -dts_delta_threshold option.
Default
10dtsErrorThreshold?
optionaldtsErrorThreshold?:number
Defined in: src/api/demuxer.ts:219
DTS error threshold in seconds.
Timestamp discontinuity detection threshold for continuous formats (without AVFMT_TS_DISCONT). When DTS delta exceeds this value, it's considered a timestamp error.
Matches FFmpeg CLI's -dts_error_threshold option.
Default
108000 (30 hours)format?
optionalformat?:F
Defined in: src/api/demuxer.ts:175
Force specific input format.
Use this to specify the input format explicitly instead of auto-detection. Useful for raw formats like 'rawvideo', 'rawaudio', etc.
When given as a literal (e.g. 'mov'), options is strongly typed to that demuxer's known options plus the generic AVFormatContext options.
options?
optionaloptions?:DemuxerOptionsFor<F>
Defined in: src/api/demuxer.ts:243
FFmpeg format options passed directly to the input.
Key-value pairs of FFmpeg AVFormatContext / demuxer-private / protocol options, passed to avformat_open_input(). When format is a known literal, these are typed to that demuxer's options (autocomplete + value typing); arbitrary keys remain allowed so protocol options (e.g. rtsp_transport) still pass.
signal?
optionalsignal?:AbortSignal
Defined in: src/api/demuxer.ts:274
AbortSignal for cancellation.
When aborted, async generators stop yielding and async methods throw AbortError. The demux thread is stopped automatically. Aborting also fires the native interrupt callback, unblocking a blocking open (e.g. an unresponsive RTSP source) or a stalled av_read_frame().
skipStreamInfo?
optionalskipStreamInfo?:boolean
Defined in: src/api/demuxer.ts:185
Skip reading stream information on open.
If true, stream info (codecs, formats, etc.) will not be read during opening. This can speed up opening time for certain use cases where stream info is not needed.
Default
falsestartWithKeyframe?
optionalstartWithKeyframe?:boolean
Defined in: src/api/demuxer.ts:195
Start reading packets from the first keyframe.
When enabled, all packets before the first keyframe will be skipped. Useful for seeking and trimming operations.
Default
false