[Mp4-tech] MPEG-2 TS converter

Samuel Rivas samuel dc.fi.udc.es
Thu Jun 2 11:13:43 EDT 2005


Alejandro Moya wrote:
> Dear Ik.Hwan Cho,
> converting MPEG-2 Program stream into one Transport Stream could notbe difficult if you just to mux one program into the TS without timinginformation: you should remove Pack and System Headers from ProgramStream and should divide the resulting Packets into 184 byte chunksadding an easy 4 byte header -> 0x47 0x0Y 0xYY 0x10 where "Y" are 13bits indicating your Program IDentification (you may choose it as youdesire). The last step would be to add two packets at the beginning ofthe file containing your new TS: one with Program Association Table(Tranport Stream which should have PID = 0) and Program Map Table(which will have the PID you defined in the Program Association Table)containing the PIDs of the transport stream packets carrying youroriginal video (i.e., the PID  "Y" you choose above).

It is is not so easy. TS packets need stuffing if payload is less
than 184 bytes length, you must set the continuity counters and the
payload_unit_start indicators, PAT and PMT should be inserted
periodically, etc.
An easy way to get a more or less correct transport stream is using Video 
Lan Client (http://www.videolan.org/vlc/)
-- 
	Samuel


More information about the Mp4-tech mailing list