[FFmpeg-user] PTS resolution

Gyan Doshi ffmpeg at gyani.pro
Tue Feb 23 09:46:34 EET 2021



On 23-02-2021 12:40 pm, Mark Filipak (ffmpeg) wrote:
> On 2021-02-23 01:38, Carl Zwanzig wrote:
>>
>> You missed mentioning the program clock reference (PCR) of the -ts. 
>> -And- many references to PTS directly say that it's contained in a 
>> -ts (which if the -ts contains a -ps, is correct).
>
> The answers are in a GIF illustration (not text) in the H.262 spec, so 
> searching the PDF doesn't find any hits. From the GIF,
>
> In the encoder:
> STC (System Time Clock) is 27MHz.
> PTC is (STC counter value)+(fixed buffer delay) that's written into 
> the PS at the start of each frame. [1]
> PCR (Program Clock Reference) is (STC counter value) that's written 
> into the TS (in the muxer) every 100ms.
> In the decoder:
> STC (System Time Clock) is 27MHz.
> There are no counters in the decoder. There's a STC-PTS comparator to 
> signal new frames and a STC-PCR comparator to control the STC's phase 
> lock loop.
>
> [1] Why the GIF leaves out the by-300 PTS divider is a mystery, but I 
> know it exists (i.e., PTS resolution = 1/(27MHz/300).

Our demuxer/muxer only read the top 33-bits (so TB is set at 90kHz). The 
bottom 9-bits are ignored, last time I checked. There's 6 bits of 
padding in between.

>>
>>
>>> The question is: What does ffmpeg use as its TB in the decoder and
>>> pipeline?

There is no fixed timebase used by ffmpeg. Decoders will set timebase of 
emitted frames based on the bitsteam. Filters will use that unless they 
set it based on user input or processing.
As a fallback when not set, modules may usually set it to 1/1000000.

Regards,
Gyan


More information about the ffmpeg-user mailing list