|
|
||
|---|---|---|
| readme.md | ||
Streaming platform
This repo is a POC for testing, learning and having fun around video streaming service.
The goal is a highly optimized video streaming solution, that maximize the number of stream from one server. User should have a web page to choose and watch content.
To achieve this, multiples choices has been made.
- Focus only on animated content, because encoding work extremely well on this type of content.
- Encode everything at AV1 720p, original audio (no multi audio) and subtitles.
- These choices are made to reduce the most the size of the media
- Use HSL for http based delivery
- Use highly optimized web server with caches rules
These choices are also here to reduce the scope of the project.
Supporting multiple type of codecs, bitrates and others are non goals. This solution is not a real, industry solution as this some users might not have the required hardware to watch content.
The usage here would be to watch anime, on a phone; where high quality video and audio are not needed.
The theory.
The maximal number of concurrent stream is directly linked to the uplink bandwidth of the server and the bitrate of the content being watch.
As an example, takes the followings' information:
- Server uplink : 1Gbit/s
- Every user watch the exact same episode: size 1GByte (8 Gbit) and 24 minutes (1440 seconds) long.
- Do not take into account overhead of HSL and networking layers
The bitrate of the episode is : 8Gbit / 1440 = 5.555 Mbit/s
Therefore, the absolute limit of concurrent stream on the server is : 1000 / 5.555 = 180 users.
To maximize this number of concurrent stream:
- it's possible to increase the server uplink, which cost more money
- it's possible to reduce the media bitrate.
- In the real world, there are also various overhead, theses can also be reduced to maximize the number of concurrent users.
A typical AV1 720p anime can reduce the size down to 120 to 150 MByte. This enables an absolute limit of concurrent stream of : 1000 / (150*8 / 1440) = 1200 users! It's linear, reducing the size by X % will increase the absolute limit of concurrent stream by the same amount.