Function: dtsPredict()
dtsPredict(
packet,stream,state):DtsPredictState
Defined in: src/lib/utilities.ts:1331
Predict and update DTS timestamps for demuxed packets.
This is a native implementation of FFmpeg's ist_dts_update(). It predicts the next DTS based on codec type and stream metadata, handling both audio (sample-based) and video (frame-rate-based) timing.
Parameters
packet
Native Packet
stream
Native Stream
state
Current DTS prediction state
Returns
Updated state with new DTS values
Example
typescript
const newState = dtsPredict(packet, stream, {
sawFirstTs: false,
dts: AV_NOPTS_VALUE,
nextDts: AV_NOPTS_VALUE,
firstDts: AV_NOPTS_VALUE,
});