You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
fftools/ffmpeg: add support for setting maximum buffered frames in a filtergraph
Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
@ -1384,6 +1384,15 @@ Defines how many threads are used to process a filter pipeline. Each pipeline
|
|||||||
will produce a thread pool with this many threads available for parallel processing.
|
will produce a thread pool with this many threads available for parallel processing.
|
||||||
The default is the number of available CPUs.
|
The default is the number of available CPUs.
|
||||||
|
|
||||||
|
@item -filter_buffered_frames @var{nb_frames} (@emph{global})
|
||||||
|
Defines the maximum number of buffered frames allowed in a filtergraph. Under
|
||||||
|
normal circumstances, a filtergraph should not buffer more than a few frames,
|
||||||
|
especially if frames are being fed to it and read from it in a balanced way
|
||||||
|
(which is the intended behavior in ffmpeg). That said, this option allows you
|
||||||
|
to limit the total number of frames buffered across all links in a filtergraph.
|
||||||
|
If more frames are generated, filtering is aborted and an error is returned.
|
||||||
|
The default value is 0, which means no limit.
|
||||||
|
|
||||||
@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
|
@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
|
||||||
Specify the preset for matching stream(s).
|
Specify the preset for matching stream(s).
|
||||||
|
|
||||||
|
@ -737,6 +737,7 @@ extern float max_error_rate;
|
|||||||
|
|
||||||
extern char *filter_nbthreads;
|
extern char *filter_nbthreads;
|
||||||
extern int filter_complex_nbthreads;
|
extern int filter_complex_nbthreads;
|
||||||
|
extern int filter_buffered_frames;
|
||||||
extern int vstats_version;
|
extern int vstats_version;
|
||||||
extern int print_graphs;
|
extern int print_graphs;
|
||||||
extern char *print_graphs_file;
|
extern char *print_graphs_file;
|
||||||
|
@ -1949,6 +1949,12 @@ static int configure_filtergraph(FilterGraph *fg, FilterGraphThread *fgt)
|
|||||||
fgt->graph->nb_threads = filter_complex_nbthreads;
|
fgt->graph->nb_threads = filter_complex_nbthreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (filter_buffered_frames) {
|
||||||
|
ret = av_opt_set_int(fgt->graph, "max_buffered_frames", filter_buffered_frames, 0);
|
||||||
|
if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
hw_device = hw_device_for_filter();
|
hw_device = hw_device_for_filter();
|
||||||
|
|
||||||
ret = graph_parse(fg, fgt->graph, graph_desc, &inputs, &outputs, hw_device);
|
ret = graph_parse(fg, fgt->graph, graph_desc, &inputs, &outputs, hw_device);
|
||||||
|
@ -75,6 +75,7 @@ int stdin_interaction = 1;
|
|||||||
float max_error_rate = 2.0/3;
|
float max_error_rate = 2.0/3;
|
||||||
char *filter_nbthreads;
|
char *filter_nbthreads;
|
||||||
int filter_complex_nbthreads = 0;
|
int filter_complex_nbthreads = 0;
|
||||||
|
int filter_buffered_frames = 0;
|
||||||
int vstats_version = 2;
|
int vstats_version = 2;
|
||||||
int print_graphs = 0;
|
int print_graphs = 0;
|
||||||
char *print_graphs_file = NULL;
|
char *print_graphs_file = NULL;
|
||||||
@ -1714,6 +1715,9 @@ const OptionDef options[] = {
|
|||||||
{ "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
|
{ "filter_threads", OPT_TYPE_FUNC, OPT_FUNC_ARG | OPT_EXPERT,
|
||||||
{ .func_arg = opt_filter_threads },
|
{ .func_arg = opt_filter_threads },
|
||||||
"number of non-complex filter threads" },
|
"number of non-complex filter threads" },
|
||||||
|
{ "filter_buffered_frames", OPT_TYPE_INT, OPT_EXPERT,
|
||||||
|
{ &filter_buffered_frames },
|
||||||
|
"maximum number of buffered frames in a filter graph" },
|
||||||
#if FFMPEG_OPT_FILTER_SCRIPT
|
#if FFMPEG_OPT_FILTER_SCRIPT
|
||||||
{ "filter_script", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
|
{ "filter_script", OPT_TYPE_STRING, OPT_PERSTREAM | OPT_EXPERT | OPT_OUTPUT,
|
||||||
{ .off = OFFSET(filter_scripts) },
|
{ .off = OFFSET(filter_scripts) },
|
||||||
|
Reference in New Issue
Block a user