· 4 min read
How to Hit a Target Video File Size
Heshan Fernando
Co-founder & COO
The upload limit is 500 MB and your video is 740 MB. You need to re-encode it to fit, which means picking a bitrate — and the arithmetic is simple enough that most people do it in their head and end up at 520 MB.
Two things account for the overshoot, and both are small enough to ignore and large enough to matter.
The calculation
File size is bitrate multiplied by duration:
size (MB) = total bitrate (kbps) × duration (s) ÷ 8 ÷ 1024
Rearranged for a target size, 500 MB over 12 minutes 30 seconds gives about 5,330 kbps total.
That’s total bitrate, and the two things people leave out are both inside it.
Audio. A 192 kbps audio track consumes 192 kbps of your budget for the entire duration. Not much proportionally, but it comes out before the video gets anything.
Container overhead. The MP4 or MKV wrapper adds indexing and metadata — typically one to two percent. Small, and it’s the percent that pushes you over a hard limit.
So: 5,330 total, minus 192 for audio, minus roughly 2% overhead, leaves about 5,030 kbps for video.
One pass or two
A single-pass encode at a target bitrate makes decisions as it goes. On a complex scene it spends more, on a simple one less, and the final size can miss the target by a noticeable margin in either direction.
A two-pass encode analyses the whole file first, then allocates the bitrate budget across it with knowledge of where the complexity is. It takes roughly twice as long and hits a target size far more accurately.
When you have a hard limit, two-pass is the right choice. When you just want good quality and don’t care about exact size, a quality-based mode like CRF is better than either — but CRF doesn’t let you target a size, which is the entire problem here.
| Mode | Hits target size | Quality | Speed |
|---|---|---|---|
| Single-pass bitrate | Approximately | Variable | Fast |
| Two-pass bitrate | Accurately | Good | 2× slower |
| CRF / quality | No — size unpredictable | Best | Fast |
When to lower resolution instead
If the calculated bitrate is very low for the resolution, the result will be soft and blocky regardless of the encoder.
At that point, reducing resolution usually looks better than starving a high one. A sharp 1080p at 3,000 kbps beats a mushy 4K at the same bitrate, because the encoder has fewer pixels to spend the budget on.
There’s no universal threshold — it depends on the codec and how much motion the footage has. Static talking-head footage survives a low bitrate that would destroy a handheld action sequence.
Common mistakes to avoid
- Forgetting the audio track, then landing just over the limit.
- Using single-pass for a hard size target.
- Keeping 4K resolution at a bitrate that can’t support it.
- Re-encoding an already-compressed file repeatedly, which compounds generation loss.
- Assuming a newer codec’s bitrate figures transfer to an older one — they don’t, which is most of the point of a newer codec.
How to do it with Video Bitrate Calculator
The Video Bitrate Calculator accounts for audio and overhead.
- Enter the duration and either the target size or the bitrate you know.
- Subtract the audio track, which is a fixed cost independent of the video.
- Compare the resulting video bitrate against what the resolution needs.
- Use two-pass encoding when the size limit is hard.
Other video tools are in the tools directory.
Frequently asked questions
What bitrate does my resolution need?
It depends on codec and content. Static footage needs far less than fast motion at the same resolution, and a modern codec does more with less. Published tables are a starting range, not a rule.
Why is my file bigger than the calculation?
Container overhead, and variable-bitrate encoding overshooting on complex scenes. Two-pass encoding hits a target far more accurately than single-pass.
Should I lower resolution or bitrate?
When the budget is tight, lowering resolution usually looks better than starving a high resolution. A sharp 1080p beats a blocky 4K at the same file size.
Final thought
Subtract the audio before you set the video bitrate. It’s the one term everyone forgets and the reason so many re-encodes land just over the limit.