summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-19 17:21:04 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-19 18:36:36 +0100
commit4e20e94921460f7108ad76dc873417cd15b356c4 (patch)
tree1b341a50520e00a7ceefe5b3092817cf186ea264 /ffmpeg.c
parentc5092025901b37aa5de4f290afb61fc5377eb79d (diff)
ffmpeg: Check duration for overlap and clip in fps cfr/vfr code
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index 3b24cf99da..e51e789b03 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -904,6 +904,13 @@ static void do_video_out(AVFormatContext *s,
sync_ipts = next_picture->pts;
delta0 = sync_ipts - ost->sync_opts;
delta = delta0 + duration;
+ if (delta0 < 0 && delta > 0) {
+ double cor = FFMIN(-delta0, duration);
+ av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
+ sync_ipts += cor;
+ duration -= cor;
+ delta0 += cor;
+ }
/* by default, we output a single frame */
nb0_frames = 0;