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

Mike Versteeg mike at mikeversteeg.com
Fri Dec 21 09:00:59 CET 2012

>> No. The MPEG-2 encoder seems very picky (possibly part of the
>> protocol) when it comes to that. In fact a time base other than 1/25
>> or 1/30 and it either returns an error or smacks me with an AV. Won't
>> even do 29.97 fps or 50 or 60 fps.
> I'm not talking about frame rate or time base. I'm talking about the unit in which presentation durations are encoded, a factor that makes it possible to encode a continuous variable (time) on an arbitrary fixed point scale that's most suited to the required frame rate. A 1/25 time base (25Hz, 0.04s) would be amount to a frame duration of 24 'ticks' with the standard (QuickTime) timescale of 600/s, or 100 with a timescale of 2500/s . You don't see any difference between the two when watching a video, but with the latter timescale one has more precise control over individual frame timing. I doubt things work differently in libav.

That's my original thought, unfortunately in ffmpeg the PTS is
expressed in units of time_base, and (at least in MPEG-2) that equals
the frame rate. Try anything other than 1/25 or 1/30 and the encoder
refuses to do its job.


More information about the Libav-user mailing list