[Ffmpeg-devel] [PATCH] get rid of AVFrac

Michael Niedermayer michaelni
Sat Oct 14 19:36:08 CEST 2006


On Sat, Oct 14, 2006 at 07:01:59PM +0200, Reimar D?ffinger wrote:
> Hello,
> On Fri, Oct 13, 2006 at 09:33:18PM +0200, Michael Niedermayer wrote:
> [...]
> > this doesnt look correct ...
> Hmm.. well, no idea what exactly the old code does and how.
> Here is another try, it's the best I can do without further hints.

ok, so lets see what the code does or is supposed to do (note iam not the
author of that code...)

first the AVStream->pts AVFrac was "set" to 0, (the AV_NOPTS_VALUE from
your patch ismore correct though yes)

next if we encode a packet which has a dts then AVFrac is set to that

after each packet we update AVFrac depending on the _codec_ timebase
or samplerate and framesize for audio
if now a packet has no known dts then we use the value from AVFrac for

so what the code does is it simply fills in missing timestamps on
the encoding side and it does so without rounding errors assuming
constant framerate and a few other things allthough
the usefullness of the whole is questionable (the user app should set
the timestamps and not leave it to lav* to guess something)

your code does:
st->pts= pkt->dts;   -> both AVPacket->dts and AVStream->pts must be in
the same timebase (AVStream->timebase)
st->pts += (int64_t)st->time_base.den * st->codec->time_base.num;
for 1 frame which should be st->pts += 1*codec_timebase/container_timebase

IMHO drop "support" for missing dts on the encoder side completely it makes
no sense at all, its like sending emails with no To: field

Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is

More information about the ffmpeg-devel mailing list