Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGyan Doshi <ffmpeg@gyani.pro>2020-12-21 11:46:49 +0300
committerGyan Doshi <ffmpeg@gyani.pro>2020-12-22 22:11:07 +0300
commit842714b5cb4112ec6805ed228b34d711024ad9e2 (patch)
tree74ad01f5af35ea046040dc5ead7c8fc310b90e57 /fftools/ffmpeg_opt.c
parent686c07fb1e0455c4205eaad18e8a01bf64058dec (diff)
ffmpeg: add option stats_period
At present, progress stats are updated at a hardcoded interval of half a second. For long processes, this can lead to bloated logs and progress reports. Users can now set a custom period using option -stats_period Default is kept at 0.5 seconds.
Diffstat (limited to 'fftools/ffmpeg_opt.c')
-rw-r--r--fftools/ffmpeg_opt.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c
index 7ee034c9c9..242468fc64 100644
--- a/fftools/ffmpeg_opt.c
+++ b/fftools/ffmpeg_opt.c
@@ -174,6 +174,7 @@ int filter_nbthreads = 0;
int filter_complex_nbthreads = 0;
int vstats_version = 2;
int auto_conversion_filters = 1;
+int64_t stats_period = 500000;
static int intra_only = 0;
@@ -282,6 +283,21 @@ static int opt_abort_on(void *optctx, const char *opt, const char *arg)
return av_opt_eval_flags(&pclass, &opts[0], arg, &abort_on_flags);
}
+static int opt_stats_period(void *optctx, const char *opt, const char *arg)
+{
+ int64_t user_stats_period = parse_time_or_die(opt, arg, 1);
+
+ if (user_stats_period <= 0) {
+ av_log(NULL, AV_LOG_ERROR, "stats_period %s must be positive.\n", arg);
+ return AVERROR(EINVAL);
+ }
+
+ stats_period = user_stats_period;
+ av_log(NULL, AV_LOG_INFO, "ffmpeg stats and -progress period set to %s.\n", arg);
+
+ return 0;
+}
+
static int opt_sameq(void *optctx, const char *opt, const char *arg)
{
av_log(NULL, AV_LOG_ERROR, "Option '%s' was removed. "
@@ -3557,6 +3573,8 @@ const OptionDef options[] = {
"enable automatic conversion filters globally" },
{ "stats", OPT_BOOL, { &print_stats },
"print progress report during encoding", },
+ { "stats_period", HAS_ARG | OPT_EXPERT, { .func_arg = opt_stats_period },
+ "set the period at which ffmpeg updates stats and -progress output", "time" },
{ "attach", HAS_ARG | OPT_PERFILE | OPT_EXPERT |
OPT_OUTPUT, { .func_arg = opt_attach },
"add an attachment to the output file", "filename" },