[FFmpeg-devel] [PATCH] avfilter/select: evaluate silencedetect metadata

Timo Rothenpieler timo at rothenpieler.org
Fri Jun 18 14:57:03 EEST 2021


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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4494 bytes
Desc: S/MIME Cryptographic Signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20210618/0acf2268/attachment.bin>


More information about the ffmpeg-devel mailing list