[Libav-user] How to perform drift compensation in MPEG-2 recorder

Alex Cohn alexcohn at netvision.net.il
Wed Dec 19 17:28:19 CET 2012

On Wed, Dec 19, 2012 at 6:14 PM, Mike Versteeg <mike at mikeversteeg.com> wrote:
>>> video PTS, at least for MPEG-2, increments as integer (0, 1, 2, ...)
>> Oops, my bad... I lost your original requirement to be MPEG-2
>> compliant. But maybe it would be enough to set REPEAT_FIRST_FIELD once
>> in a while.
> Thanks. I am not familiar with that. Won't that introduce a double frame?

No, it is sued to fight interlaced video (a.k.a telecine). The effect
of this flag is that the frame is slowed down by 50%. It should be
good enough to keep a ~30 fps video seamlessly synchronized with the
audio stream that is a bit slower.

> And if that's a trick that works I assume it can only be used to delay my video, what if I need to speed it up?

That's where you can have problems.

> So other formats do support "true" time stamping?

Absolutely. MPEG-4 h264 stream has full support of flexible PTS per
frame, and it will deliver much better quality. But it really needs
more CPU, and you may face questions of licenses, patents, and
royalties for use of different h264 encoders.

Anyway, if you are looking at player support, MPEG-2 is the king. I
hope that other people on this list will have more to share on this


More information about the Libav-user mailing list