Kevin, I've just been looking through this. I don't really understand the libavformat stuff, but I think we _may_ have a memory leak. You call av_mallocz() to get storage space for an output context. I'm not sure this ever gets free'd. Does the av_close_input() in the deinit do that for us? - thor