[Libav-user] File container choice

Charles linux2 at orion15.org
Thu Dec 29 19:23:07 EET 2016


Looking for some general guidance on implementing a file reader/writer.

The file will have video (h264) and optionally audio and/or KLV metadata streams.
The recorded file will be from a mpeg 2 TS stream and have audio muxed in if enabled.
Need to be able to seek time/frame and playback fwd/rev at different rates (2x 4x 8x) and pause.
Will have to read from file while writing, periodic, 10 seconds behind the recording.
There can be discontinuous timestamps in the file, i.e. record 60 seconds pause 10 seconds start recording again

Started looking though the demuxing info
https://ffmpeg.org/doxygen/trunk/group__lavf__decoding.html
Most of the operations look pretty ubiquitous and not really dependent on file container.
Based on google hits it appears that getting to the correct seek location is the hard part.

Already found multiple implementations of handling the seek functions and some flags to research.
AVFMT_TS_DISCONT, AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_ANY, AVSEEK_FLAG_BYTE
The code bases reads and writes files so I am somewhat familiar with AVFormatContext, just basic in/out.
My initial thought was to use a .ts file then I could just read and write frames without transcoding.
As the reader reads a frame just forward to the output stream, same for input.

What I have not found is a general discussion of why I should choose 1 file container over another.

Is there any advantage or issues with specific file containers?

Any other input (gotchas) appreciated.

Thanks
Charles












More information about the Libav-user mailing list