What protocol is used for video streaming?

Oscar 🐨koala
Aug 10 13 Comments

I am preparing for system design for an infrastructure role and want to get engineers’ opinions on this...

I read a facebook blog post [1] from 2015 and it said it was using RTMP for live streaming (just TCP).

Twich did it too [2] but converted to HLS (uses HTTP).

But in [3] it was suggested facebook also invested in MPEG-DASH (uses HTTP) in 2016.

For personal reason I am not able to test live stream with wireshark, but for offline video playback it seems YouTube is using UDP. I see both UDP and TCP connections when I played an offline facebook video.

So,

1. Which video streaming protocol do facebook and YT use for live streaming?

2. For offline?

Stackoverflow/Quora/Superuser often give false answers... I figured we have engineers here they would be able to answer. Not knowing what protocol is killing me...

Thanks. TC: 150 base.

[1]: https://code.fb.com/ios/under-the-hood-broadcasting-live-video-to-millions/

[2]: https://blog.twitch.tv/twitch-engineering-an-introduction-and-overview-a23917b71a25

[3]: http://highscalability.com/blog/2016/6/27/how-facebook-live-streams-to-800000-simultaneous-viewers.html

comments

Want to comment? LOG IN or SIGN UP
TOP 13 Comments
  • Twilio djht46:
    Nice try China.
    Aug 10 1
    • Oscar 🐨koala
      OP
      Lol what. Come on. Help out a bro.
      Aug 10
  • Uber btCp13
    Twitch is RTMP ingest. This is a transport layer over h264 video + aac audio. One it gets to them, they’ll transcode it to whatever formats are browser-friendly (plus various qualities) and serve it via HLS typically (which is basically using http to download chunks of the stream at a time).

    There are other ways now, most promising being Webrtc for a true live experience (think zoom) but it’s not super adopted yet
    Aug 10 0
  • F5 Networks dontalk2me
    Its not your stack overflow dude
    Aug 10 0
  • Oracle pzd
    You need to support both because Apple phones / safari don't yet support mpeg-dash. These days, it's common to use an http-based protocol for livestreaming.

    UDP-based protocols (e. g. RTP) are used for peer-to-peer audio/video because of latency constraints of TCP.
    Aug 10 1
  • New / R&D
    VeoQ04

    New R&D

    PRE
    Check Point Software Technologies, Ltd.
    BIO
    Senior iOS developer and tech lead
    VeoQ04more
    Oldie but still
    You seem to be mixing highly between TCP / UDP to the actual streaming method.
    For live with low latency some use RTMP.
    issues with that is high inefficiency at this point and cost that doesnt scale easily due to the nature of the servers needed.

    For streaming itself 90% are using HLS and lets say 10% are using Mpeg dash
    (The difference is between H264 and H265 usually - as HLS can support now H265 packages and then the difference to mpeg dash is only in the playlist structure)
    Reasons is better compression and the ability to do HLS / MPDash on CDN for example - that scale WAY better.

    For live streaming you can still use HLS (and so most companies do) with either:
    1. 10-30 seconds delay from live stream (depends on configurations of the playlists and segment encoding
    2. 2-3 seconds using specific players that implement chunks (with lower bandwidth efficiency
    There's a 3rd way that Apple introduced during WWDC 2019 - but its available only from iOS 13 if I recall, requires HTTPS 2.0 support and some more unrealistic demands.

    offline - iOS has HLS caching built in the OS since iOS 10 , android needs to implement - but its not rocket science (StackOverflow has a good answer about it actually that I wrote for iOS - but it's true in general)

    Just use a proxy that supports custom certificates on devices for HLS and you'll see basically everything (at least from apps that don't do SSL pinning)
    Charles web proxy is a good example for one that works nicely with mobile devices.
    Sep 10 0
  • Microsoft NzBF33
    RTMP is on the way out, being replaced by SRT and RTP short-term and ultimately by WebTransport.
    Aug 10 0
  • Zillow Group 4096
    At the end of the day is tcp / udp for a quick search they use rtmps, I don’t use Facebook so who knows
    Aug 10 1
    • Oracle pzd
      I just checked. Doesn't look like RTMPS. The video chunks are some form of bastardized mp4. RTMPS uses flv. (Check the network calls in inspect tab. They don't look like either rtmp or mpeg-dash.)
      Aug 10
  • Bloomberg LCSlayer
    Nobody cares about that really. Just say TCP or some other specialized protocol that you don’t care about and move on. UDP for live video.
    Aug 11 0
  • true[X] aduq
    what’s wrong with Oscar
    Aug 11 0
  • Microsoft aaaaaaa
    QUIC. HLS and dash mostly
    Aug 10 0