[Mp4-tech] MPEG-2 TS converter
Samuel Rivas
samuel dc.fi.udc.es
Fri Jun 3 09:40:15 EDT 2005
Alejandro Moya wrote:
> You needn't insert PMT or PAT periodically because what our friend
> Ik-Hwan asked was the way to convert one program stream into a TS for
> testing pourposes, not for streaming: when you broadacast a TS, even
> if it has only one program, you need to insert PMT or PAT so decoders
> can be able to get the program list and their associated PIDs; thatis
> not needed when using a TS inside a file.
> "continuity counters " aren't needed either and "payload_unit_start"
> bit is set in the byte sequence I told him to insert as transport
> stream header.
> The only thing I forgot to comment to make an easy test TS was that
> each transport packet should be 188 bytes length, so PMT and PAT
> packets should be padded with byte 0xFF.
Hi again,
If I didn't misunderstood anything, Ik-Hwan wants to simulate a
streaming application, not building something similar to a transport
stream for any strange purpose.
Anyway, your headers do not set the payload_unit_start_indicator bit. The
first TS packet for each PES packet should be 0x47 [0x0Y | 0x40] 0xYY 0x1X
being X the continuity counter (I am assuming that the "mpeg-2 file" Ik-Hwan
is talking about is either a PS or a PES). I agree the continuity
counter is useless in a stream stored in a file, but is needed if you
are going perform some streaming with it (that is what the TS format is
for).
Second, the stuffing is not only needed for PAT or PMT. A PES length
may not be multiple of 184, so the last TS packet for that PES should be
stuffed to complete its length. And to do that you must insert an
Adaptation Field (TS packet header is changed)
Last, if you are going to test any streaming system, you need the clock
references be inserted in the transport stream. For a program with only
one stream it is an easy task, but must be done.
In short, build a TS is not that easy as cutting up one stream in 184
byte length chunks and adding one simple header to those chunks.
Regards
--
Samuel
More information about the Mp4-tech
mailing list