[Libav-user] Help to understand PTS, DTS, timebase
leandro.ribeiro.moreira at gmail.com
Tue Nov 14 03:27:22 EET 2017
Thanks again, Carl.
>I may miss something but I believe now your pts are wrong,
>I suspect a B-frame is shown first.
In my fictional model, I thought the I frame (frame-0) would come first and
then the two B frames (frame-1,frame-2) and finally the P frame (frame-3)
I hope this is now fixed, assuming we chose a timebase of 1/75 (with a
timescale of 75). Given that our video runs at 25 FPS, therefore, we'll
need to increase our PTS in 75/30 (timescale/FPS) = 3 PTS per frame.
FRM 0 1 2 3
FRT I B B P
PTS 0 1 2 3
DTS 0 3 2 2
PTT 0 0.04 0.08 0.12 (PTS * timebase)
As far as I understood we could pick any time base to calculate the
PTS_TIME, for instance, let's use the timebase 1/15360 (timescale of
15360) which gives 512 ticks per frame (on a 30 FPS video).
Frame #0 PTS=0<but it could be any initial number> PTS_TIME=0
Frame #1 PTS=512 PTS_TIME= 512/15360 = 0.0333
Frame #2 PTS=1024 PTS_TIME= 1024/15360 = 0.066
Frame #2 PTS=1536 PTS_TIME=1536/15360 = 0.1
Frame #29 PTS=14848 PTS_TIME=14848/15360 = 0.966
When we look at MPEGTS we can see that they used 90K as timescale (or
1/90k) for some, apparently, hardware reasons but in all the other cases,
can I just pick any number to be my timescale?
On Mon, Nov 13, 2017 at 10:33 PM Carl Eugen Hoyos <ceffmpeg at gmail.com>
> 2017-11-14 1:27 GMT+01:00 Leandro Moreira <
> leandro.ribeiro.moreira at gmail.com>:
> > Thanks, Carl!!!
> >> PTS 0 1 2 3 (when it needs to be present, order)
> >> DTS 0 3 1 1(when it needs to be decoded)
> > Yes =(, you're right, it was supposed to be DTS 0 3 1 2
> > (assuming 0 is an I-Frame, 1 and 2 were a B-Frames that
> > depend on 3 and 3 is P-Frame).
> I may miss something but I believe now your pts are wrong,
> I suspect a B-frame is shown first.
> I cannot really answer your other questions but I know that
> H.264 streams exist for which FFmpeg is unable to produce
> correct timestamps.
> (The specification is apparently non-trivial.)
> Please fix your quoting, do not mix quoting-styles!
> Carl Eugen
> Libav-user mailing list
> Libav-user at ffmpeg.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user