[FFmpeg-devel] [Bugreport] and [Patch]: duration of TS streams is wrong when used near 2^33 wrap

Thorsten Jordan tjordan
Mon Oct 29 11:49:02 CET 2007

M?ns Rullg?rd schrieb:
> Thorsten Jordan wrote:
>> Hello,
>> pro: works for this and similar files
>> con: would give still wrong values if the file is longer than 2^33 pts
>> (26.5 hours), but rare case
> It would fail also if the file has random PTS resets, as is quite common
> on DVDs and some TV channels.
yes, but the current function would fail too and report wrong values
anyway in that case.

>> it would not hurt for PS streams, as for PS the PTS is max. 2^32 iirc.
> PS also uses 33-bit PTS.
well it wouldn't hurt then still?

>> The attached patch does that.
> I think this is a problem we shouldn't even be trying to solve.  If you
> really must know the exact duration of the file you'll have to parse
> the whole thing.
> I'm inclined to say that rather than trying to guess the unknown, we should
> simply report the duration of these files as unknown.

that is a point, but as you have said yourself the current function
doesn't give correct values in any case. With the patch it doesn't get
worse at least, but gives results as "good" as the current one, but even
when encountering the wrap.
So if its a guess anyway, we can still try to guess a bit better...

Greetings, Thorsten

More information about the ffmpeg-devel mailing list