[MPlayer-dev-eng] Nut startcodes
Ville Saari
114263 at foo.bar.org
Wed Apr 28 12:26:58 CEST 2004
On Tue, Apr 27, 2004 at 01:15:03PM +0200, Michael Niedermayer wrote:
> > It might be useful for the specification to require, that every stream
> > must have at least one keyframe between any two startcodes. This would
> > ensure that you never need to start more than two startcodes before X.
> that requirement has sideeffects, like causing very few startcodes, which is
> problematic for seeking & error recovery
The seeking can't make use of any more startcodes than there are keyframes in
the most sparsely keyframed stream.
I there are excess startcodes, then the frame-accurate seeking becomes harder.
Starting from one startcode, finding that it leads past the seek point without
keyframe and trying again form the previous startcode is O(N^2). Keeping
startcodes rare keeps N small.
Another approach would be to store the max keyframe distance in the stream
header. Then no matter how many startcodes there are, the frame accurate
seeker could always choose the last one before position in time that is
seek_position-max(max_keyframe_distance for all streams). It might optimize
by first trying the one before seek_position, but if it fails, it can
fallback directly to the one that is guaranteed to work without need to
try all the intermediate ones.
And in that case only the max keyframe distance of the streams actually
being played would matter. Some very sparsely keyframed subtitle stream
would not hamper seeking if it is not used (The equivalent for
max_keyframe_distance in subtile streams would be the duration of the
longest frame).
--
Ville
More information about the MPlayer-dev-eng
mailing list