[MPlayer-dev-eng] Re: [PATCH] dvr-ms fixes for pts, key frame detection and seeking

John Donaghy johnfdonaghy at gmail.com
Wed Feb 7 19:50:52 CET 2007

> agree. I considered your previous patch as seriously overkill, and I
> trusted
> you would find the right timestamps ;)

On the subject of these timestamps I discovered, I'm hoping Nico (or anyone
else for that matter) can help me here.

Firstly, the timestamps dont start at zero (they are perhaps relative to the
last time the channel was changed or something like that).

Also, the timestamps arent in chronological order (as you'd expect since the
frames arent either). But if I feed these timestamp values straight into the
decoder then I get warnings (from video.c) about "Invalid frame duration".

TO make it more complicated, in some samples I have, the timestamps in the
video stream only appear in I-frames which means a couple of things:

- you dont know the timestamp of all frames encountered before the first
- at the point where you find the first I-frame timestamp you still dont
know the average frame time
- so you cant assign timestamps to B and P frames until you've found the 2nd
I-frame and
  then used it to calculate the average

So, given that the raw timestamps dont seem to work and that fact that in
some cases only I-frame timestamps are present, it seems to me that the only
thing I can do is to calculate an average frametime and use that value in
conjunction with the I-frame timestamps to assign a *usable* timestamp to
all B and P frames.

The problem with this is that I either have to

1) throw everything away (including audio) until I find the second I-frame,
or else

2) I'd need to keep a list of all frames read somewhere and assign the
timestamps once I've got the average, then pass then to the decoder.

Do either of these options seem sensible or is there a better way?



More information about the MPlayer-dev-eng mailing list