Key takeaways
- A video's file size is almost entirely bitrate × duration. If you know the size limit and the length, you can calculate the bitrate you can afford.
- Formula: total kbps = (limit in MB × 8192) ÷ seconds. Subtract audio, then leave about 5% headroom.
- When the bitrate is low, drop the resolution (for example to 720p) rather than starving a 1080p picture. It nearly always looks better.
- Compress once, from the original. Re-compressing an already compressed file loses quality each time.
Email, chat apps, forms and uploads often have a maximum file size. Dragging a quality slider until the video fits is slow and unpredictable. A better approach is to work out how many bits per second you can afford and then tell the encoder exactly that. This guide shows the maths, a worked example, and how to apply it with HandBrake (a free graphical tool) or ffmpeg (a free command-line tool).
Why file size is mostly bitrate
A video file is a stream of data measured in bits per second (the bitrate), played for a number of seconds. Multiply them and you have the size. Resolution, frame rate and codec matter because they affect how much bitrate you need for a picture to look good, but the arithmetic of the final file is simply:
size (bits) = bitrate (bits per second) × duration (seconds)
That is why a two-minute clip is roughly twice the size of a one-minute clip at the same settings, and why a "small" file is usually either short or heavily compressed.
Step 1: Work out your total bitrate
Take the size limit in megabytes, convert to kilobits and divide by the duration in seconds:
total_kbps = (limit_MB × 8192) ÷ duration_seconds
We use 8,192 kilobits per megabyte (8 bits × 1,024 KB). Some platforms count a megabyte as 1,000,000 bytes, which would make it 8,000 kilobits per megabyte. If you are unsure, use 8,000, which is the more cautious figure.
Step 2: Subtract audio and leave headroom
Audio takes a slice of the budget. A stereo AAC track at 128 kbps is a sensible default for speech and general clips; 96 kbps is fine for plain speech. Subtract that from the total. Then leave around 5% spare for container overhead and for encoders that overshoot the target slightly.
video_kbps = (total_kbps − audio_kbps) × 0.95
A worked example
Suppose you need to send a 90-second screen recording through a form that accepts at most 25 MB.
- Total: 25 × 8192 ÷ 90 = 2,275 kbps.
- Subtract audio: 2,275 − 128 = 2,147 kbps.
- Leave headroom: 2,147 × 0.95 ≈ 2,040 kbps, so aim for about 2,000 kbps of video.
Two megabits per second is comfortable for a 720p screen recording and tight for fast 1080p gameplay. That brings us to the next decision.
Step 3: Choose a resolution that suits the bitrate
An encoder spreads the bitrate across every pixel of every frame. Fewer pixels means more bits per pixel, which means a cleaner picture. As a rough guide for H.264 video:
| Resolution | Calm content (talks, screen recordings) | Busy content (sports, gameplay) |
|---|---|---|
| 480p | 500 to 1,000 kbps | 1,000 to 1,500 kbps |
| 720p | 1,000 to 2,500 kbps | 2,500 to 4,000 kbps |
| 1080p | 2,500 to 5,000 kbps | 5,000 to 8,000 kbps |
These are starting points rather than rules. If the bitrate you calculated falls below the range for your resolution, step the resolution down one notch. A crisp 720p clip looks better than a blocky 1080p one at the same size. To find your source's current resolution and bitrate, see how to check a video's resolution, bitrate and codec.
Option A: Compress with HandBrake
- Open HandBrake and drag in your video.
- Choose the Fast 720p30 preset (or Fast 1080p30 if your bitrate allows it).
- On the Video tab, set the encoder to H.264 and choose Avg Bitrate (kbps). Enter your calculated number, for example 2000. Tick 2-pass encoding for better accuracy.
- On the Audio tab, choose AAC at 128 kbps (or 96 for speech).
- Set the output format to MP4, pick a destination and press Start Encode.
- Check the resulting file size. If it is a little over the limit, lower the bitrate by 10% and repeat.
Option B: Compress with ffmpeg
The two-pass method gives the most predictable size. On macOS or Linux:
ffmpeg -y -i input.mp4 -vf scale=-2:720 -c:v libx264 -b:v 2000k -pass 1 -an -f null /dev/null && \
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -b:v 2000k -pass 2 -c:a aac -b:a 128k -movflags +faststart output.mp4
On Windows, replace /dev/null with NUL and the trailing backslash with a caret or put the command on a single line. The scale=-2:720 filter resizes to 720 pixels tall and keeps the width proportional (and an even number, which H.264 needs).
If you do not need an exact size, a quality-based single pass is simpler:
ffmpeg -i input.mp4 -vf scale=-2:720 -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 128k output.mp4
Lower -crf values mean better quality and bigger files (about 18 is visually near-lossless, 23 is the default, 28 is noticeably smaller). Try a value, check the size, and adjust.
Other ways to shrink a video
- Trim it first. Removing dead air at the start and end is free compression. See how to trim an MP4 without losing quality.
- Lower the frame rate. Going from 60 fps to 30 fps roughly halves the work the encoder has to do for the same quality, and is rarely noticed on screen recordings.
- Drop the audio if the clip does not need sound. Add -an in ffmpeg or remove the track in HandBrake.
- Crop out unused areas, such as black bars or empty parts of a screen recording.
- Use a more efficient codec if every device that matters can play it. HEVC and AV1 can reach a similar look at a lower bitrate than H.264, but they play on fewer older devices; see MP4 vs MOV vs WebM vs GIF.
Common mistakes
- Compressing a compressed file repeatedly. Every pass discards more detail. Always start from the original recording.
- Ignoring the audio budget. A 128 kbps audio track on a 600 kbps budget is more than 20% of the file.
- Trusting a platform's size without checking. Limits change and differ between free and paid plans. Check the current limit on the service you are using.
- Converting to GIF to "make it smaller". GIFs are usually much bigger than the equivalent MP4. See the format guide above.
Quick answers
Will compressing a video make it look worse?
Always a little, because compression works by discarding detail. The goal is to discard detail you will not miss. Using the right resolution for the bitrate, and compressing once from the original, keeps the loss small.
Why is my compressed file bigger than my target?
Most likely the encoder overshot the bitrate, or the audio and container overhead were not included. Use two-pass encoding, subtract audio, and leave the 5% headroom shown above.
Is it better to lower resolution or bitrate?
When bitrate is tight, lower the resolution. The same bitrate spread over fewer pixels gives a cleaner picture.
Need to save a Streamable clip? Paste its link into the free Streamable downloader and get the original MP4 in a few seconds. Only download videos you own or have permission to keep: see our copyright basics guide.