[FFmpeg-user] Does avformat_free_context free automatically free associated codec contexts?

Thomas Worth dev at rarevision.com
Fri Jul 15 11:42:20 CEST 2011

avformat.h says this:

 * avformat_free_context() can be used to free the context and
 * everything allocated by the framework within it.

Does that mean that associated codec contexts are freed as well? I am
calling av_free() on the output codec contexts separately, but
sometimes the program crashes at avformat_free_context() when I free
my output format context. If I take out the av_free() calls to the
codec contexts and just call avformat_free_context(), everything seems
to work fine.

Do I need to free the output codec contexts separately or can I rely
on avformat_free_context() to do this for me?

More information about the ffmpeg-user mailing list