[Libav-user] Is AVSteam.duration accurate enough?

Robert Krüger krueger at lesspain.de
Wed Feb 26 13:54:00 CET 2014


On Wed, Feb 26, 2014 at 1:21 PM, YIRAN LI <mrfun.china at gmail.com> wrote:
> Hi,
>
> Can anyone help to explain which duration is more accurate.
>
> 1. duration from the avstream object
> 2. read out all packets from that avstream, find the max pts.

3. read out all packets from that avstream and add all durations in
most cases (I do not remember where there were cases when duration was
not reliable but I think there were some)

The reliability of 1 differs a lot with the formats and for some even
with the properties of individual files. For some it is normally exact
and for others it is just an estimate which can be completely wrong.

Solution #2 may fail if you have timestamp discontinuities like e.g.
in transport streams IIRC.


More information about the Libav-user mailing list