diff mbox series

[FFmpeg-devel] modified frame timing, so that we can make sure that a frame is never forward in time with respect to the original one, when converting from VFR to CFR

Message ID 20210318030238.561057-1-jerome@percipient.ai
State New
Headers show
Series [FFmpeg-devel] modified frame timing, so that we can make sure that a frame is never forward in time with respect to the original one, when converting from VFR to CFR | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate fail Make fate failed
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Jerome Berclaz March 18, 2021, 3:02 a.m. UTC
---
 fftools/ffmpeg.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 46bb014de8..8085442156 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1238,8 +1238,9 @@  static void do_video_out(OutputFile *of,
                 nb_frames = 0;
             } else if (delta < -1.1)
                 nb_frames = 0;
-            else if (delta > 1.1) {
-                nb_frames = lrintf(delta);
+            // let the CFR frame go backward by at most one frame duration with respect to the original VFR
+            else if (delta >= 2) {
+                nb_frames = floor(delta);
                 if (delta0 > 1.1)
                     nb0_frames = llrintf(delta0 - 0.6);
             }