[FFmpeg-user] PCR in mpegts

Andriy Gelman andriy.gelman at gmail.com
Sun May 12 20:36:18 EEST 2019

I just have a question on the use of program clock reference
(PCR) in mpegts. 

>From the wiki page it says: 
"To enable a decoder to present synchronized content, such
as audio tracks matching the associated video, at least once
each 100 ms a program clock reference (PCR) is transmitted
in the adaptation field of an MPEG-2 transport stream
packet."  ...  "For example, the presentation
time stamp (PTS) is intended to be relative to the PCR. The
first 33 bits are based on a 90 kHz clock. The last 9 are
based on a 27 MHz clock. The maximum jitter permitted for
the PCR is +/- 500 ns." 

Looking at libavformat/mpegts.c, I can see that we
periodically decode the pcr value and store it in

But, contrary to the wiki page we do not seem to use this
value after decoding it. To me it looks that the pts/dts
values are set from the PES payload directly. 

Can anyone comment on this? Is the decoding of the PCR just
to conform to the mpegts standard, but the time
synchronization is done on the pts from PES? 
Or did I miss something in the code?   


[1] "MPEGTS transport stream",  https://en.wikipedia.org/wiki/MPEG_transport_stream

More information about the ffmpeg-user mailing list