Misc.Aug 10, 2019
Oscar🐨koala

What protocol is used for video streaming?

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

Twitch Engineering: An Introduction and Overview
Twitch Engineering: An Introduction and Overview
Medium
How Facebook Live Streams to 800,000 Simultaneous Viewers - High Scalability -
How Facebook Live Streams to 800,000 Simultaneous Viewers - High Scalability -
Highscalability
Under the hood: Broadcasting live video to millions - Facebook Code
Under the hood: Broadcasting live video to millions - Facebook Code
Facebook Code
Add a comment
Twilio djht46: Aug 10, 2019

Nice try China.

Oscar 🐨koala OP Aug 10, 2019

Lol what. Come on. Help out a bro.

Zillow Group 4096 Aug 10, 2019

At the end of the day is tcp / udp for a quick search they use rtmps, I don’t use Facebook so who knows

Oracle pzd Aug 10, 2019

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.)

Oracle pzd Aug 10, 2019

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.

Oscar 🐨koala OP Aug 10, 2019

Thanks!

F5 Networks dontalk2me Aug 10, 2019

Its not your stack overflow dude

Microsoft aaaaaaa Aug 10, 2019

QUIC. HLS and dash mostly

Microsoft NzBF33 Aug 10, 2019

RTMP is on the way out, being replaced by SRT and RTP short-term and ultimately by WebTransport.

Uber btCp13 Aug 10, 2019

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

true[X] aduq Aug 11, 2019

what’s wrong with Oscar

Bloomberg LCSlayer Aug 11, 2019

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.

New
VeoQ04 Sep 10, 2019

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.

Twitch bRGHR38axe Jan 28, 2020

You should come work at Twitch