[MPlayer-dev-eng] libmpeg2 and lavc don't agree on PTS values

Uoti Urpala uoti.urpala at pp1.inet.fi
Sun Nov 26 23:38:03 CET 2006


On Sun, 2006-11-26 at 12:40 -0800, Trent Piepho wrote:
> I've spent hours trying to get a 2-pass filter working correctly until I
> finally figured out it's not my fault.  It's either lavc's fault or
> libmpeg2's fault!

The decoders do not track pts directly.

> This is the first few frames of an ATSC ts stream as decoded with -vc
> mpeg12, listing pts value, frame type, and mean qscale value:

> This is the same file with -vc ffmpeg2:

> You see the frame type and mean qscale match exactly, but the pts values
> have been shifted down by one.

Without -correct-pts mplayer (or mencoder) does not handle decoder lag
correctly. Probably libmpeg2 and ffmpeg12 have different decoder lag for
some reason and thus give different results.

If you try using -correct-pts with the internal or lavf mpeg demuxer it
probably won't work right (though lavf can work for some videos),
basically because those demuxers behave badly (internal has hacky
special cases different from other demuxers and the lavf mpeg demuxer
doesn't calculate any pts values for some frames). Muxing the mpeg video
to a container such as Matroska (with another program which gives it
correct timestamps) and then playing it with "mplayer -correct-pts -vc
ffmpeg12 file.mkv" would probably have the best chance of using correct
timestamps...

> So... which one is right?  And which one has audio sync off by one frame?

I wouldn't bet on either being right :)




More information about the MPlayer-dev-eng mailing list