[MPlayer-users] playing, stopping, seeking

Arpi arpi at thot.banki.hu
Sat Jul 13 02:32:02 CEST 2002


Hi,

> > I start my mplayer playing an mpeg2 file without seeking to any position.
> > Then I stop it. Not pause it. I really shut it down.
> > And now I want to restart mplayer with seeking at the correct position.
> > -ss doesn't work, because one second i type in the command line is not one
> > second in the mpeg file. The difference between -ss 40 and -ss 41 is about
> > 5 seconds. So i cannot just check the time it was running.
> > How can I seek to the position I was?
> Btw. Arpi seeking in (S)VCD  and DVD seems really broken, eg. on Harry Potter 
> DVD I wnated to seek to 0h 54mins (-ss 00:54:00) and it instead seeked to 2h 
> 48mins. I think mplayer gets confused by VOB or Track changes.

-ss for mpeg is inaccurate, very much.
for DVD, it's even worse, actually it is not implemented at all, only
inaccurate relative seek works, but absolute seek is a relative seek
from zero :)

the current way of mpeg seeking is using the bitrate field and time position
to calculate byte position, and then read stream til next keyframe.
but there are problems with this:
- that bitrate is for video only - it doesn't count audio. for DVD wiht many
audio track or high bitrate ac3 audio it does matter a lot
- many files has bad value in the bitrate field, or the file is true VBR, so
no bitrate at all
so, it means that +-10s may be +-2s or +-40s, depending on how accurate the
bitrate field is, how much audio, padding and other data is there...

i don't know any way to do accurate seeking in mpeg files.
i can imagine 2 ways, none of them is good:
- use the timestamps, problem is that timestamp counter resets/jumps
sometimes, especially on DVD discs and edited/cutted mpeg files.
- build index for mpeg file, just like with avi files - very slow.

anyway i don't plan to "fix" it, -ss shouldn't be assumed to be accurate,
not only for mpeg, but for avi and asf too. for mpeg, maybe -sb is better.

maybe we could add another option, like -ass (accurate seek by seconds) and
-asf (acc. seek by frame), which starts null playing and skips the given
amount of frames before displays/encodes something. it is slow as hell, but
if you really want it...


A'rpi / Astral & ESP-team

--
Developer of MPlayer, the Movie Player for Linux - http://www.MPlayerHQ.hu




More information about the MPlayer-users mailing list