[Libav-user] Is it possible to dynamically reconfigure a filter graph?

Michael Bradshaw mbradshaw at sorensonmedia.com
Tue Oct 23 21:03:27 CEST 2012

I'm using avfilter to rescale video (and convert it to the right pixel
format) and convert audio (to the right sample format, sample rate,
and channel_layout) (I'm also buffering audio using asetnsamples to
fill frames with a consistent number of samples). While reading the
source video and source audio, it's possible they change in the
stream. If the source audio stream changes (i.e. sample rate, sample
format, channel_layout), or if the source video stream changes (width,
height, or pixel format), do I have to completely destroy and rebuild
the filter graph? Or is there a way to "update" the source filters to
the new formats and update (without destroying) the filter graph?

My primary concern is that asetnsamples may have some samples
buffered, and destroying and recreating the filter graph would lose
these buffered samples.

Also, if it's possible to update the filters without destroying the
graph and recreating it, would it be possible to change the number of
samples set for asetnsamples? I'm not seeing anything that makes it
look like this is possible, but it's worth double checking.



More information about the Libav-user mailing list