[FFmpeg-devel] [PATCH] fftools/ffmpeg: add option to hide vsync warnings

Gyan Doshi gyandoshi at gmail.com
Tue Jun 26 13:25:39 EEST 2018


Many users have queried/complained about the 'Past duration too large' 
messages.

Regards,
Gyan
-------------- next part --------------
From 9e265308865455c4a61b0cb65840466b4d575670 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <ffmpeg at gyani.pro>
Date: Tue, 26 Jun 2018 15:42:04 +0530
Subject: [PATCH] fftools/ffmpeg: add option to hide vsync warnings

When transcoding a video stream with a lower-resolution encoding timebase,
ffmpeg log can get bloated with video sync warnings viz.
"Past duration %f too large". These are not actionable for end-users and
can also make the progress readout disappear at times, which is not
desirable, like during a live capture.

Added option -hide_vsync_warning suppresses these messages.
---
 doc/ffmpeg.texi      | 3 +++
 fftools/ffmpeg.c     | 3 ++-
 fftools/ffmpeg.h     | 1 +
 fftools/ffmpeg_opt.c | 3 +++
 4 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 3717f22d42..c3fc449a38 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -1407,6 +1407,9 @@ With -map you can select from which stream the timestamps should be
 taken. You can leave either video or audio unchanged and sync the
 remaining stream(s) to the unchanged one.
 
+ at item -hide_vsync_warning (@emph{global})
+Don't print video sync warnings about frame duration during rate conversion.
+
 @item -frame_drop_threshold @var{parameter}
 Frame drop threshold, which specifies how much behind video frames can
 be before they are dropped. In frame rate units, so 1.0 is one frame.
diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c
index 8d311a9ac8..2e8450cece 100644
--- a/fftools/ffmpeg.c
+++ b/fftools/ffmpeg.c
@@ -1121,7 +1121,8 @@ static void do_video_out(OutputFile *of,
             format_video_sync != VSYNC_PASSTHROUGH &&
             format_video_sync != VSYNC_DROP) {
             if (delta0 < -0.6) {
-                av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
+                if (!hide_vsync_warning)
+                    av_log(NULL, AV_LOG_WARNING, "Past duration %f too large\n", -delta0);
             } else
                 av_log(NULL, AV_LOG_DEBUG, "Clipping frame in rate conversion by %f\n", -delta0);
             sync_ipts = ost->sync_opts;
diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h
index eb1eaf6363..aa46d683c8 100644
--- a/fftools/ffmpeg.h
+++ b/fftools/ffmpeg.h
@@ -606,6 +606,7 @@ extern int frame_bits_per_raw_sample;
 extern AVIOContext *progress_avio;
 extern float max_error_rate;
 extern char *videotoolbox_pixfmt;
+extern int hide_vsync_warning;
 
 extern int filter_nbthreads;
 extern int filter_complex_nbthreads;
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 58ec13e5a8..9a88f6d3e8 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -110,6 +110,7 @@ float max_error_rate  = 2.0/3;
 int filter_nbthreads = 0;
 int filter_complex_nbthreads = 0;
 int vstats_version = 2;
+int hide_vsync_warning = 0;
 
 
 static int intra_only         = 0;
@@ -3382,6 +3383,8 @@ const OptionDef options[] = {
       "add timings for each task" },
     { "progress",       HAS_ARG | OPT_EXPERT,                        { .func_arg = opt_progress },
       "write program-readable progress information", "url" },
+    { "hide_vsync_warning",     OPT_BOOL | OPT_EXPERT,               { &hide_vsync_warning },
+        "don't print video sync warnings" },
     { "stdin",          OPT_BOOL | OPT_EXPERT,                       { &stdin_interaction },
       "enable or disable interaction on standard input" },
     { "timelimit",      HAS_ARG | OPT_EXPERT,                        { .func_arg = opt_timelimit },
-- 
2.12.2.windows.2


More information about the ffmpeg-devel mailing list