[FFmpeg-user] DTSs & PTSs in MPEG2-TS streams

Devin Heitmueller devin.heitmueller at ltnglobal.com
Fri Feb 2 16:35:53 EET 2024

On Thu, Feb 1, 2024 at 5:17 PM Mark Filipak <markfilipak.imdb at gmail.com> wrote:
> > The PES extension flag is mutually exclusive of whether the
> > PTS_DTS_flags field is set.  It's very common for there to
> > PTS_DTS_flags to be non-zero while PES_extension_flag is false.
> Okay. If DTS & PTS are not in the PES extension because there is no PES extension, then where are
> they? There are only a handful of bits in an MPEG2-TS/-PS I haven't figured out. You may know more
> than I do.

Ok, I see the problem here.  You've misunderstood what the PES
extension field does.  The PTS/DTS are not inside the PES extension.
The PES extension flag dictates whether a handful of other fields are
present which come after the PTS/DTS.  See ISO 13818-1:2000 Table
2.17.  The presence of the PTS/DTS is dictated by the PES_DTS_flags
field, and separately there is a PES_extension_flag which dictates
whether field such as PES_private_data_flag, pack_header_field_flag,
PES_private_data, etc are present.  You can see which fields are
controlled by the presence of the PES_extension_flag at the start of
page 33 showing Table 2-17.

> Yes, the SCR (in the TS) will constantly increment. It's when the _receiver_ of the TS sees SCRs
> that are out of order that it knows when packets are being received out of order and how to put them
> into proper order. That's why TSs are called "fault tolerant".

This is wrong, but I would encourage you to review that portion of the
spec before I spend a paragraph explaining why.  Not to give away the
ending, but SCRs are *never* out of order.  And that has nothing to do
with fault tolerance.


Devin Heitmueller, Senior Software Engineer
LTN Global Communications
o: +1 (301) 363-1001
w: https://ltnglobal.com  e: devin.heitmueller at ltnglobal.com

More information about the ffmpeg-user mailing list