[vlc-devel] Small utility to add RTP headers to raw UDP MPEG-TS

Christophe Massiot massiot at via.ecp.fr
Mon Aug 11 14:18:02 CEST 2008

On Mon, Aug 11, 2008, Marian Ďurkovič wrote:
> > It is probably of no importance to you, but please notice that the RTP
> > timestamp is not correct : the spec says it should be in the same scale
> > and origin as the PCR, which is not the case here (since it is generated
> > from the wall clock and not from the stream).
> Yes, I'm aware of this - but in our environment the RTP headers
> are used to identify stream type and ensure correct packet order.
> All timing is taken from the transport stream by hw or sw
> demuxer i.e. the RTP timestamps are in fact trashed.  

Same for everyone - I doubt somebody actually uses the RTP timestamp in
a TS application.

> Anyway, I'll be glad to fix it if there's an easy way to extract
> PCRs from the TS - any hints or examples for this?

Not quite simple :
 - filter PID 0 and build the PAT
 - filter the PID of the PMT of your program (what to do if there are
   several programs ??) and build the PMT
 - get the PCR_PID from the PMT
 - get the PCR from the adaptation field layer of the PCR_PID

Alternatively, you can also search all PIDs for an adaptation field
containing PCR, and then consider it is the PCR_PID, but funny boys can
also send PCRs on PIDs which are not supposed to carry them. Should work
with most streams though.

Christophe Massiot.

More information about the vlc-devel mailing list