How to Detect Variable Frame Rate (VFR) with FFprobe
Variable Frame Rate (VFR) causes significant audio sync and playback issues in video editing software, making detection a critical step in media workflows. This guide explains how to use FFprobe to inspect video stream metadata and analyze frame presentation timestamps to definitively determine whether a video file utilizes Variable Frame Rate or Constant Frame Rate (CFR).
Method 1: The Quick Metadata Check
The fastest way to check for VFR is to compare the stream's reported
nominal frame rate (r_frame_rate) with its average frame
rate (avg_frame_rate).
Run the following command:
ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate,avg_frame_rate -of default=noprint_wrappers=1 input.mp4Interpreting the Output
- Constant Frame Rate (CFR): Both values will be
identical (e.g.,
r_frame_rate=30/1andavg_frame_rate=30/1). - Variable Frame Rate (VFR): The values will differ
(e.g.,
r_frame_rate=30/1andavg_frame_rate=29.412/1).
While a mismatch confirms VFR, matching values can occasionally produce false negatives if container metadata is incomplete. For 100% accuracy, analyze individual frames.
Method 2: Inspecting Frame Durations (Accurate Method)
To verify frame timing directly from the encoded frames, inspect the duration of each packet. In a true CFR video, every frame has the exact same duration.
Run the following command on Linux or macOS:
ffprobe -v error -select_streams v:0 -show_entries frame=pkt_duration_time -of csv=p=0 input.mp4 | sort -uOn Windows Command Prompt (cmd):
ffprobe -v error -select_streams v:0 -show_entries frame=pkt_duration_time -of csv=p=0 input.mp4 | sort /uniqueInterpreting the Output
- Constant Frame Rate (CFR): The output returns a
single unique value (for example,
0.033333for a 30 fps video). - Variable Frame Rate (VFR): The output lists multiple different durations, confirming that frame lengths vary across the timeline.
Method 3: Inspecting Timestamp Differences
If the container does not explicitly store duration per frame, you
can read the presentation timestamps (pkt_pts_time):
ffprobe -v error -select_streams v:0 -show_entries frame=pkt_pts_time -of csv=p=0 input.mp4In a CFR file, the numerical difference between each consecutive timestamp remains constant across the entire stream. In a VFR file, the difference between consecutive timestamps fluctuates.