How to Fix FFmpeg Past Duration Too Large Warning

The FFmpeg warning “Past duration too large” is a common alert indicating a discrepancy in the presentation timestamps of your input file’s video or audio frames. This article explains what this warning means, why it occurs during media processing, and the exact command-line flags you can use to either fix the underlying timestamp issues or safely suppress the warning.

What the Warning Means

FFmpeg uses Presentation Time Stamps (PTS) to determine exactly when each video frame and audio packet should be displayed or played. When you see the “Past duration too large” warning, it means FFmpeg has detected a time gap between the current frame and the previous frame that exceeds its internal threshold.

In most cases, this is not a fatal error. Your output file will usually render successfully, but the warning indicates that the input file has non-standard, variable, or corrupted timing information.

Common Causes

How to Fix and Interpret the Warning

Depending on your goal, you can resolve the warning by fixing the timestamps, forcing a constant frame rate, or suppressing the log output if the rendered video plays correctly.

1. Regenerate Presentation Timestamps

If the source file has corrupted metadata, you can force FFmpeg to ignore the input timestamps and regenerate them from scratch during the demuxing process using the -fflags +genpts option. Place this flag before the input file:

ffmpeg -fflags +genpts -i input.mp4 -c:v libx264 -c:a aac output.mp4

2. Force Constant Frame Rate (CFR)

If the warning is caused by a variable frame rate, forcing FFmpeg to output a constant frame rate will sync the video frames to a strict grid.

In modern versions of FFmpeg, use -fps_mode:

ffmpeg -i input.mp4 -fps_mode cfr output.mp4

For older versions of FFmpeg, use the legacy -vsync flag:

ffmpeg -i input.mp4 -vsync cfr output.mp4

3. Sync Audio to Video

If the warning is accompanied by audio-to-video desynchronization, you can force the audio stream to stretch or squeeze to match the video timestamps using the audio resampling filter:

ffmpeg -i input.mp4 -af aresample=async=1 output.mp4

4. Suppress the Warning

If your output video plays smoothly with no audio sync issues, the warning is harmless. You can prevent FFmpeg from cluttering your terminal by lowering the log level to show only critical errors:

ffmpeg -loglevel error -i input.mp4 output.mp4