[MPlayer-users] How to find out "timestamps" of a mpeg stream?

Josef Wolf jw at raven.inka.de
Mon Feb 10 22:58:32 CET 2003


On Mon, Feb 10, 2003 at 11:51:22PM +0100, Arpi wrote:

Ough! I'm _very_ impressed how fast you answered! Thanks!

> > This too does the job. In addition, it is much faster. But starting
> > at 1MB before the end of file seems to be strange. What would be a
> yes it's strange but for example mpegtv (quite old mpeg1 player) and
> libmpeg3 (that thing used by xmovie and broadcast2000, not libmpeg2!)
> do the same.

So I'm not the only one who came up with such a kludge ;-))

> > good choice to guarantee that at least one complete frame would be
> > "played"?
> the only better way imho is implementing a reverse demuxer, some code
> which starts at the lasy byte and search backward for PS packet start codes,
> then parse out the (optional) PTS timestamp. repeat this step until you get
> a valid PTS.

Sounds very complicated :) I think I will stick with the kludgy
solution. But the question remains: is 1MB from the end of the file
a good choice? I think the amount should depend at least on the
frame-resolution and/or the bitrate.

> but also note, that some mpegs (especially vobs from dvd) has wrap-around
> timestamps, so they may restart from zero at some chapter boundaries

Yes, I remember you already said this. Do they _always_ restart at
chapter boundaries or do they sometimes restart in the middle of some
chapter? If the latter, then decoding just the first and last frames
will not be sufficient. Instead, all the frames need to be decoded and
the results must be checked for discontinuities.

Hmmm, is it really needeed to _decode_ the frames to get the time
stamps? If it would be possible to get the timestamp without actually
decode the stream, that would speed up things greatly, too.

> or some edit (mainly for multiangle discs) positions.

Can this happen when a specific angle (-dvdangle X) is choosen? And
even when no -dvdangle is used, mplayer always plays one _specific_
angle.

> so actually no clean, fast and stable method exists :(

I see... But maybe a good trade-off could be made somehow?

-- 
-- Josef Wolf -- jw at raven.inka.de --



More information about the MPlayer-users mailing list