[Libav-user] Does AVFilterGraph support insertion on the fly

Hao Tsai zaijunhao at outlook.com
Wed Jun 22 07:19:23 EEST 2022


Hi.

Is there a way to insert a filter into a running filter graph? I’ve tried this:

avfilter_graph_create_filter(&ctx, filter, "transpose", "dir=1", nullptr, graph);
auto *target = avfilter_graph_get_filter(graph, "out”);    // out is buffersink filter
avfilter_insert_filter(target->inputs[0], ctx, 0, 0);

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.
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.
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.

I think another way around that is inserting all filters at the beginning with some proper “enable commands” queued.

Best wishes!

Zaijun
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20220622/bd223b8b/attachment.htm>


More information about the Libav-user mailing list