If I upload a 2GB video file to the server, will I be able to play it smoothly anytime and anywhere?
Recently, while tinkering with cloud servers and MinIO, I encountered a very natural question:
If I upload a 2GB video file to the server, can I play it smoothly anytime, anywhere?
At first glance, this seems like a storage problem:
But after digging deeper, you find that what really determines the playback experience is often not storage, but the network.
This leads to several key concepts:
These concepts seem similar, but they describe things at different levels.
First, understand bandwidth.
Bandwidth describes:
The maximum amount of data that can be transmitted over a network link per unit of time.
For example, a cloud server is labeled:
txt
This means theoretically:
txt
Note:
The Mbps in networks uses bit, while file sizes usually use Byte.
The relationship between the two:
txt
So:
txt
That is to say, a server with a 3Mbps public network egress has a theoretical maximum transfer speed of approximately:
txt
At this point, we can establish a simple model:
txt
Bandwidth is the maximum transport capacity of the line in the middle.
Analogous to:
File = cargo
Network = road
Bandwidth = road width
The wider the road, the more vehicles can pass per unit of time.
If you are just accessing a web page:
txt
The data volume is usually very small.
A single request might only be:
txt
Even with low bandwidth, it won't significantly affect the experience.
But video is different.
The essence of video playback is:
Continuously fetching data.
For example:
A video bitrate:
txt
Means:
The player needs to fetch on average per second:
txt
of data.
If the server can only provide:
txt
Then:
txt
The player's buffer will eventually be depleted.
The manifestation is:
txt
So what is bitrate?
Simply put:
Bitrate represents the amount of data contained in the video per unit of time.
For example:
txt
Means:
On average, per second it needs:
txt
Conversion:
txt
That is:
Approximately consumes per second:
txt
The network needs to continuously provide this speed for the video to play in real time.
There is an easily confused point here:
Many people think:
The larger the video, the higher the bitrate must be.
Actually, this is not entirely correct.
The accurate relationship is:
txt
For example:
A video:
txt
Calculation:
txt
So:
The average bitrate of this video is approximately:
txt
If another video:
txt
Then:
txt
Although the file sizes are the same, the playback requirements are completely different.
So:
File size determines storage cost, bitrate determines network demand during playback.
If you already know the final file size, you can calculate the average bitrate.
But the question arises:
Why are the final sizes of two videos different?
This involves video encoding.
Influencing factors include:
For example:
txt
The higher the resolution:
The more pixels need to be described.
Usually requires a higher bitrate.
For example:
txt
60 FPS means:
More frames need to be processed per second.
Therefore usually requires more data.
Two videos both at 1080p:
Video A:
txt
Video B:
txt
Video B usually requires a higher bitrate.
The reason is that video compression relies on:
Predicting changes.
If consecutive frames change very little, the encoder can reuse a lot of information.
For example:
Previous frame:
txt
Next frame:
txt
The encoder only needs to record the change.
But:
Previous frame:
txt
Next frame:
txt
The change is huge and requires more data.
Different encoding formats have different efficiencies.
For example:
txt
More advanced encoding formats can usually use a lower bitrate at the same quality.
So the final size of a video:
Is not determined by duration alone.
Rather:
txt