Opened 5 years ago

#4293 new enhancement

avformat: optionally write an approximate duration ahead-of-time if possible

Reported by: 11rcombs Owned by:
Priority: wish Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no


This would be useful when writing a format like MKV or MP3 that has a duration in the header that we currently avoid writing until the entire file is finished, for cases where we're writing to an un-seekable output (like a pipe), or where the output is going to be read before it's finished being written. Having a duration, even if it may be somewhat inaccurate, can improve behavior in some players. For ffmpeg.c, this value would be based on the corresponding input streams' durations. The easiest way to implement this would probably be setting AVFormatContext::duration, but I wouldn't be surprised if there were cases where setting the individual AVStream::durations would make more sense. We could also send it as metadata, either at the format or stream level.

Change History (0)

Note: See TracTickets for help on using tickets.