Turn a file cap into a bitrate budget

Suppose a destination accepts an 8 MB file and your final clip runs for 60 seconds. This example uses decimal MB: 8 MB is 8,000,000 bytes. A total stream budget of 1,066.7 kbps would consume every byte before allowing for the container. That leaves no practical margin.

Video kbps = (MB × 1,000 × 8 × 0.95 ÷ seconds) − audio kbps

With a 5% planning margin and 128 kbps audio, the video budget is about 885 kbps. Our test used 880 kbps, rounded down. Five percent is our working margin, not a platform rule or a guaranteed amount of container overhead.

The actual 60-second export

We looped the same eight-second chart, added a synthetic tone and encoded a 60-second H.264/AAC MP4. The video target and maximum rate were both 880 kbps. The export was then measured using FFprobe and the file’s byte count.

CheckValue
Hard cap8,000,000 bytes
Actual file7,714,367 bytes
Decimal size7.714 MB
Running time60.000 s
Video average891.6 kbps
Audio average128.2 kbps
Bytes remaining285,633

Inspect the actual test MP4 · 7.714 MB

A limit does not choose your quality

An 885 kbps video budget is far below YouTube’s 8 Mbps recommendation for a 1080p, 30 fps SDR upload. Both numbers can be correct: one solves a tight file limit, the other describes an upload quality target. If a detailed scene looks poor at the budget, reduce duration or resolution, change the codec where allowed, or choose another destination.

If the audio alone uses the available budget, there is no positive video bitrate to return. The tool reports an error instead of suggesting a zero-bitrate video.

Other caps and lengths

The same formula covers any cap. Every row below keeps the 5% margin and 128 kbps audio, and rounds the video budget down.

CapDurationVideo budget
8 MB30 s1,898 kbps
8 MB1 min885 kbps
8 MB3 min209 kbps
25 MB1 min3,038 kbps
25 MB3 min927 kbps
100 MB10 min1,138 kbps
8 MB10 minNo video budget

The last row is the useful warning: ten minutes inside 8 MB leaves less total data than the audio alone needs, so there is no video budget to return. Shorten the clip, lower the audio rate or choose another way to deliver it.

Keep the margin even for short clips. Our 60-second test was a single-pass encode with the rate capped at 880 kbps, yet FFprobe measured the video average at 891.6 kbps, 1.3% above the target. The margin absorbed it. HandBrake’s documentation recommends multi-pass encoding when you target an average bitrate, for better quality and bit-rate distribution.

Check your own output

  1. Use the destination’s actual byte rule; do not assume its “MB” label is binary.
  2. Budget using the full duration and all audio tracks. This tool assumes one combined audio rate.
  3. Export, check the bytes, then watch the difficult part of the clip.
  4. If the file is still too large, leave more margin and export again.

Our measured file proves that this one synthetic export fits. It does not guarantee that another encoder or source will fit at the same settings.

Evidence & sources

Original synthetic encoding test, recorded 8 October 2026. Actual MP4 files, byte counts and frame comparisons; Read the method.