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

Uoti Urpala uoti.urpala at pp1.inet.fi
Sun Feb 18 02:08:43 CET 2007

On Sat, 2007-02-17 at 09:45 -0600, John Donaghy wrote:
> So, mimicking this approach I can now get dvr-ms playback working perfectly
> by using the new pts values found in the container as long as I:
> a) set sh_video->fps correctly at the start (which I can do from the
> container alone now), and
> b) change video.c to something like:

This change basically makes it ignore the timestamps for video timing. I
doubt it works quite "perfectly" though, the incorrect timestamps will
still at least mess up av sync.

> If, instead I try to supply missing pts values based on the framerate it
> doesnt always work. The problem arises when the first few timestamps are
> missing in the video stream but not in the audio stream. E.g from the sample
> I posted that only contains intermittent pts values:

> I dont know what pts to assign to those first few video frames because if I
> use (0.00, 0.04, 008..etc) it causes sync issues. The only solution I can
> think of at this point, that doesnt involve a change to video.c, is to
> somehow buffer the first few video frames and then retrospectively set the
> pts values by interpolating downwards after I first the first useful one.

Starting the pts from that of the first audio frame would at least be a
better guess. Are the sync issues caused by starting from 0 any worse
than with the video.c change? I think they should be the same...

>> Exactly how does seeking "not work at all" with -correct-pts?

> The video freezes after a seek but I havent had time to investigate why
> exactly, plus the AV sync is often out with this option.

If you first give video pts 0 and then a big value then the duration of
the frame is taken to be the difference between values. Thus if pts
suddenly jumps from 0 to 200 then the video will "freeze" for 200
seconds. That will also mess up av sync at least temporarily, which is
one possible cause for sync being "often out".

It would be possible to create an explicit mode for known-unreliable pts
with constant-fps video, but I don't want to work on that just now.

More information about the MPlayer-dev-eng mailing list