[linux-dvb] relating PTS to 'real' time

John Birch Johnb at screen.subtitling.com
Tue Aug 23 15:09:46 CEST 2005


Why do you want to map them against 'wall time'?
If you want to break it into chinks of the same size - use the pcr values
for chunking.
The PCR is continuous (apart from the wrap at 0xFFFFFFFF...) so you can
choose a sensible binary fraction of the max PCR value to chunk up the

There really is no way of synchronising the wall clock against PCR because
of the fact that PCR maximum value occurs at a longer interval than 24
hours, so the PCR value drifts against wall time.... so on day 1 the PCR
value at 12:00 midday might be X, on day two the PCR value at 12:00 midday
will be X - n, where n is the difference in the 24hr 'day' wrap interval and
the PCR wrap interval (working the wrap out is left as an exercise for the
reader :-) - basically MAX 32 bit value * tick value.

If you want the same sized chunks - which effectively means the same
duration of play time for each chunk - use the PCR values and chunk on

If you want to be able to determine when a chunk was transmitted - just
record the PC time (or GPS time) at the start of each chunk.....

Note: PCR values are not guaranteed to be continuous... broadcasters do
sometimes reset equipment - which will cause a PCR change.... also some
broadcasters change the PCR value periodically for other operational
reasons... there is a flag that is used to indicate a discontinuity in PCR


John Birch
Senior Software Engineer,
Screen Subtitling Systems  
The Old Rectory, Church Lane
Claydon, Ipswich, Suffolk
Tel: +44 1473 831700
Fax: +44 1473 830078

See us at IBC Amsterdam  9th-13th September Stand No. 1.441

This message is intended only for the use of the person(s) ("the Intended
Recipient") to whom it is addressed. It may contain information which is
privileged and confidential within the meaning of the applicable law.
Accordingly any dissemination, distribution, copying or other use of this
message or any of its content by any person other than the Intended
Recipient may constitute a breach of civil or criminal law and is strictly
prohibited. If you are not the Intended Recipient please destroy this email
and contact the sender as soon as possible.

In messages of non-business nature, the views and opinions expressed are the
author's own and do not necessarily reflect the views and opinions of the
Screen Subtitling Systems Limited.

Whilst all efforts are made to safeguard Inbound and Outbound emails, we
cannot guarantee that attachments are Virus-free or compatible with your
systems and do not accept any liability in respect of viruses or computer
problems experienced.

-----Original Message-----
From: linux-dvb-bounces at linuxtv.org
[mailto:linux-dvb-bounces at linuxtv.org]On Behalf Of Stefan Magdalinski
Sent: 23 August 2005 13:57
To: linux-dvb at linuxtv.org
Subject: Re: [linux-dvb] relating PTS to 'real' time

John Birch wrote:
> Stef,
> There is no process relating PCR /PTS to real time (assuming by real 
> time you mean GMT or UTC etc)
> PCR values wrap at an interval greater than 24 hours.
> There is rarely any relationship between the PCR value and 'wall clock 
> time'.
> The PTS relates to the PCR - that is the PTS is the presentation time 
> stamp for the content it is embedded in (video, audio or subtitles). 
> When the PCR value in the stream matches the PTS, the content should be 
> presented (i.e. the video frame should be visible, audio heard, or 
> subtitle displayed).

ok. That makes things a lot clearer.

What I'm trying to do is break the stream into small chunks, and save 
them mapped against 'wall clock time' - If the PTS and PCR don't carry a 
reliable form of 'wall clock time', should I just make sure the PC's 
clock is accurate and use that?

I don't need subsecond accuracy, or even second accuracy. +/- a minute 
is probably ok.

> Hope this helps...
> regards
> John Birch
> Senior Software Engineer,
> Screen Subtitling Systems 
> The Old Rectory, Church Lane
> Claydon, Ipswich, Suffolk
> www.screen.subtitling.com

linux-dvb mailing list
linux-dvb at linuxtv.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.linuxtv.org/pipermail/linux-dvb/attachments/20050823/69f10e3a/attachment.htm

More information about the linux-dvb mailing list