[Ffmpeg-devel] wrong stream duration and pkt.pts

Thanos Kyritsis djart
Fri Apr 28 16:32:59 CEST 2006


I've noticed a considerable amount of media files (including avi and 
mp3 files), for which ffmpeg reports wrong duration times and wrong 
pkt.pts value for some or the majority of frames.

There are cases where duration is simply wrong, for example double of 
what it really is (i.e. 8 minutes instead of 4) and some cases where 
duration is a crazy negative number:

Input #0, avi, from 'foobar.avi':
  Duration: -577014:-32:-22.-2, start: -2077252342.-775776, bitrate: N/A
  Stream #0.0, 25.00 fps(r): Video: mpeg4, yuv420p, 688x528
  Stream #0.1: Audio: mp3, 48000 Hz, stereo, 192 kb/s

And this is a typical pkt.pts dump for the first frames of one of these 

pkt.pts: 0
pkt.pts: -9223372036854775808
pkt.pts: 2
pkt.pts: -9223372036854775808
pkt.pts: -9223372036854775808
pkt.pts: 5
pkt.pts: -9223372036854775808
pkt.pts: -9223372036854775808
pkt.pts: 8
pkt.pts: -9223372036854775808
pkt.pts: -9223372036854775808
pkt.pts: 11
pkt.pts: -9223372036854775808
pkt.pts: -9223372036854775808
pkt.pts: 14
pkt.pts: -9223372036854775808
pkt.pts: -9223372036854775808
pkt.pts: 17
pkt.pts: -9223372036854775808

(notice there are some frames with correct values among the others).

The result is that mainly seeking does not work good. 
You cannot be sure of how av_seek_frame() will behave, and even writing 
extra source code for doing a workaround on those 'minus infinitive' 
values will not produce the best performance solution.

It's the media files' fault, right ? Probably corrupted, containing 
error frames or something. But can something be done for them ?

Thanos Kyritsis <djart at linux.gr>

- What's your ONE purpose in life ?
- To explode, of course! ;-)

More information about the ffmpeg-devel mailing list