[FFmpeg-devel] [PATCH v3] ffmpeg: parameters for filter thread counts

Paul B Mahol onemda at gmail.com
Sun Oct 30 23:13:48 EET 2016


On 10/30/16, DeHackEd <git at dehacked.net> wrote:
> On 10/30/2016 12:09 PM, Paul B Mahol wrote:
>> On 10/30/16, DeHackEd <git at dehacked.net> wrote:
>>> Enables specifying how many threads are available to each filtergraph.
>>> ---
>>> v2->v3:
>>> - Typos in docs fixed
>>>
>>> v1->v2:
>>> - Reworded documentation
>>> - Removed hunk from ffmpeg_filter.c not directly applicable to patch
>>>
>>>  doc/ffmpeg.texi | 10 ++++++++++
>>>  ffmpeg.h        |  3 +++
>>>  ffmpeg_filter.c |  7 +++++++
>>>  ffmpeg_opt.c    |  4 ++++
>>>  4 files changed, 24 insertions(+)
>>>
> ...
>>> diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
>>> index 4d25fff..dc94380 100644
>>> --- a/ffmpeg_opt.c
>>> +++ b/ffmpeg_opt.c
>>> @@ -3365,12 +3365,16 @@ const OptionDef options[] = {
>>>          "set profile", "profile" },
>>>      { "filter",         HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, {
>>> .off = OFFSET(filters) },
>>>          "set stream filtergraph", "filter_graph" },
>>> +    { "filter_threads",  HAS_ARG | OPT_INT,                          {
>>> &filter_nbthreads },
>>> +        "number of non-complex filter threads" },
>>>      { "filter_script",  HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, {
>>> .off = OFFSET(filter_scripts) },
>>>          "read stream filtergraph description from a file", "filename" },
>>>      { "reinit_filter",  HAS_ARG | OPT_INT | OPT_SPEC | OPT_INPUT,    {
>>> .off
>>> = OFFSET(reinit_filters) },
>>>          "reinit filtergraph on input parameter changes", "" },
>>>      { "filter_complex", HAS_ARG | OPT_EXPERT,                        {
>>> .func_arg = opt_filter_complex },
>>>          "create a complex filtergraph", "graph_description" },
>>> +    { "filter_complex_threads", HAS_ARG | OPT_INT,                   {
>>> &filter_complex_nbthreads },
>>> +        "number of threads for -filter_complex" },
>>>      { "lavfi",          HAS_ARG | OPT_EXPERT,                        {
>>> .func_arg = opt_filter_complex },
>>>          "create a complex filtergraph", "graph_description" },
>>>      { "filter_complex_script", HAS_ARG | OPT_EXPERT,                 {
>>> .func_arg = opt_filter_complex_script },
>>> --
>>> 1.8.4.1
>>>
>>> _______________________________________________
>>> ffmpeg-devel mailing list
>>> ffmpeg-devel at ffmpeg.org
>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>>
>>
>> How this plays out with number of threads one can set for each filter
>> instance?
>
> Each individual filter uses MIN(filter_specific_limit, filtergrpah_limit)
> threads, but regardless the filtergraph will
> create filtergraph_limit threads each time. This patch adds user control to
> the filtergraph_limit.
>
> My main motivation for this parameter is a system I have with 80 CPUs
> (including hyperthreads). The video filtering
> workload does not benefit from so many threads being created or used, and I
> suffer from a significant ulimit hit and
> greater difficulty debugging.

Idea sounds fine, I will leave code review to someone else.

>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>


More information about the ffmpeg-devel mailing list