[Libav-user] [libav-api] Is it possible in some codec that AVFrame.pts is not derived from AVPacket.pts?

Anton Khirnov anton at khirnov.net
Fri May 25 13:54:50 CEST 2012


On Thu, 24 May 2012 14:12:08 +0300, Andrey Utkin <andrey.krieger.utkin at gmail.com> wrote:
> Is that right or wrong that at some cases the frame pts (reachable
> after decoding) is _not_ derived from packet pts/dts (reachable after
> demux), but is encapsulated in the coded frame itself?

What pts do you mean? AVFrame.pkt_pts should always be exactly equal to
AVPacket.pts of the packet that was used to produce this frame.

AVFrame.pts is AFAIK currently not set to anything useful for decoding.
If some codec stores timestamps inside codec data, they could in theory
be exported there.

Justin has also suggested using it for audio to allow properly handling
decoder delay.

> In other words, can elementary AVStream have its own internal
> timestamps besides the timestamps provided by media container? If such
> situation may have place, is that the case for MPEGTS container and
> video codecs h264, mpeg2, audio codecs aac, mp3, ac3?
> Practical question is: can i safely join videos of same
> characteristics by keyframe bounds, just by remuxing it and altering
> AVPacket pts/dts?
> 

"Safely" depends on the codec details i think, but mostly yes, as long
as you're careful to verify that they are indeed the same.

-- 
Anton Khirnov


More information about the Libav-user mailing list