[Libav-user] Help to understand PTS, DTS, timebase
Carl Eugen Hoyos
ceffmpeg at gmail.com
Wed Nov 15 00:44:53 EET 2017
2017-11-14 2:27 GMT+01:00 Leandro Moreira <leandro.ribeiro.moreira at gmail.com>:
> 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
With 0, 3, 2, 1 this is correct.
> PTT 0 0.04 0.08 0.12 (PTS * timebase)
> FRM=frames number
> FRT=frames types
> FTT=PTS time
> 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
I believe this is part of the specification, other containers
may have other restrictions.
Please do not top-post here, Carl Eugen
More information about the Libav-user