0.4.1&0.4.0 Linux&Windows client MPEG2 PS&TS broken?

Jean-Paul Saman saman at natlab.research.philips.com
Wed Jul 10 08:46:55 CEST 2002

Johann Hanne wrote:
>>>Well, you could "simply" use the first video and audio stream in the TS 
>>>and play it?
>>NO, it could be the second or third or fourth or fifth. You get the 
>>idea? ;-)
> But if the TS includes only one audio and one video stream, you could do 
> it?
I was talking about the PAT (pid 0). Of course you can try to discover 
the audio and video PID in the Mpeg-PS layer, after you got rid of the 
TS headers.

>>>However, I have modified the program to record PID 0 (PAT), PID 100 (PMT), 
>>>PID 110 (video and PCR) and PID 120 (audio). The result is still the same. 
>>>Of course not all PMT-PIDs given in the PAT are available. Is this a 
>>>problem? Should I modify the PAT to only include the reference to PID 100?
>>The PAT and PMT should match the SP-TS (Single Program Transport 
>>Stream). Otherwise a MPEG decoder does not know which program to decode.
> What does that mean? What streams does a SPTS include? Only one video and 
> one audio stream? Each with a specific SPTS-PID? Or also PAT and PMT?!
It should include the PAT (PID 0), PMT (PID ??), Audio (PID ??), Video 
(PID ??) and PCR (PID ??). It can even include Teletext (PID ??) and 
alternative languages (other audio pids).

Only the PAT has a known PID value, it is always 0. The PAT references 
to one or more PMT's. A PMT references one Video and Audio (possibly 
more audio) PIDs. (This can also include Teletext and a separate PCR_PID).
The PCR_PID is a timebase for the streams, which is used by the 
transmitter and the receiver. Sometimes this is combined with the Video 
PID, but this is not mandatory. (you're milage may vary)

>>Vlc can play MPEG-TS files from disk. It also can read them when there 
>>is a MP-TS (Multi Program Transport Stream) PAT and PMT's. Then you have 
>>to choose the right PMT from the menu View|Program. This might work.
> When I try to play the stream, the View|Program option is greyed out, i.e. 
> not selectable.
As I said *might work*

>>>Has anybody actually tried out to play MPEG TS from a file? What should 
>>>vlc actually do? Shouldn't there be an option for choosing a program 
>>>number (i've tried the --program parameter without success)?
>>Did you fill in the PMT PID number?
> I've tried the program number from the PAT (28006) as well as the 
> referenced PMT PID (100).

>>Reading a SP-TS from file is no problem as long as it is a *valid* 
>>SP-TS. Officially a SP-TS with the original PAT and PMT in it is no 
> Can you give me some hints what a SPTS actually includes? Until now I 
> thought that it consists only of one video and one audio stream with the 
> PCR included in the video stream?! I wasn't able to find much information 
> on the net about it :-(
PID 0 aka PAT is the only known startpoint in a TS. It points to a PMT. 
In the PMT there are the PIDs for Video, Audio, Teletext, PCR and 
possible additional Audio channels.

PAT (pid 0) --> PMT (pid ??) --> Video (pid ??)
                              --> Audio (pid ??)
                              --> Audio(n) (pid ??)
                              --> PCR (pid??)

Look at: http://www.erg.abdn.ac.uk/research.html
Some other pointers: http://www.mpeg.org/MPEG/index.html and 

>>It would be better to modify the PAT to only include the PMT of 
>>the program that is recorded. Also correct the CRC32 in there if you are 
>>at it.
> I have extended the program to do that. It now replaces all incoming PAT 
> packets with some predefined PAT (the CRC32 is calculated and then 
> re-checked, so it should be ok). This PAT only includes program number 1 
> referencing PMT PID 100. Apart from PID 0 (PAT) the recorded file now 
> only includes the referenced PMT PID 100 and all PIDs referenced in that 
> PMT. So it should now be a *complete* transport stream. However, vlc still 
> doesn't even open a video output window. Do you have some further ideas?!
There are more problems with the stream, then including the right PIDs. 
See below.

Can you read the stream directly from the DVB-card with vlc. Either 
through the satellite plugin or with "cat /dev/ost/dvr" | vlc /dev/stdin" ?

>>This all will work provided that the DVB card produces a valid Mpeg-TS 
>>stream. With that I limit the DVB cards to Hauppage Win-TV Nova model 
>>542. If you are using a DVB-S or probably even a DVB-C card, then there 
>>are more problems.
> I *have* a DVB-C. But as far as I have understood the only (?) problem is, 
> that the full-featured DVB-cards (not-Nova) cannot pass the complete TS 
> through, but only up to 8 (?) single PIDs. So if I modify the PAT to only 
> reference one program, the TS should be "complete" again?
No, the driver forgets a "start unit indicator". It indicates the start 
of a new PES packet in the TS header. We notified the author of the DVB 
On top of that there are not PCR's and DTS in the stream. The lack of 
DTS possibly does not need to be fixed. But the PCR time base needs to 
be recreated. However this is not an easy task.

>>I suggest to continue this discussion which is highly development 
>>oriented on vlc-devel at videolan.org, instead of the user mailing list for 
> Ok. I've also sent this message to vlc-devel and deleted vlc from the 
> recipient list.

> Cheers, Jonny <jonny at 1409.org>
Kind greetings,

Jean-Paul Saman

Software Architect

e-mail (work): saman at natlab.research.philips.com
phone  (work): 040 27 42909
Ordina TA,
Science Park Eindhoven 5602, Postbus 293, 5600 AG Eindhoven
e-mail : jean-paul.saman at ordina.nl
phone  : 040 2601200
fax    : 040 2601199

This is the vlc-devel mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html
If you are in trouble, please contact <postmaster at videolan.org>

More information about the vlc-devel mailing list