How to Fix ‘Past Duration Too Large’ Error in FFmpeg?

FFmpeg is a free to use and open source program that is used for handling Video, Audio, and other multimedia streams. The program has been designed to handle command line based handling of processing of video and audio files. However, quite recently, a lot of reports have been coming in of a “Past Duration Too Large” Error while encoding or downscaling a video.

FFmpeg Logo

What Causes the “Past Duration Too Large” Error in FFmpeg?

After receiving numerous reports from multiple users, we decided to investigate the issue and devised a set of solutions to completely rectify it. Also, we looked into the reasons due to which this error is triggered and listed them as follows:

  • Input Framerate Missing: In most cases, the issue is caused due to the input framerate not being entered for the images. This results in the program assuming that the input framerate is 25 fps which can cause problems if that is not the case.
  • Sync Settings not Implemented: With most users, implementing certain sync settings fixed the issue. Sometimes, the frames might not get synced properly due to which certain frames might be dropped and this error might be triggered.

Now that you have a basic understanding of the nature of the issue, we will move on towards the solutions. Make sure to implement these in the specific order in which they are presented to avoid conflict.

Solution 1: Adding Input Frames

If the input framerate of the video hasn’t been added it might result in some frames getting dropped and the error is triggered. Therefore, in this step, we will be adding the input frames for that:

  1. Observe the convocation that you used to convert the video, it might be on similar to the following
    ffmpeg -i %05d.png -r 24 -c:v libx264 -crf 5 out.mkv
  2. Now simply add the framerate to the convocation used as follows
    ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv
  3. Check to see if the issue persists.

Solution 2: Using Sync Flags

Adding the Sync flags can help sync the output and the input video according to the video’s initial framerates. Therefore, If the sync commands haven’t been added, it is possible that the frames aren’t being synced properly. In this step, we will be adding the sync commands

  1. At this stage, you must probably be using the following convocation
    ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv
  2. However, instead of this, use the following convocation
    ffmpeg -framerate 24 -i %05d.png -c:v libx264 -crf 5 out.mkv -async 1 -vsync 1
  3. Note that we have just added the “-async 1 -vsync1” to the convocation and this needs to be added at the end of the convocation that you are using.
    Note: Your initial convocation might differ from the one used as an example. The changes added to the convocation, however, should not differ.
ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.