diff mbox

[FFmpeg-devel,RFC/PATCH] ffmpeg: Warn if thousands of frames are duplicated

Message ID 201611040019.50181.cehoyos@ag.or.at
State Accepted
Commit 5a4935c012fd3ca7cc0720897cf00c5759307ced
Headers show

Commit Message

Carl Eugen Hoyos Nov. 3, 2016, 11:19 p.m. UTC
Hi!

Not sure if this really helps but ffmpeg can duplicate an enormous 
amount of frames without any notice to the user.

Please comment, Carl Eugen
From fdecd0309a111d2faca2fcffc95583276a4e826f Mon Sep 17 00:00:00 2001
From: Carl Eugen Hoyos <cehoyos@ag.or.at>
Date: Fri, 4 Nov 2016 00:16:51 +0100
Subject: [PATCH] ffmpeg: Warn if thousands of frames are duplicated.

Fixes ticket #5194.
---
 ffmpeg.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Carl Eugen Hoyos Nov. 3, 2016, 11:20 p.m. UTC | #1
2016-11-04 0:19 GMT+01:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:

> Not sure if this really helps but ffmpeg can duplicate an enormous
> amount of frames without any notice to the user.

> Fixes ticket #5194.

Locally changed to #5193.

Carl Eugen
Michael Niedermayer Nov. 4, 2016, 1:41 a.m. UTC | #2
On Fri, Nov 04, 2016 at 12:20:54AM +0100, Carl Eugen Hoyos wrote:
> 2016-11-04 0:19 GMT+01:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:
> 
> > Not sure if this really helps but ffmpeg can duplicate an enormous
> > amount of frames without any notice to the user.
> 
> > Fixes ticket #5194.
> 
> Locally changed to #5193.

LGTM

thx

[...]
Carl Eugen Hoyos Nov. 4, 2016, 1:34 p.m. UTC | #3
2016-11-04 2:41 GMT+01:00 Michael Niedermayer <michael@niedermayer.cc>:
> On Fri, Nov 04, 2016 at 12:20:54AM +0100, Carl Eugen Hoyos wrote:
>> 2016-11-04 0:19 GMT+01:00 Carl Eugen Hoyos <cehoyos@ag.or.at>:
>>
>> > Not sure if this really helps but ffmpeg can duplicate an enormous
>> > amount of frames without any notice to the user.
>>
>> > Fixes ticket #5194.
>>
>> Locally changed to #5193.
>
> LGTM

Patch applied.

Thank you, Carl Eugen
diff mbox

Patch

diff --git a/ffmpeg.c b/ffmpeg.c
index 3b91710..130ae8a 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -126,6 +126,7 @@  static int64_t getmaxrss(void);
 
 static int run_as_daemon  = 0;
 static int nb_frames_dup = 0;
+static unsigned dup_warning = 1000;
 static int nb_frames_drop = 0;
 static int64_t decode_error_stat[2];
 
@@ -1134,6 +1135,10 @@  static void do_video_out(OutputFile *of,
         }
         nb_frames_dup += nb_frames - (nb0_frames && ost->last_dropped) - (nb_frames > nb0_frames);
         av_log(NULL, AV_LOG_VERBOSE, "*** %d dup!\n", nb_frames - 1);
+        if (nb_frames_dup > dup_warning) {
+            av_log(NULL, AV_LOG_WARNING, "More than %d frames duplicated\n", dup_warning);
+            dup_warning *= 10;
+        }
     }
     ost->last_dropped = nb_frames == nb0_frames && next_picture;