RTP Transmitter sample

Subscribe to RSS news feed


Sample is based on TunaIPTransmitter component, which does the following:

  • consumes audio stream (either compressed or as PCM samples)
  • if stream is not compressed, encodes it with specified encoder
  • creates and send RTP/RAW packets with audio payload to one or more destinations.

There are several different streaming modes, all specified by the URI property.

RAW/RTP UDP Unicast streaming

In this mode target (destination) address and port is specified in URI, so any receiver which is able to bind to the target address:port will receive data.

URI samples:


Receivers must bind to at port 1234. RTCP will use port 1235.

RAW/RTP UDP One-to-many streaming

In this mode is specified as host address in URI, and port number specifies the port to "listen" for incoming requests.

URI samples:


Receivers must send requests to transmitter host at port 1234. RTCP will use port 1235.

NOTE for RAW streaming: this mode is NOT recommended, as there is no way to timeout dead receivers.

RAW/RTP UDP Multicast streaming

In this mode URI specifies multicast group address and port number to be used for streaming.

URI samples:


Receivers join multicast group and wait for data at port 1234. RTCP will use port 1235.

Icecast/SHOUTCast TCP streaming

In addition to UDP sockets, it is also possible to stream over TCP using SHOUTCast protocol. You should be running Icecast/DNAS server somewhere.

URI samples:


Where is host running Icecast/DNAS server at port 9000, "source" is client name and "hackme" is the password. "stream_name" specifies desired stream name.

Receiver should connect to Icecast/DNAS server using same host address, port number and stream name:

Payload format

Use SDP property to specify how audio should be encoded before transmitting. Or set doEncode property to False to disable any encoding.

Some SDP examples shows how to use it. In addition you can specify TTL for multicast streaming and bitrate for some codecs, as showm below:

m=audio 5004 RTP/AVP 14
a=rtpmap:14 mpa/44100/2
c=IN IP4 /2
a=fmtp:14; bitrate=256

Here 14 is pre-defined payload number for MPEG audio, "c=IN IP4 /2" specifies IP4 addressing and TTL=2, and bitrate is set to 256 kbps.

List of supported payloads, defined in RFC 3551:

  • 0 -- uLaw, 8000
  • 3 -- GSM, 8000
  • 5 -- DVI4, 8000
  • 6 -- DVI4, 16000
  • 8 -- ALaw, 8000
  • 10 -- L16, stereo, 44100
  • 11 -- L16, mono, 44100
  • 14 -- MPEG I/II Audio
  • 16 -- DVI4, 11025
  • 17 -- DVI4, 22050

In addition, IPTransmitter is aware of the following dynamic payload numbers:

  • 110 -- Speex (NB, 8000)
  • 111 -- Speex (WB, 16000)
  • 112 -- Speex (UWB, 32000)
  • 113 -- t140 text
  • 114 -- OGG/Vorbis (not yet implemented)
  • 115 -- VDVI
  • 116 -- CELT 16000 mono
  • 117 -- CELT 24000 mono
  • 118 -- CELT 48000 stereo
  • 119 -- GSM49 - MS GSM
  • 120 -- G.722.1

Streaming MPEG files

To stream a file with MPEG audio, you can use WaveRiff component, with realTime property set to True, and IPTransmitter component, with doEncode property set to false.

In this case MPEG frames are read directly from the file and no extreanal encoder is used.


Precompiled binary of this sample is included in the Demos package.