From 3420e56d9a4a2c947c638087291d5b05ca3870f8 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Tue, 29 Oct 2019 13:05:31 +0100 Subject: [PATCH] avfilter/vf_vfrdet: also report average delta --- doc/filters.texi | 4 ++-- libavfilter/vf_vfrdet.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index c4477e6677..11f715319a 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -18946,8 +18946,8 @@ This filter tries to detect if the input is variable or constant frame rate. At end it will output number of frames detected as having variable delta pts, and ones with constant delta pts. -If there was frames with variable delta, than it will also show min and max delta -encountered. +If there was frames with variable delta, than it will also show min, max and +average delta encountered. @section vibrance diff --git a/libavfilter/vf_vfrdet.c b/libavfilter/vf_vfrdet.c index 051b53babd..abfa19cdcd 100644 --- a/libavfilter/vf_vfrdet.c +++ b/libavfilter/vf_vfrdet.c @@ -29,6 +29,7 @@ typedef struct VFRDETContext { int64_t delta; int64_t min_delta; int64_t max_delta; + int64_t avg_delta; uint64_t vfr; uint64_t cfr; @@ -53,6 +54,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in) s->delta = delta; s->min_delta = FFMIN(delta, s->min_delta); s->max_delta = FFMAX(delta, s->max_delta); + s->avg_delta += delta; } else { s->cfr++; } @@ -81,7 +83,7 @@ static av_cold void uninit(AVFilterContext *ctx) av_log(ctx, AV_LOG_INFO, "VFR:%f (%"PRIu64"/%"PRIu64")", s->vfr / (float)(s->vfr + s->cfr), s->vfr, s->cfr); if (s->vfr) - av_log(ctx, AV_LOG_INFO, " min: %"PRId64" max: %"PRId64")", s->min_delta, s->max_delta); + av_log(ctx, AV_LOG_INFO, " min: %"PRId64" max: %"PRId64" avg: %"PRId64, s->min_delta, s->max_delta, s->avg_delta / s->vfr); av_log(ctx, AV_LOG_INFO, "\n"); }