14

I just sniffed some traffic using wireshark and noticed, that the YouTube traffic relies on TCP. I thought, they were using UDP? But it seems like as if they would use HTTP octet streams. Is YouTube really using TCP for streams or am i missing something?

3 Answers 3

19

Because they need everything TCP provides (slow start, transmit pacing, exponential backoff, receive windows, reordering, duplicate rejection, and so on) they would either have to use TCP or try to do all those things themselves. There's no way they could do that better than each operating system's optimized TCP implementation.

6
  • That's right, but do they need all this for streaming video? i believed, that streaming means "UDP, cause it doesnt matter at all whether some packets get lost or not! Hey, we try to provide you some sort of real time service".
    – Sebastian
    Oct 27, 2013 at 16:30
  • 2
    @Sebastian Right, but lost packets are just one issue. The number of issues that TCP handles for you that you do need is enormous, and TCP is heavily optimized on every operating system and network. UDP just can't compete. Oct 27, 2013 at 16:33
  • I am shocked video is sent as TCP as it doesn't require reliable which slows things down considerably.
    – markmnl
    Jun 19, 2015 at 2:20
  • 1
    UDP is not suported by browsers at the moment, that's why!
    – Ma Jerez
    Sep 9, 2016 at 20:26
  • 2
    @Sebastian Streaming only means UDP if you don't care about lost frames (like in a voice call, you want to be as current as possible, regardless of lost audio). However, many streaming applications don't want to toss frames for video streaming (e.g., music videos on YouTube) unless it is live streaming (e.g., Facebook Live). Feb 11, 2017 at 6:16
12

Obviously, Google is currently experimenting with own Protocol Implementations, like QUIC (Quick UDP Internet Connection), as one can see when examining the HTTP Response

HTTP/1.1 200 OK
...
Content-Type: video/mp4
Alternate-Protocol: 80:quic
...

However, currently, they seem to rely on TCP, just like David mentioned before.

4
  • @Would be interested to know how you examined this HTTP response headers? Wireshark or some online tool?
    – goldenmean
    Oct 29, 2013 at 16:05
  • I indeed used Wireshark. On Mac OS, browsing YouTube with Chrome. What web based tools do you exactly mean?
    – Sebastian
    Oct 29, 2013 at 22:42
  • 5
    Okay, there are some downvotes. Since I would like to learn: What is the reason for "-1"-ing the answer? If it is utterly wrong, I would really like to know
    – Sebastian
    Jun 17, 2014 at 13:39
  • 1
    I don't downvote, but I guess that is because QUIC does not rely on TCP. Aug 17, 2017 at 8:20
2

From http://www.crazyengineers.com/threads/youtube-use-tcp-or-udp.38419/:

...of course youtube page uses http [which is over TCP]. The real thing does not happens via http page but the flash object that is embedded in that page. The flash object which appear on youtube is video flash player. The video flash player acts as iframe(technically incorrect term) for contents that would be called for streaming via flash object. For storing media contents a media sever have been installed by youtube whose contents get called when you press play button.

For streaming media to flash player Real Time Streaming Protocol(RTSP) is used. The play button on flash player acts as RTSP invoker for media being called and media is streamed via UDP packets. In fact you don't need to migrate anywhere from page because the embedded object calls for video not the http page but as the object is embedded on http page once you close it, object also get closed.

4
  • But what about HTML5 video fallback?
    – Anurag
    Aug 29, 2015 at 10:38
  • Depends on what protocol you specify e.g. <video src="rtp://blah"> or <video src="http://blah">
    – markmnl
    Sep 2, 2015 at 6:01
  • 1
    Maybe it was true when Youtube used Flash, but now (and for quite some time) the majority of browsers use MSE/DASH by default. Even the browsers that don't support MSE (like IE on Windows 7 and below) use HTML5 video via HTTP, which in turn uses TCP.
    – John29
    Apr 19, 2016 at 16:55
  • 3
    Flash does not use RTSP - it uses RTMP/RTMPE over TCP or RTMFP over UDP. The article quoted above is wrong. Jun 8, 2016 at 23:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.