<p>On May 6, 2012 7:32 PM, "Bruce Wheaton" <<a href="mailto:bruce@spearmorgan.com">bruce@spearmorgan.com</a>> wrote:<br>
><br>
> On May 5, 2012, at 9:16 PM, Alex Cohn wrote:<br>
><br>
> > On May 6, 2012 6:28 AM, "Bruce Wheaton" <<a href="mailto:bruce@spearmorgan.com">bruce@spearmorgan.com</a>> wrote:<br>
> > ><br>
> > > Is it possible to open codecs for encoding, and use them to encode a complete piece, then, on the fly (when the complete clip had already been encoded) switch over and use them to decompress the same media?<br>

> > ><br>
> > > I'm flexible on which codecs, although I like MP4 for being LGPL and good at multi-threading.<br>
> > ><br>
> ><br>
> > To the best of my knowledge, encoders and decoders are completely separate. But nothing can prevent you from creating both at initialization time, and using the encoder or decoder whenever you need that.<br>
> ><br>
> Thanks. I wasn't really aware of that distinction. Ah, I see. avcodec_find_decoder versus avcodec_find_encoder.<br>
><br>
> Then I suppose the question becomes, can I use the same AVFormatContext with encoders and decoders… and use the same AVStreams?<br>
><br>
> Bruce</p>
<p>They were never designed for such reuse; but even if you could, what kind of profit would you gain? These objects are negligebly small compared to video data you must cache anyway.</p>
<p>Alex</p>