Ask HN: How do live video streaming services handle encoding?
a) you have to normalize the input stream
b) you have to create multiple versions with lower bitrate for slow consumers
The issue I got stuck on was that the transcoding speed of ffmpeg was really slow. No matter how you configure it, it will always be way too slow in order to be usable for LIVE video streaming. Especially if you have to do two runs(as mentioend above).
So I am wondering how are these services doing it? Even if I would take into account use of really specced out servers - lets say 64 cores, that is 128 threads, leave 1 thread for application stuff, so that is 127 threads. You have 2 second long segments(GOP) into which you split the stream, that means such machine can transcode only 127 live video streams at any one time. And since the transcoding is slow, the process will be longer than 2 seconds which is the length of the video segments. So there is inherent lag being added into the data flow, plus the cpu/hw limitation. And this lag will keep on accumulating over time. So if you have 10k live video streams, that's over 156 really powerful servers, yet you still end up with lag nevertheless.
And that is only ingress. So I wonder, how on earth, are they doing it without introducing massive amounts of lag and spending massive amounts of money on hardware? Or do they do just that, spend a ton of money on hw to handle some realistic amount of ingress and use gpus or specific cpus/hw to make the trnacoding faster and keep the lag low? ie, is it only about money then or is there some tech i am missing?