[Ffmpeg-devel] PTS and duration in libavformat

Allan Sandfeld Jensen kde
Tue Sep 12 10:28:53 CEST 2006


Hi

I have a few serious bug-reports, but would actual like to know what you 
usually do avoid these problems.

First it seems PTS in general are very unreliable in both libavformat and 
libavcodec. 

* The mpeg12 decoder for instance always returns 0 in frame->pts, not even 
NOPTS, and the packet->pts seems to the timestamps from the mpeg-stream 
although I've never in my life seen a correctly timestamped mpeg stream.

* The mpeg demuxer is worse, and calculates start_time to be some ~300ms and 
duration to be ~400ms for every mpeg I throw at it.

* The avi formats and codecs usually have some kind of PTS, but it gets 
screwed up after a seek in libavformat.

What all this means is that currently I have to use a big switch on what 
formats I send to libavformat and what codecs I send to libavcodec and then 
either calculate pts myself (mpeg), or correct it(avi).
Is this the recommended behavior or are there something simpler?

And how do I calculate the duration of a mpeg stream?

`Allan




More information about the ffmpeg-devel mailing list