Detect Variable Frame Rate in FFmpeg Using vfrdet

This article provides a quick guide on how to use the vfrdet (Variable Frame Rate Detector) filter in FFmpeg to determine whether a video stream has a constant or variable frame rate. You will learn the exact command-line syntax required to run the filter and how to interpret its console output to identify the frame rate characteristics of your media files.

What is the vfrdet Filter?

The vfrdet filter is an internal FFmpeg video filter designed to inspect a video stream and calculate the consistency of its frame timestamps. By analyzing the time differences between consecutive frames, it determines whether the video is Constant Frame Rate (CFR) or Variable Frame Rate (VFR). Identifying VFR media is highly beneficial because variable frame rates can often cause audio-video desynchronization issues in video editing software.

How to Run the vfrdet Command

To analyze a video file with the vfrdet filter, run the following command in your terminal. This command processes the video using the filter and discards the video output using the null muxer, which allows the analysis to complete quickly without creating a new file:

ffmpeg -i input.mp4 -vf vfrdet -f null -

Replace input.mp4 with the path to the video file you want to test.

Understanding the Output

Once FFmpeg finishes scanning the file, look at the very end of the console output. You will see a line generated by the filter that looks like this:

[Parsed_vfrdet_0 @ 0x55efca3bc2c0] VFR:0.000000 (0/14982)

The output contains two key metrics:

If the VFR ratio is 0.000000, your stream is CFR. If the ratio is higher than 0.000000, the stream is VFR.