Skip to content

Real-time Transport Protocol (RTP)

RTP is the standard protocol for delivering audio and video over IP networks in real-time communications.

Overview

Real-time Transport Protocol (RTP) provides end-to-end network transport functions suitable for applications transmitting real-time data, such as audio, video, or simulation data, over multicast or unicast network services.

Defined in RFC 3550, RTP is used in conjunction with RTCP (RTP Control Protocol) to monitor quality of service and provide feedback on media delivery.

Key Features

RTP Characteristics

  • Real-time delivery - Optimized for time-sensitive media
  • Payload type identification - Supports multiple codecs
  • Sequence numbering - Enables packet loss detection
  • Timestamping - Allows proper playback synchronization
  • Source identification - Tracks multiple media sources

RTP Header

Key fields in the RTP header:

  • Version - Protocol version (currently 2)
  • Payload Type - Identifies codec/format
  • Sequence Number - Incremental packet counter
  • Timestamp - Media sampling instant
  • SSRC - Synchronization source identifier
  • CSRC - Contributing source identifiers

RTP and RTCP

RTP works alongside RTCP for quality monitoring:

RTCP Functions

  • Quality feedback - Packet loss, jitter, delay statistics
  • Sender reports - Information from active senders
  • Receiver reports - Feedback from receivers
  • Source description - Provides participant information
  • Goodbye messages - Indicates departure from session

Quality Metrics

Important RTP quality indicators:

  • Packet Loss - Percentage of lost packets
  • Jitter - Variation in packet arrival times
  • Latency - End-to-end delay
  • MOS Score - Mean Opinion Score for call quality

RTP Port Allocation

  • RTP uses even-numbered UDP ports (typically 16384-32767)
  • RTCP uses the next odd-numbered port (RTP port + 1)
  • Dynamic port allocation requires firewall configuration

Security Considerations

SRTP (Secure RTP)

  • Provides encryption for RTP media
  • Authentication to prevent tampering
  • Replay protection
  • Key management via protocols like DTLS-SRTP

Best Practices

  • Implement QoS/DSCP marking for RTP traffic
  • Use appropriate buffer sizes to handle jitter
  • Monitor RTCP statistics for quality issues
  • Implement SRTP for media encryption
  • Configure proper port ranges on firewalls
  • Use adaptive jitter buffers

Troubleshooting

Common RTP issues:

  • One-way audio (firewall/NAT issues)
  • Choppy audio (packet loss, jitter)
  • Echo (improper echo cancellation)
  • Clipping (codec mismatches)
  • No audio (port blocking, codec incompatibility)

Codecs and Bandwidth

Popular audio codecs:

  • G.711 - 64 kbps, high quality, standard
  • G.729 - 8 kbps, compressed, bandwidth-efficient
  • Opus - 6-510 kbps, adaptive, modern
  • G.722 - 64 kbps, wideband

Video codecs:

  • H.264 - Widely supported, efficient
  • VP8/VP9 - Open source, WebRTC standard
  • H.265 (HEVC) - Next generation, high efficiency