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.
This commit is contained in:
parent
686c07fb1e
commit
842714b5cb
@ -675,14 +675,19 @@ Specify the preset for matching stream(s).
|
||||
Print encoding progress/statistics. It is on by default, to explicitly
|
||||
disable it you need to specify @code{-nostats}.
|
||||
|
||||
@item -stats_period @var{time} (@emph{global})
|
||||
Set period at which encoding progress/statistics are updated. Default is 0.5 seconds.
|
||||
|
||||
@item -progress @var{url} (@emph{global})
|
||||
Send program-friendly progress information to @var{url}.
|
||||
|
||||
Progress information is written approximately every second and at the end of
|
||||
Progress information is written periodically and at the end of
|
||||
the encoding process. It is made of "@var{key}=@var{value}" lines. @var{key}
|
||||
consists of only alphanumeric characters. The last key of a sequence of
|
||||
progress information is always "progress".
|
||||
|
||||
The update period is set using @code{-stats_period}.
|
||||
|
||||
@anchor{stdin option}
|
||||
@item -stdin
|
||||
Enable interaction on standard input. On by default unless standard input is
|
||||
|
@ -1699,7 +1699,7 @@ static void print_report(int is_last_report, int64_t timer_start, int64_t cur_ti
|
||||
last_time = cur_time;
|
||||
return;
|
||||
}
|
||||
if ((cur_time - last_time) < 500000)
|
||||
if ((cur_time - last_time) < stats_period)
|
||||
return;
|
||||
last_time = cur_time;
|
||||
}
|
||||
|
@ -614,6 +614,7 @@ extern int debug_ts;
|
||||
extern int exit_on_error;
|
||||
extern int abort_on_flags;
|
||||
extern int print_stats;
|
||||
extern int64_t stats_period;
|
||||
extern int qp_hist;
|
||||
extern int stdin_interaction;
|
||||
extern int frame_bits_per_raw_sample;
|
||||
|
@ -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" },
|
||||
|
Loading…
x
Reference in New Issue
Block a user