On Sun, 26 Feb 2012, Martin Storsjö wrote:

The way I recommend doing it (the way I'm doing it in an external segmenter of mine) is opening one single muxer, initializing it once, and either closing/reopening the AVIOContext or using a custom AVIOContext that writes the data into separate files. When switching to a new segment file, you can set the resend_headers option to 1, to make the muxer write all the necessary headers when writing the next packet.

FWIW, a quick modification of the segmenter muxer is available on https://github.com/mstorsjo/ffmpeg/commits/segmenter. This probably breaks some of the more exotic format cases you have, but makes it behave (for this aspect) kind of in the same way as I use it in my own segmenter.

I also tried cleaning it up not to use lavf internal functions (like oc->oformat->write_packet) directly but creating separate streams properly - making it use chained muxers properly, just like I was instructed to do when I created the RTSP muxer using chained RTP muxers a few years ago (a design that I appreciate later on).

This also includes a mostly demonstrational hack for changing the segmenter not to write the header/trailer to any of the segment files, which is one part of how it should behave if using it for smooth streaming.

// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to