Skip to content

node-av / lib / avGuessFrameRate

Function: avGuessFrameRate() ​

avGuessFrameRate(stream): IRational

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

Guess the frame rate of a stream.

Picks between the stream's real base frame rate, its average frame rate and the codec frame rate the way FFmpeg CLI does to configure filters and encoders. A stream whose format context was freed returns 0/1.

Direct mapping to av_guess_frame_rate().

Parameters ​

stream ​

NativeWrapper<NativeStream>

Stream to guess the frame rate of

Returns ​

IRational

Guessed frame rate, or 0/1 if unknown

Example ​

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

const fr = avGuessFrameRate(input.video());
if (fr.num > 0) {
  console.log(`${fr.num / fr.den} fps`);
}

See ​

av_guess_frame_rate - FFmpeg Doxygen