[FFmpeg-user] Any Actual Solution to "Past Duration Too Large"?

Gabriel Balaich roderrooder at gmail.com
Tue Apr 17 04:50:30 EEST 2018


Hey all, I'm having an issue with the "Past duration too large" warning
being spammed in my console.

Suggestions range from silencing the console to applying the "fps=xxx"
filter, but when I apply the fps filter it adds stutter to my
video, and silencing my console isn't really an actual solution as I lose
visibility of everything else. For example I can't view what
segment I'm on, or other warnings and error messages that may be important.
Oddly enough I have found that doubling my input framerate and then calling
the actual framerate I want before the output gets rid
of the warning completely:

ffmpeg -y -thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f
dshow -video_size 3440x1440 -rtbufsize 2147.48M ^
-framerate 200 -pixel_format nv12 -i video="Video (00 Pro Capture HDMI
4K+)":audio="SPDIF/ADAT (1+2) (RME Fireface UC)" ^
-map 0:0,0:1 -map 0:1 -c:v h264_nvenc -r 100 -rc-lookahead 200 -forced-idr
1 -strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset: llhp -pix_fmt nv12 -b:v
250M -minrate 250M -maxrate 250M -bufsize 250M ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -af "atrim=0.035, asetpts=PTS-STARTPTS,
aresample=async=250" -vsync 1 -ss 00:00:01.096 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
C:\Users\djcim\Videos\PC\PC\PC%02d.ts

As you can see I have -framerate on the input at 200 and -r on the output
at 100, I have absolutely no idea why this would negate,
hide, or prevent the warning message. And while this has solved my issue
with this specific video input device, it doesn't work with
just any video input device. The Magewell is a really high end card and
allows 200 fps recording at certain resolutions, and while it
doesn't actually support 200 fps at the resolution I am recording I believe
that it's ability to do so at other resolutions is why ffmpeg
is allowing me to set that option in the first place. When I try to do the
same thing with my Elgato capture card it throws an error
and won't even let me start recording, as one would expect:

ffmpeg -y -thread_queue_size 9999 -indexmem 9999 -guess_layout_max 0 -f
dshow -video_size 1920x1080 -rtbufsize 2147.48M ^
-framerate 120 -pixel_format yuyv422 -i video="Game Capture HD60 Pro
(Video) (#01)":audio="ADAT (5+6) (RME Fireface UC)" ^
-map 0:0,0:1 -map 0:1 -c:v h264_nvenc -r 60 -rc-lookahead 120 -forced-idr 1
-strict_gop 1 -sc_threshold 0 -flags +cgop ^
-force_key_frames expr:gte(t,n_forced*2) -preset: llhp -pix_fmt yuv420p
-b:v 40M -minrate 40M -maxrate 40M -bufsize 40M ^
-c:a aac -ar 44100 -b:a 384k -ac 2 -af "pan=mono|c0=c0, adelay=120|120,
aresample=async=250" -vsync 1 ^
-max_muxing_queue_size 9999 -f segment -segment_time 600 -segment_wrap 9
-reset_timestamps 1 ^
C:\Users\djcim\Videos\PC\Camera\CPC%02d.ts

So in the end I have to change -framerate back to 60 in-which the "Past
duration too large" error is spammed at an alarming, and
sometimes even console breaking rate. From what I gather looking at the
source code the error occurs when the delta between
input PTS and output PTS is less than -.06. I'm not entirely sure what that
entails but would there be a way for me to adjust either
the output or input PTS so the threshold is never crossed? I've tried a few
things with setpts but nothing seems to work, I just
really don't have a concrete understanding of PTS and how to adjust them.

With my experience and limited knowledge it would seem the only solutions I
have are:
A) Dispose of my Elgato capture card and purchase another Magewell so I can
double the input framerate.
B) Modify the if statement in the source code and compile FFmpeg myself.

Magewell capture cards are extremely expensive, and while I really wish I
could just double the framerate and be done with it, it is
pretty clear that that is not a conventional or "actual" solution. And
constantly modifying the source code and compiling everything
myself every time I want to update sounds tiresome. I am fairly confident
there is a solution to this but I lack the knowledge, any
help or advice would be much appreciated. Keep in mind that I need to
maintain a constant integer framerate so I can force
keyframes at correct intervals, keep segments at consistent lengths, and
maintain a/v synchronization. Basically, if possible, I'd like
to keep all my existing options but add something to stop, or prevent the
warning message without silencing my console.

Thanks for any help


More information about the ffmpeg-user mailing list