What is RTP?
RTP carries live sound and video across a network. It cuts media into small packets, each with a sequence number, a timestamp and a codec number, and sends them over UDP. The receiver uses those numbers to put packets back in order, spot losses and play everything at the right moment.
RTP has a partner, RTCP, that sends short reports every few seconds about loss, jitter and timing. Phone calls set up with SIP, video meetings, browser calls with WebRTC and IP cameras watched over RTSP all move their media in RTP packets.
Think of it like this. RTP is like a conveyor belt of numbered photo prints. If one print falls off, the belt does not stop to fetch it; you just skip that frame. The numbers on the back tell you the order, and a note every few minutes (RTCP) tells the sender how many prints went missing.
Step by step
Normal
3 stepsA voice call: one small RTP packet every 20 ms in each direction, plus RTCP reports.
Normal
3 stepsA voice call: one small RTP packet every 20 ms in each direction, plus RTCP reports.
- 1
Talk
Voice cut into 20 ms slices
The phone samples the microphone 8000 times a second and packs every 20 ms into one RTP packet of 160 bytes. That is 50 packets a second each way.
- 2
Both ways
Two separate streams
Omar's phone sends its own stream back at the same pace, with its own SSRC and its own sequence numbers. A call is two one-way streams.
- 3
Reports
RTCP every few seconds
Alongside RTP, each phone sends RTCP reports. Sender reports say how much was sent; receiver reports say how much was lost and how jittery it was.
Packet lost
4 stepsOne voice packet is dropped on a busy link. RTP does not resend it; the phone hides the gap.
Packet lost
4 stepsOne voice packet is dropped on a busy link. RTP does not resend it; the phone hides the gap.
- 1
Packets on their way
Seq 4101, 4102...
Voice keeps flowing every 20 ms as normal.
- 2
One is dropped
A busy router throws away 4103
A router with a full queue drops packets. RTP runs over UDP, so nobody resends it. By the time a resend arrived it would be too late to play anyway.
- 3
Hide the gap
Packet loss concealment
Omar's phone sees 4104 arrive after 4102 and knows 4103 is missing. It fills the 20 ms with a guess based on the sound before, so Omar hears at most a tiny blip.
- 4
Report it
RTCP shows the loss
The next receiver report says 2% was lost. Some phones react by switching to a codec that copes better with loss.
Jitter buffer
3 stepsPackets leave evenly but arrive bunched up and out of order; a small buffer smooths them out.
Jitter buffer
3 stepsPackets leave evenly but arrive bunched up and out of order; a small buffer smooths them out.
- 1
Sent evenly
One packet every 20 ms
Kenji's phone sends on a steady clock, exactly 20 ms apart.
- 2
Arrive unevenly
Wi-Fi and queues add delay
Each packet waits a different time in queues and on Wi-Fi. That variation is called jitter. One packet even overtakes another.
- 3
Buffer and reorder
Hold, sort, play on time
Omar's phone keeps a jitter buffer of about 40 to 60 ms. It sorts packets by sequence number and plays them by timestamp, so the voice sounds smooth. A packet that comes later than the buffer allows counts as lost.
Encrypted (SRTP)
2 stepsThe same call with Secure RTP: headers in the clear, voice encrypted and signed.
Encrypted (SRTP)
2 stepsThe same call with Secure RTP: headers in the clear, voice encrypted and signed.
- 1
Keys agreed
During call setup
The phones agree on keys while setting up the call, for example inside SIP over TLS or with a DTLS handshake, as browsers do in WebRTC.
- 2
Encrypted voice
Same rhythm, unreadable payload
Each packet still goes out every 20 ms with a readable RTP header, but the audio is encrypted and a 10 byte tag is added. Anyone capturing it hears nothing.
Myths and mix-ups
- RTP does not resend lost packets; for live voice, a late packet is worse than a missing one.
- RTP does not set up the call; SIP, RTSP or WebRTC do that and tell RTP which ports to use.
- The timestamp is not wall clock time; it counts media samples from a random start.
- RTP is not encrypted by default; you need SRTP for that.
Try it yourself
Run these on your own computer to see RTP at work.
Watch RTP on your machine
sudo tcpdump -n -i any udp portrange 10000-65535 and greater 200Start a call in a softphone first. You will see a steady stream of packets about 20 ms apart.
Send a test stream
ffmpeg -re -f lavfi -i sine=frequency=440 -c:a pcm_mulaw -ar 8000 -ac 1 -f rtp rtp://127.0.0.1:5004Sends a tone as G.711 RTP and prints the SDP you would need to play it.
In a packet viewer
Filter: rtp, then Telephony > RTP > RTP StreamsShows loss, jitter and sequence errors per stream. Use Decode As > RTP if packets show as plain UDP.
RTP at a glance
- Layer
- Application (7), used as a transport for media
- Port
- None fixed, agreed in SDP, often an even port with RTCP on the next odd one
- Transport
- UDP
- Header size
- 12 bytes
- Voice packet
- 20 ms, 160 bytes of G.711, 50 per second
- Partner
- RTCP for loss, jitter and timing reports
- Secure form
- SRTP (RFC 3711)
- Standard
- RFC 3550 (2003, first 1996)
Defined inRFC 3550RFC 3551 (audio and video profile)RFC 3711 (SRTP)
Header fields
What RTP puts in its messages, with example values from the stories above.
RTP
- Version
2- Marker
1 (start of talk spurt)Set on the first packet after silence, so the receiver can adjust its buffer.- Payload type
0 (PCMU, G.711 mu-law)Says which codec made the payload. 0 is a fixed number for PCMU.- Sequence number
4021Goes up by one per packet. A gap means a packet was lost; a step back means it came out of order.- Timestamp
0Counts audio samples. G.711 takes 8000 a second, so 20 ms adds 160.- SSRC
0x5a3c91e2A random ID for this stream, so the receiver can tell streams apart.- Payload
160 bytes of G.711 audio (20 ms)
SRTP
- Sequence number
4301The RTP header stays readable, so routers and the receiver can still order packets.- Timestamp
128000- SSRC
0x5a3c91e2- Encrypted payload
160 bytes, AES counter modeOnly the two phones hold the key, so the voice is unreadable on the way.- Authentication tag
10 bytes (HMAC-SHA1-80)Proves the packet was not changed or faked on the way.
Test yourself
What tells the receiver that an RTP packet is missing?
Questions people ask
What port does RTP use?
There is no fixed port. Each side picks a UDP port and announces it in SDP during call setup. Many phones use a range such as 10000 to 20000, with RTCP on the next port up.
What is the difference between RTP and RTCP?
RTP carries the media itself. RTCP travels alongside and carries reports about loss, jitter and timing so each side can see how the call is going.
Is RTP TCP or UDP?
Almost always UDP. RTP can be framed inside TCP, for example in RTSP when UDP is blocked, but that adds delay.
What is jitter in a VoIP call?
Jitter is how much the gaps between arriving packets vary. A jitter buffer on the receiving phone hides it, but too much jitter causes choppy sound.
Is RTP encrypted?
Plain RTP is not. SRTP encrypts the payload and adds an authentication tag. WebRTC always uses SRTP.