[Libav-user] Switching codecs from encode to playback on the fly

Bruce Wheaton bruce at spearmorgan.com
Mon May 7 06:09:42 CEST 2012


On May 6, 2012, at 12:36 PM, Alex Cohn wrote:
> > Good question. The intent is to seamlessly move from ingesting a movie and viewing it to playing back. I can't find a way to access the same movie for playback as it's being ingested (that would work fine too), can't tell which media container might support that even. So my workaround was to get frames, cache them for playback and record at the same time.
> >
> > I was hoping to use all the same structures to minimize the interruption as I switch between modes. It was more the time to set up the new structures - opening the movie file etc. that was a pain, and having to have a double set of structures that will bloat my playback code.
> >
> > Bruce
> 
> Can you describe your intended usage in some kind of very high level pseudocode?
> 
> 

Umm, I think so:

Open movie for encode and playback (or stream)

for each source movie frame {
    pass to display function
    encode and pass to movie for saving

    if (lastFrame) {
        finalizeMovie
	switch to playback mode
     }
} while !lastFrame

for each frame on disk (allowing seek and shuttle now) {
     pass to display function
}

Sorta.

It's that changeover, and making it quick and clean I'm wondering about. Whether I should just treat it, from an ffmpeg point of view, as a completely separate step. Since all the movie details are already know in the encoding, I was wondering if I could use that.

Bruce




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20120506/29bdedba/attachment.html>


More information about the Libav-user mailing list