diff --git a/doc/filters.texi b/doc/filters.texi index 4ed6d50750..4b74bce34f 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -22193,6 +22193,10 @@ The filter accepts the following options: Set the frames batch size to analyze; in a set of @var{n} frames, the filter will pick one of them, and then handle the next batch of @var{n} frames until the end. Default is @code{100}. + +@item log +Set the log level to display picked frame stats. +Default is @code{info}. @end table Since the filter keeps track of the whole frames sequence, a bigger @var{n} diff --git a/libavfilter/vf_thumbnail.c b/libavfilter/vf_thumbnail.c index f66af760a3..4d6b0aef04 100644 --- a/libavfilter/vf_thumbnail.c +++ b/libavfilter/vf_thumbnail.c @@ -42,6 +42,7 @@ struct thumb_frame { typedef struct ThumbContext { const AVClass *class; int n; ///< current frame + int loglevel; int n_frames; ///< number of frames for analysis struct thumb_frame *frames; ///< the n_frames frames AVRational tb; ///< copy of the input timebase to ease access @@ -58,6 +59,10 @@ typedef struct ThumbContext { static const AVOption thumbnail_options[] = { { "n", "set the frames batch size", OFFSET(n_frames), AV_OPT_TYPE_INT, {.i64=100}, 2, INT_MAX, FLAGS }, + { "log", "force stats logging level", OFFSET(loglevel), AV_OPT_TYPE_INT, {.i64 = AV_LOG_INFO}, INT_MIN, INT_MAX, FLAGS, "level" }, + { "quiet", "logging disabled", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_QUIET}, 0, 0, FLAGS, "level" }, + { "info", "information logging level", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_INFO}, 0, 0, FLAGS, "level" }, + { "verbose", "verbose logging level", 0, AV_OPT_TYPE_CONST, {.i64 = AV_LOG_VERBOSE}, 0, 0, FLAGS, "level" }, { NULL } }; @@ -127,9 +132,10 @@ static AVFrame *get_best_frame(AVFilterContext *ctx) // raise the chosen one picref = s->frames[best_frame_idx].buf; - av_log(ctx, AV_LOG_INFO, "frame id #%d (pts_time=%f) selected " - "from a set of %d images\n", best_frame_idx, - picref->pts * av_q2d(s->tb), nb_frames); + if (s->loglevel != AV_LOG_QUIET) + av_log(ctx, s->loglevel, "frame id #%d (pts_time=%f) selected " + "from a set of %d images\n", best_frame_idx, + picref->pts * av_q2d(s->tb), nb_frames); s->frames[best_frame_idx].buf = NULL; return picref;