[Libav-user] Libavfilter - Dynamic filtergraph reconfiguration

Paul B Mahol onemda at gmail.com
Mon Feb 1 23:52:04 EET 2021


On Mon, Feb 1, 2021 at 10:33 PM ilkercan Kaya <canilkerkaya at gmail.com>
wrote:

> A simpler solution, if you only need to implement enabling and disabling
>> some of the filters, you can expect the "timeline" support does the
>> trick:
>
>
> I looked at timeline support, correct me if I am wrong but it is done
> through the *enable_str  *property of *AVFilterContext*. It is activated
> with *avfilter_init_str *call. This seems like setting the *enable_str  *
> evaluation can only be done once without reiniting the whole graph. If this
> is the case, is there a way to  pass a custom variable to the expression so
> that I can switch it on or off? The case in the example at the
> documentation, smartblur is hardcoded to be activated between 10 seconds to
> 3 minutes, in my case I can not foresee when the filter will be turned
> on/off.
>

enable option is also command for every filter that supports timeline. Yes
it looks like not documented explicitly.

Just tried it and works.

mpv crowd_run_1080p50.y4m -vf "lavfi=[sendcmd=2.0 colorcorrect enable
0,colorcorrect=saturation=0]"


>
> On Mon, Feb 1, 2021 at 11:10 PM Paul B Mahol <onemda at gmail.com> wrote:
>
>> lowpass, highpass and agate on master git version have both timeline and
>> command support.
>>
>> On Mon, Feb 1, 2021 at 7:39 PM ilkercan Kaya <canilkerkaya at gmail.com>
>> wrote:
>>
>>> Hi Everyone,
>>>
>>> I am making a mobile music app where the user can add multiple different
>>> FXS at runtime to current playing music through a two dimensional pad with
>>> an effects header. I am using FFmpeg, libavfilter in C++ to add multiple FX
>>> to the audio.
>>>
>>> My problem is, the user can disable any of the FX's I am using at any
>>> time as they wish, the effects I use are agate, lowpass, highpass. The
>>> graph is:
>>>
>>> abuffer -> lowpass -> highpass -> agate -> aformat -> abuffersink.
>>>
>>> From time to time, I want to disable some of the following  lowpass,
>>> highpass, agate. So I thought I could just reconfigure the graph and
>>> basically get rid of links to fulfil my wish. I am not sure this is the
>>> right way to do it tho. I tried to dig online but all I could find was a
>>> thread from 2012 with no conclusion. Libavfilter documentation doesn't say
>>> anything about reconfigure or reset existing filtergraph (of that I could
>>> find).
>>>
>>> What would be the best way to do this?
>>>
>>> Thank you!
>>> _______________________________________________
>>> Libav-user mailing list
>>> Libav-user at ffmpeg.org
>>> https://ffmpeg.org/mailman/listinfo/libav-user
>>>
>>> To unsubscribe, visit link above, or email
>>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>>
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/libav-user
>>
>> To unsubscribe, visit link above, or email
>> libav-user-request at ffmpeg.org with subject "unsubscribe".
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/libav-user
>
> To unsubscribe, visit link above, or email
> libav-user-request at ffmpeg.org with subject "unsubscribe".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20210201/57c3867f/attachment.html>


More information about the Libav-user mailing list