In mpegts, is there any relation between PCR and PTS? I mean, why should we provide PCR and what value should be assigned as PCR?
In some posts I saw that PCR can be calculated from PTS, how?
Well, it is clear that, PTS must be incremental, but what about PCR? Should it also be incremental?
2 Answers
The PCR is there for over the air and satellite transmission. As you know, PTS is 90000 ticks per second. But first the encoder and decoder needs to decide on the definition of a second. A decoders clock could run a little fast (causing buffering) or a little slow (causing memory exhaustion). The PCR is a signal sent very frequently to keep these clocks synced in one way signal transmission. This is less of an issue tiday as devices are connected to the internet and regularly sync their clock via a separate method. For your purpose, yes just using the PTS from another stream will work fine as, as unless you are are making a broadcast encoder for Motorola, it won't matter.
- PCR= Program Clock Reference, it is a master clock running at the encoder and used by decoder to sync with the encoder while decoding. Every Program Stream in the MPEG may have its own master clock called STC. Now PCR runs on 27MHz clock and appears in Transport stream. PTS takes its stamping on 90KHz clock (i.e., 33bit value).
- The STC first divides the the 27MHz by 300, giving a 90kHz clock that is counted by a 33 bit counter to give the base STC value. The remainder is taken as a 9-bit value that may be used as an STC extension.
- PTS- The Presentation Time Stamp indicates the instant at which an access unit should be removed from the receiver buffer, instantaneously decoded, and presented for display
In a layman's term, PCR is a constantly ticking master clock at 27 MHz and PTS value sampled from 90KHz clock (mentioned above) , shows when present this access unit to the viewer. it is always ahead of the current PCR value that that point. i.e., if PCR is at value x (90 KHz reduced value) then PTS will be (x+ some delay), that the decoder buffer has enough time to decode and generate viewing picture when STC arrived the PTS value