Files & encoding
Target File Size Calculator
Need a clip under an upload or attachment limit? Enter the size and length. You get the video bitrate that fits, a quality check for your resolution, and two-pass ffmpeg commands to copy.
Fit a video under a size limit
Video bitrate to encode at
—kbps
- Total bitrate
- —
- Expected file size
- —
- Quality at this resolution
- —
- Bits per pixel
- —
ffmpeg two-pass commands
Run both lines in order from the folder with your video. Rename input.mp4 to your file. The -vf part sets the output resolution and frame rate; delete it to keep the source’s.
Video bitrate for common size limits
Video kbps with 128 kbps audio and a 3% safety margin. “—” means the audio alone would fill it.
| Limit | 30 s | 1 min | 2 min | 5 min |
|---|---|---|---|---|
| 8 MB | 1,941 | 906 | 389 | 78 |
| 10 MB | 2,458 | 1,165 | 518 | 130 |
| 25 MB | 6,338 | 3,105 | 1,488 | 518 |
| 50 MB | 12,805 | 6,338 | 3,105 | 1,165 |
| 100 MB | 25,738 | 12,805 | 6,338 | 2,458 |
How the bitrate is worked out
- Take the target size and keep back the safety margin: 10 MB with 3% leaves 9.7 MB (9,700,000 bytes).
- Convert to bits and divide by the length: 9,700,000 × 8 ÷ 120 s = 646,667 bit/s in total.
- Subtract the audio: 646,667 − 128,000 = 518,667 bit/s, so encode the video at 518 kbps.
Encode with two-pass average bitrate, as in the commands above. Single-pass quality modes such as CRF don’t target a size, so they can land well over or under the limit.
Frequently asked questions
How do I make a video fit under a size limit?
Divide the target size in bits by the duration in seconds to get the total bitrate, subtract the audio bitrate, and encode the video at that average bitrate using two-pass encoding. This calculator does the maths and writes the ffmpeg commands for you.
Why use two-pass encoding?
In the first pass the encoder analyses the whole video; in the second it spends bits where they are needed most while hitting the average bitrate precisely. It is the most reliable way to land just under a size limit with the best possible quality.
Why keep a safety margin?
The container adds a little overhead and encoders can overshoot slightly. A 2–5% margin keeps the finished file under the limit instead of a few kilobytes over it.
What if the bitrate is too low for good quality?
Lower the resolution or frame rate (for example 720p30 instead of 1080p60), use a more efficient codec such as H.265 or AV1, lower the audio bitrate, or trim the clip. The quality check suggests the largest resolution your bitrate can carry.