Fix Past duration too large error in FFmpeg

FFmpeg is an open-source tool that is used by billions of people around the world for processing audio, video, and other multimedia content.

This command-line program often generates Past Duration Too Large error during the downscaling or encoding video content. One of the users who experienced a similar problem reported the issue on StackOverflow.

When encoding H.264 using ffmpeg I get the following type of warnings:  Past duration 0.603386 too large

What do they mean? I have not found anything clear online or in the ffmpeg documentation.

It seems like it is a warning message rather than an error that appears when you try to encode a high frame rate file to a low frame rate output.

The framerates are dropped in that case. Today, we will show how you can get rid of this warning message.


How do I fix the Past duration too large error in FFmpeg?

1. Set the input frame rate

set input frame rate FFmpeg Past Duration Too Large error

  1. The problem might appear if the input frames are missing from the video and it can cause some frames to drop.
    • You need to add the input frames to fix the issue.
  2. Look at the call that you are using for video conversion.
    • It should be similar to this one:
      • ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv
  3. You need to separately mention the input and output framerate in the following manner:
    • ffmpeg -framerate 25 -i %05d.png -r 10 -c:v libx264 -crf 5 out.mkv

The issue should disappear because the encoding is now done for 161/400 images. The system will delete the rest of the images.

However, if the problem still persists head towards the second solution.


2. Add Sync Flags

add sync flags FFmpeg Past Duration Too Large error

  1. Right now, you might be using the call mentioned below: ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv
  2. If yes, you might be missing sync commands and it might trigger the error.
  3. Add the -async 1 -vsync1 synchronization commands in order to synchronize the video input and video output:
    • ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv -async 1 -vsync 1

The situation can be frustrating if you are unable to encoding or downscaling a video. It is important to find a quick solution in that case.

Make sure that you are correctly following each and every step to fix this problem. Let us know in the comments section below if our solutions helped you to fix this issue.


Was this page helpful?
Thanks for letting us know!
Get the most from your tech with our daily tips
Tell us why!

Comments are closed.