[Live-devel] Raw MPEG2-TS to RTP multicast

Ross Finlayson finlayson at live555.com
Thu Mar 10 07:58:47 PST 2016


> I am trying to convert a MPEG2-TS stream, with 1xH264 video stream inside to a RTP multicast stream. I tried various functions, but nothing seems to work.
> 
> Below is the code of my latest attempt (srcip = 127.0.0.1, srcport = 6402, dstip = 226.0.16.1, dstport = 6500). Of course, rtsp->env has been prpoerly initialized before. 
> 
> Any hints ?

Because you are trying to stream MPEG Transport Stream data over RTP, you should *not* be using a “H264VideoRTPSink”, because that is used only to stream raw H.264 video.  In your case, you don’t have access to the raw H.264 video, because we don’t provide a mechanism for demultiplexing the input Transport Stream data; instead, you need to re-stream the Transport Stream itself.  You do that using a “SimpleRTPSink”.

To do this, do the following:

1/ Use a “BasicUDPSource” to receive the raw-UDP Transport Stream.
2/ Feed this to a “MPEG2TransportStreamFramer” (to generate proper 'presentation time’s for the Transport Stream packets).
3/ Feed that to a “SimpleRTPSink”, which is created as follows:
	SimpleRTPSink::createNew(env, rtpGroupsock, 33, 90000, "video", "MP2T", 1, True, False /*no 'M' bit*/); 

HOWEVER, if you are doing this inside of a RTSP server, then you don’t need to write any new code to do this.  Instead, just add a “MPEG2TransportUDPServerMediaSubsession” object to your RTSP server.  Our “RTSPServer” and “MPEG2TransportUDPServerMediaSubsession” code does all the work for you.

For an illustration of this, see the “testOnDemandRTSPServer” demo application (a RTSP server); in particular, lines 404-430 of “testProgs/testOnDemandRTSPServer.cpp”.

Ross Finlayson
Live Networks, Inc.
http://www.live555.com/




More information about the live-devel mailing list