[FFmpeg-devel] [PATCH] avfilter/select: evaluate silencedetect metadata
Gyan Doshi
ffmpeg at gyani.pro
Fri Jun 18 15:35:39 EEST 2021
On 2021-06-18 17:27, Timo Rothenpieler wrote:
> On 18.06.2021 13:46, Gyan Doshi wrote:
>>
>>
>> On 2021-06-18 17:02, Timo Rothenpieler wrote:
>>> On 18.06.2021 06:19, Gyan Doshi wrote:
>>>> Instead of a specific option for silencedetect, it would be
>>>> future-proof if it was an option called, say, metadata with a
>>>> constant for silencedetect to start with.
>>>> There are multiple per-frame analysis filters like blackframe,
>>>> blackdetect, freezedetect..etc and it will be easier to just extend
>>>> 'metadata' with new constants
>>>> than to add a new option for each filter.
>>>
>>> The only issue I see with that is a loss of flexibility.
>>> I does not seem like you can pass parameters to variables in the
>>> expression syntax.
>>> So there would need to be two new parameters for the select filter
>>> itself.
>>> The start and the end marker metadata name.
>>>
>>> But what if a user wanted to combine multiple detection filters?
>>> I guess chaining multiple select filters would work, but can be
>>> pretty annoying, depending on the usecase.
>>>
>> Yes, ideally, we would associate a function for metadata that allows
>> it to be used flexibly within the expr.
>>
>> See how drawtext text parameter can accommodate various functions.
>> There's a limited example (last one) at
>> http://www.ffmpeg.org/ffmpeg-filters.html#Examples-62
>
> The drawtext filter does not use expression evaluation for its text
> parameter.
> It implements its own logic for that, and it's purely text-replace.
>
> The expression parser does support functions, but only functions with
> one or two numeric arguments.
> So it'll have to be something like detected(silence) and then silence
> is a constant numeric variable that the detected function resolves to
> the specific metadata names.
Yeah, so I guess this patch can go ahead as-is, and I'll look into
extending eval with a metadata(key) function for a generic facility.
Regards,
Gyan
More information about the ffmpeg-devel
mailing list