<div dir="auto"><div dir="auto"><span style="font-family:sans-serif">I see and whenever I toggle my enable flag I have to recall avfilter_init_str() to make sure filtergraph takes the newest set enable flag right? </span><br></div><br><div class="gmail_quote" dir="auto"><div dir="ltr" class="gmail_attr">On Sat, Feb 6, 2021, 01:00 Paul B Mahol <<a href="mailto:onemda@gmail.com">onemda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 5, 2021 at 10:57 PM ilkercan Kaya <<a href="mailto:canilkerkaya@gmail.com" target="_blank" rel="noreferrer">canilkerkaya@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">There are two APIs to set options, </blockquote><div>Is the other one through a dictionary? I tried to find it through examples but that's all I got. <br><br>Could you tell me the other API so I can try to set the enable flag through there.</div></div></blockquote><div><br></div><div>The one where you concat options as string with values.... might not be friendly.</div><div dir="auto"><br></div><div dir="auto">avfilter_init_str()</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 5, 2021 at 3:25 PM Paul B Mahol <<a href="mailto:onemda@gmail.com" target="_blank" rel="noreferrer">onemda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Feb 5, 2021 at 2:49 AM ilkercan Kaya <<a href="mailto:canilkerkaya@gmail.com" target="_blank" rel="noreferrer">canilkerkaya@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">enable option is also command for every filter that supports timeline. Yes it looks like not documented explicitly.</blockquote>Does this mean that I can set "enable" as an option? if so I tried to do the following before initializing the filter:<br><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:Consolas,monospace;font-size:12pt"><span style="color:rgb(204,120,50)">if </span>((<span style="color:rgb(147,115,165)">res </span>= av_opt_set_int(<span style="color:rgb(147,115,165)">ctx</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"enable"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(104,151,187)">1</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(144,139,37)">AV_OPT_SEARCH_CHILDREN</span>)) == <span style="color:rgb(104,151,187)">0</span>) {<br> <span style="color:rgb(147,115,165)">isOn </span>= <span style="color:rgb(204,120,50)">true;<br></span>} <span style="color:rgb(204,120,50)">else </span>{<br> <span style="color:rgb(147,115,165)">isFxBroken </span>= <span style="color:rgb(204,120,50)">true;<br></span><span style="color:rgb(204,120,50)"> </span><span style="color:rgb(144,139,37)">LOGE</span>(<span style="color:rgb(106,135,89)">"AvFX::activateFilter failed! %s %s"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(147,115,165)">name</span><span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)"> </span>av_err2str(<span style="color:rgb(147,115,165)">res</span>))<span style="color:rgb(204,120,50)">;<br></span>}</pre><div class="gmail_quote"><div dir="ltr" class="gmail_attr">But the call always landed on else with "
AvFX::activateFilter failed! agate Invalid argument"<br>Than I tried the following:<br><pre style="background-color:rgb(43,43,43);color:rgb(169,183,198);font-family:Consolas,monospace;font-size:12pt"><span style="color:rgb(204,120,50)">if </span>((<span style="color:rgb(147,115,165)">res </span>= av_opt_set(<span style="color:rgb(147,115,165)">ctx</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"enable"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(106,135,89)">"1"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(144,139,37)">AV_OPT_SEARCH_CHILDREN</span>)) == <span style="color:rgb(104,151,187)">0</span>) {<br> <span style="color:rgb(147,115,165)">isOn </span>= <span style="color:rgb(204,120,50)">true;<br></span>} <span style="color:rgb(204,120,50)">else </span>{<br> <span style="color:rgb(147,115,165)">isFxBroken </span>= <span style="color:rgb(204,120,50)">true;<br></span><span style="color:rgb(204,120,50)"> </span><span style="color:rgb(144,139,37)">LOGE</span>(<span style="color:rgb(106,135,89)">"AvFX::activateFilter failed! %s %s"</span><span style="color:rgb(204,120,50)">, </span><span style="color:rgb(147,115,165)">name</span><span style="color:rgb(204,120,50)">,<br></span><span style="color:rgb(204,120,50)"> </span>av_err2str(<span style="color:rgb(147,115,165)">res</span>))<span style="color:rgb(204,120,50)">;<br></span>}</pre>This time it did not land on else but this just makes it crash the app when data is passed through the filtergraph with "null pointer deference on libavfilter.so"<br><br>How may I set this enable option through the code?<br></div></div></div></blockquote><div><br></div><div>There is nothing wrong with your code. It is just bug in libavfilter, I posted patch to fix it on devel mailing list.</div><div><br></div><div>There are two APIs to set options, one of them is not much tested and thus it got broken.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr"><br>On Tue, Feb 2, 2021 at 12:52 AM Paul B Mahol <<a href="mailto:onemda@gmail.com" target="_blank" rel="noreferrer">onemda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 1, 2021 at 10:33 PM ilkercan Kaya <<a href="mailto:canilkerkaya@gmail.com" target="_blank" rel="noreferrer">canilkerkaya@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">A simpler solution, if you only need to implement enabling and disabling<br>some of the filters, you can expect the "timeline" support does the<br>trick:</blockquote><div><br></div><div>I looked at timeline support, correct me if I am wrong but it is done through the <b><i>enable_str </i></b>property of <b><i>AVFilterContext</i></b>. It is activated with <i style="font-weight:bold">avfilter_init_str </i>call. This seems like setting the
<b><i>enable_str </i></b>
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.</div></div></blockquote><div><br></div><div>enable option is also command for every filter that supports timeline. Yes it looks like not documented explicitly.</div><div><br></div><div>Just tried it and works.</div><div><br></div><div>mpv crowd_run_1080p50.y4m -vf "lavfi=[sendcmd=2.0 colorcorrect enable 0,colorcorrect=saturation=0]"<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 1, 2021 at 11:10 PM Paul B Mahol <<a href="mailto:onemda@gmail.com" target="_blank" rel="noreferrer">onemda@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">lowpass, highpass and agate on master git version have both timeline and command support.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Feb 1, 2021 at 7:39 PM ilkercan Kaya <<a href="mailto:canilkerkaya@gmail.com" target="_blank" rel="noreferrer">canilkerkaya@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="auto">Hi Everyone, </div><div dir="auto"><br></div>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. <div dir="auto"><br></div><div>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:<br><br>abuffer -> lowpass -> highpass -> agate -> aformat -> abuffersink.<br><br>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).<br><br>What would be the best way to do this?</div><div><br></div><div>Thank you!</div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>
_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank" rel="noreferrer">Libav-user@ffmpeg.org</a><br>
<a href="https://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer noreferrer" target="_blank">https://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br>
To unsubscribe, visit link above, or email<br>
<a href="mailto:libav-user-request@ffmpeg.org" target="_blank" rel="noreferrer">libav-user-request@ffmpeg.org</a> with subject "unsubscribe".</blockquote></div></div>