[Libav-user] Getting older PTS

wm4 nfxjfg at googlemail.com
Wed Apr 30 12:05:09 CEST 2014


On Tue, 29 Apr 2014 12:13:01 -0700
J Decker <d3ck0r at gmail.com> wrote:

> On Tue, Apr 29, 2014 at 3:26 AM, Abhishek Maniyar <
> abhishek.maniyar at springcomputing.in> wrote:
> 
> > Hello Everyone,
> >
> > I am trying to connect to RTSP using FFMPEG library in iOS.
> >
> > I am using TCP. Some times in poor network conditions, packets with older
> > PTS received. Is it possible in FFMPEG to get a packet with PTS is sequence
> > 10,11,12,13,7,8,9,….. Should FFMPEG not discard packets those are older den
> > current packet?
> >
> I had the same sort of sequential PTS in some videos; another place to
> ignore that and use your own frame count based PTS... like MP4 clips come
> in ticks, mkv come in milliseconds in the PTS and some are sequential
> counts (avi)  and even playing from disk I got backwards numbers

Seems like you don't understand timestamps at all.

First, PTS can go backwards on the packet level. This is because some
codecs reorder frames on decoding. Packet PTS are in encoded order, not
in display order, and the decoder will reorder the PTS to display order
for you (just like it reorders the decoded pictures). See AVFrame
fields for more info.

Second, timestamps in ffmpeg are always relative to a timebase. The
timebase tells you in what units the PTS values are in. You just divide
the PTS by the timebase, and you get the time in seconds. The
demuxer will tell you the timebase; see AVStream.time_base.


More information about the Libav-user mailing list