[MPlayer-users] improving mplayer seek mpg2

Heitzso heitzso at growthmodels.com
Fri Jul 15 22:08:57 CEST 2005


I've had to get mplayer seeking better for a project
and ran into another minor tweak that I'm passing along ...

In libmpdemux/demux_mpg.c around line 519 you'll
see precision initialized to '1'.  Bumping that up to '2'
helps significantly for some cases. 

Note I'm needing good seek in mpg2 files with empty
VOBs (build from transcode/ffmpeg) that are about an
hour long each.  Most of the time precision == 1
worked fine.  However, occassionally it messed up by
up to 30 seconds or so.  Bumping precision up to 2
(forcing another iteration of looking for a good seek
position) helped the remaining odd cases.

---

The other code mod I did I reported on several weeks
ago.  mplayer backs up from end of file and looks for
the last pts, but if there is no pts in that chunk of media
that it is scanning it gave up and approx. based on reported
max bit rate, but reported max bit rate easily off by factor of 2
versus actual bit rate in vbr file. 
I (poorly) fixed by backing up 1500000
instead of 500000 bytes.  Problem with that fix
is I'm not checking to see if I've gone past
the beginning of the file.  Also those figures have nothing
to do with bit rate, etc.  Someone else noted that the
correct fix would be to start building a lookup table of
pts/seek positions (or something similar) so code isn't
banging around in the file crudely looking for things.

In any case, I believe I'm getting seeks within bounds
of GOF/key frame type seeks, and nature of beast is
you're not going to seek within a GOF.  The fix there
is to re-encode with fewer frames in a GOF.  (If I'm
using the terminology correctly -- I apologize if off,
I'm a newbie with this stuff).

Heitzso




More information about the MPlayer-users mailing list