[linux-dvb] RE : How to convert MPEG-TS to MPEG-PS on the fly?

Thierry Lelegard thierry.lelegard at tv-numeric.com
Fri Aug 22 10:10:09 CEST 2008


On Thu, Aug 21, 2008 at 09:17:58PM +0200, Josef Wolf wrote:

>The more I look at this PES stream the more confused I get:  The
>stream_id 0xe0 seems to transport PTS and DTS _only_.  Everything
>else seems to be contained in PES packets with those unknown
>stream_id's.  Here is what I see:

As mentioned in my previous post, the "stream ids" below B9
are ISO 13818-2 "start codes".

Let me try to clarify. A PES header starts with 00 00 01 xx
where xx is in the range B9-FF. A PES payload is a list of
elements. Each element starts with 00 00 01 xx where xx is
in the range 00-B8. The pattern 00 00 01 is never found
anywhere else in an MPEG-2 video stream.

When you analyze a TS, PES headers are "naturally" located
since they start at the beginning of a TS payload with TS
header containing a "payload start unit indicator".

After demuxing PES packets, you get a suite of elements.
Each element starts with 00 00 01 xx. When xx is in the range
B9-FF, this is the start of a PES packet, following the PES
header syntax as specified in ISO 13818-1 and potentially 
containing PTS and DTS. When xx is in the range 00-B8, this
is NOT the start of a PES header, but the start of a video
element inside the payload of the current PES packet. The
syntax of the following bytes depends on the start code xx
and is defined by ISO 13818-2, not -1.

Does this help?
-Thierry




More information about the linux-dvb mailing list