TCP/IP Protocol: Real-time Transport Protocol (RTP)


Jarret W. Buse

TCP/IP Protocol: Real-time Transport Protocol (RTP)

The Real-time Transport Protocol (RTP) is used to stream audio and video over IP networks such as the Internet. It is possible to stream over a Local Area Network (LAN) that uses TCP/IP.

RTP is an end-to-end transfer of data in real-time. What this means is that data is sent from the server to the client(s) and is in actual time. Imagine something like Internet radio which is audio only, but there should be few lapses in the transmission since the data is usually buffered. A buffer is when data is stored in memory and played from memory. The buffer may allow for a few seconds of stored information before playing. Some applications can allow for setting the buffer amount.

It is possible to use RTP over the Transmission Control Protocol (TCP) since it is reliable but unfortunately it has a problem with delivering data in a timely fashion. RTP usually uses the User Datagram Protocol (UDP) since data is delivered faster, but loses reliability of delivery. In most cases, a dropped frame should not affect playback too badly. Playback is only affected if the network is severely congested causing slow delivery.

RTP has four sub-protocols, but two are optionally used. The sub-protocols are as follows:

  • Data Transfer – the transfer of data from server to client and includes the following:
    • Timestamps – aids in synchronization
    • Payload – audio/video data
    • Sequencing numbers – order frame payload in proper sequence
  • Real-time Transport Protocol Control Protocol (RTCP) – controls flow by Quality of Service (QoS) and aids in synchronization of data. The bandwidth of RTCP is about 5%.
  • Session Description Protocol (SDP) – an optional sub-protocol for media description information
  • Session Initiation Protocol (SIP) – an optional sub-protocol for signaling between the client and server
When an RTP session is opened between a client and server, a port number is used with the IP Address. An RTCP session is also established with the same IP Address and the next Port number is used. For example, if the RTP session uses Port Number 2000, then RTCP uses Port Number 2001.

For each audio/video format, RTP allows for Application Level Framing (ALF). ALF provides a payload and profile format. ALF allows RTP to be used for various media types without requiring RTP to be revised. For example, ALF can provide a payload type for MPEG4 and a profile for the MPEG4 coder-decoder (codec). When a new format is needed, a new ALF can be devised to allow it to be used with RTP.

The RTP Server captures the audio/video and then encodes the data into the appropriate profile. The payload or coded data is then encapsulated into a frame with the necessary timestamp and sequence number. The frames are then sent over the network media and received at the client. The packets travel over the network or Internet as any other TCP/IP information and routed to the designated client by the IP Address. Once the client receives the frame, the data is removed from the payload and placed into proper sequence order. The client application being used to view the audio/video information can be set to buffer the information providing better flow of the multimedia stream.

NOTE: The Real Time Streaming Protocol (RTSP) is similar to RTP except that it uses TCP and allows the state of the connection to be modified. The state can be changed from PLAY, PAUSE, RECORD and others to alter the playback state. Whereas RTP is more a multi-cast, RTSP is uni-cast. Think of RTSP as being similar to YouTube while RTP is similar to Internet radio.

To set up an RTP Server, you can use VLC. After VLC is installed, the audio/video file needs to be transcoded into a proper format. To transcode data, perform the following in the VLC GUI:
  1. Go to "Media >> Convert / Save..."
  2. Select the files or streams you want to transcode then press "Convert / Save"
  3. When the "Convert" window appears, specify the destination file name
  4. Choose the proper codec from the profile list
  5. Press "Start"
NOTE: If you do specify an extension on the destination file, it will be “flv”. Be sure you type in the appropriate extension.

At this point, the destination file should be created. If the destination file is not created, try the transcoding again.

Now you can stream the transcoded file by opening VLC. Select “Media” and the “Stream”. Next, select the transcoded file after pressing “Add”. After your transcoded file is added, select the arrow next to the “Stream” button and select “Stream”. You'll see the “Stream Output Menu” appears. The transcoded file should be listed as the Source. Select “Next” or “Destination Setup” to get to the Destination Setup page. Here is an option for the New Destination that is set to File. Change File to RTP and set the Profile type to the appropriate media type of your transcoded file. You can set other options, but selecting the “Stream” button starts the selected file streaming.

From the same system, you can type in "Media" [menu] -> Open Network Stream -> http://localhost:8080/stream1.mpg. Now the streaming video should play in your VLC viewer. If the RTP Server were named Linux1, from another system, you would have to type in “http://Linux1:8080/stream1.mpg”.


  • slide.jpg
    56.3 KB · Views: 53,117
$100 Digital Ocean Credit
Get a free VM to test out Linux! Hosting Donations
Consider making a donation

Members online