ThisCalculator

Everyday

TCP vs UDP for Video: Choosing Delivery

Updated · Standard formula, shown below

Delay added by retransmissions 0.25 s
Data received (reliable)
375.00 MB
Result
Data received (lossy)
371.25 MB
Result
Video length
10 min
You entered

TCP vs UDP for Video: Choosing Delivery

For video streaming, the choice between TCP and UDP comes down to whether you prioritize reliable delivery or low delay. For live video, UDP is generally the better choice because it minimizes delay, while for on-demand video, TCP is often used because it ensures complete delivery. This article explains the trade-offs and helps you decide which protocol suits your video application.

Formula

The calculator estimates the additional delay caused by TCP retransmissions when a certain percentage of packets are lost. The formula is:

Delay (seconds) = (Video length in seconds × Bitrate in Mbps × 1000) / (Packet size in bytes × 8) × (Packet loss fraction) × Retransmission time factor

Variables:

  • t – video length in minutes (default 10)
  • b – bitrate in Mbps (default 5)
  • p – packet loss percentage (default 1)
  • Packet size assumed 1500 bytes (typical Ethernet MTU)
  • Retransmission time factor assumed 0.1 seconds per retransmitted packet (approximate RTT)

The output shows the extra delay in seconds and the total data received under reliable vs. lossy conditions.

Worked Example

Using the defaults: 10-minute video, 5 Mbps bitrate, 1% packet loss.

  1. Total video data: 10 min × 60 s/min × 5 Mbps = 3000 Mb = 375 MB
  2. Total packets: 375 MB / 1500 bytes = 250,000 packets
  3. Lost packets: 1% of 250,000 = 2,500 packets
  4. Retransmission delay: 2,500 × 0.1 s = 250 seconds

So the extra delay is 250 seconds (about 4 minutes), and the data received reliably is 375 MB, while with lossy UDP you would only get 371.25 MB (99% of the data).

Background: The Two Protocols

TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) are the two main transport layer protocols on the internet. TCP provides reliable, ordered delivery with error checking and retransmission of lost packets. UDP provides a simple, connectionless datagram service with no guarantees—packets may be lost, duplicated, or arrive out of order.

For video, TCP ensures the entire video file arrives intact, but retransmissions can cause delays and buffering. UDP avoids that delay but risks missing frames, which can cause visual glitches.

How TCP Handles Video

TCP breaks video into segments, numbers them, and sends them. The receiver acknowledges each segment; if any are missing, the sender retransmits them. This guarantees the video plays from start to finish without missing data, but it introduces latency: the receiver must wait for missing packets, and the sender may slow down due to congestion control.

For on-demand streaming (like Netflix or YouTube), TCP is common because the video is pre-recorded and can be buffered ahead. The slight delay is acceptable, and reliability ensures no artifacts.

How UDP Handles Video

UDP sends video as a stream of datagrams without acknowledgment. The receiver plays what arrives and drops what doesn’t. This minimizes delay—no waiting for retransmissions—making it ideal for live video (video calls, live sports, gaming). The downside is that lost packets cause visible glitches, freezing, or blocky frames.

Many live streaming protocols (like RTP, WebRTC) run over UDP, sometimes with error correction or concealment to hide losses.

Choosing Between TCP and UDP

Consider the following factors:

  • Content type: Pre-recorded video → TCP; live video → UDP.
  • Network conditions: High packet loss (e.g., Wi-Fi) → TCP may be better to avoid glitches, but adds delay; low loss → UDP works well.
  • Latency requirement: Real-time interaction (video calls) → UDP; non-interactive (movie streaming) → TCP.
  • Player buffering: TCP allows longer buffers; UDP requires short buffers.

In practice, many systems use a hybrid: TCP for control and UDP for media, or adapt based on network conditions.

Common Problems and Misconceptions

A common misconception is that TCP is always better because it’s reliable. But reliability comes at the cost of delay, which can ruin live video. Another issue is that UDP doesn’t guarantee order, so video players must handle out-of-order packets, often by discarding them, which can cause jitter.

Also, some firewalls block UDP, making TCP necessary even for live video in certain networks.

Comparison: TCP vs UDP for Video

Here’s a quick comparison:

  • Reliability: TCP ensures all data arrives; UDP does not.
  • Delay: TCP adds retransmission delay; UDP has minimal delay.
  • Bandwidth usage: TCP overhead is higher due to acknowledgments; UDP overhead is lower.
  • Use cases: TCP for VOD, UDP for live streaming.

Real-world examples: YouTube uses TCP (often with QUIC, which is UDP-based but reliable), while Zoom uses UDP for real-time video.

Costs and Safety

UDP can cause network congestion because it doesn’t slow down when the network is busy, potentially affecting other users. TCP’s congestion control is more network-friendly. For safety, UDP has no built-in encryption; video must be encrypted at the application layer (e.g., DTLS, SRTP) to protect privacy.

Alternatives and Modern Approaches

Modern protocols like QUIC (based on UDP) combine reliability with lower latency. WebRTC uses UDP with SRTP for secure real-time video. Some systems use SCTP, which offers multiple streams and partial reliability.

For most developers, the choice is not strictly TCP vs UDP but which protocol best fits the application’s latency and loss tolerance.

Frequently Asked Questions

Is UDP faster than TCP for video? Yes, UDP has lower latency because it doesn’t wait for acknowledgments or retransmissions. However, TCP can be faster in terms of total throughput on lossy networks because it retransmits, while UDP loses data.

Why does YouTube use TCP instead of UDP? YouTube is on-demand, so it can buffer ahead. TCP ensures the video plays without artifacts, and the initial buffering delay is acceptable. Also, TCP works through firewalls that block UDP.

Can UDP be made reliable for video? Yes, by adding application-level acknowledgments and retransmissions, or using protocols like QUIC or WebRTC with error correction. This gives some reliability while keeping lower latency than pure TCP.

What happens if a UDP packet is lost during a video call? The receiver simply doesn’t display that frame or uses the previous frame. This causes a brief glitch but no delay. In severe loss, the call quality degrades.

Does TCP cause buffering in live video? Yes, TCP’s retransmissions can cause the buffer to empty and stall, especially on high-loss networks. That’s why live video typically uses UDP.

Which protocol is better for gaming video streaming? For game streaming (like cloud gaming), low latency is critical, so UDP is preferred. For watching pre-recorded game replays, TCP is fine.

Related

Formula used
in t | Video length | min | 10 | 0
in b | Bitrate | Mbps | 5 | 0
in p | Packet loss | % | 1 | 0
out d | Delay added by retransmissions | s | (t * 60 * b * 1000) / (1500 * 8) * (p/100) * 0.1 | 2
out r | Data received (reliable) | MB | (t * 60 * b) / 8 | 2
out rl | Data received (lossy) | MB | (t * 60 * b) / 8 * (1 - p/100) | 2

Each line is one input (in, sel, list) or one result (out: label, unit, formula, decimals). How the calculators work

Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.