<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div>Hi.</div>
<div><br>
</div>
<div>Is there a way to insert a filter into a running filter graph? I¡¯ve tried this:</div>
<div><span style="color:rgb(169,183,198); font-family:"Source Code Pro",monospace; font-size:14.3pt; background-color:rgb(30,31,34)"><br>
</span></div>
<span>avfilter_graph_create_filter(&ctx, filter, "transpose", "dir=1", nullptr, graph);</span>
<div class="elementToProof"><span>auto *target = avfilter_graph_get_filter(graph, "out¡±);    // out is buffersink filter</span></div>
<div><span>avfilter_insert_filter(target->inputs[0], ctx, 0, 0);</span></div>
<div><br>
</div>
<div class="elementToProof">The insertion succeeded but getting a frame from the graph later failed with error code -12. Sometimes getting a frame can succeed with a weird result frame that seems like the pixel layout is wrong, it depends on the insertion target
 position. </div>
<div class="elementToProof">As I know, negotiating formats between filters is an essential step before a graph starts to work, so insertion on the fly may not be permitted, but I cannot find any related document explaining it. </div>
<div class="elementToProof">And what can we do with the "avfilter_insert_filter" API if insertion on the fly is a bad case? It's a public function.</div>
<div><br>
</div>
<div>I think another way around that is inserting all filters at the beginning with some proper ¡°enable commands¡± queued.</div>
<div><br>
</div>
<div>Best wishes!</div>
<div><br>
</div>
<div>Zaijun</div>
</body>
</html>