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

Sylvain Fabre sylvain.fabre at inpixal.com
Tue Mar 8 07:59:18 PST 2016


Hi, 

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 ?

Thanks !

===================================================
...
  unsigned char ttl = 7;
  struct in_addr destinationAddress;
  destinationAddress.s_addr = inet_addr(dstip);
  const Port rtpPortDest(dstport);
  Groupsock rtpGroupsock(*rtsp->env, destinationAddress, rtpPortDest, ttl);
  // Create a 'MPEG Video RTP' sink from the RTP 'groupsock':
  RTPSink *videoSink = H264VideoRTPSink::createNew(*rtsp->env, &rtpGroupsock, 96);
    
  ttl = 1;
  struct in_addr sessionAddress;
  sessionAddress.s_addr = inet_addr(srcip);
  const Port udpPort(srcport);  
  Groupsock udpGroupsock(*rtsp->env, sessionAddress, udpPort, ttl);
  // Create the data source: a "MPEG Video RTP source"
  FramedSource* transportStreamSource = BasicUDPSource::createNew( *rtsp->env, &udpGroupsock);
  //MPEG1or2Demux *mpegDemux = MPEG1or2Demux::createNew( *rtsp->env, transportStreamSource);
  //FramedSource  *videoES   = mpegDemux->newVideoStream();
  //MediaSource   *videoSource = MPEG1or2VideoStreamFramer::createNew(*rtsp->env, videoES, False);
  //FramedSource* transportStreamFramer = MPEG2TransportStreamFramer::createNew(*rtsp->env, transportStreamSource);
  
  // Finally, start receiving the multicast stream:
  videoSink->startPlaying(*transportStreamSource, NULL, NULL);
...
===================================================




More information about the live-devel mailing list