Most "compress a video" problems come down to one of two things: a file too big to email, or a file that takes too long to upload. The same two settings fix both, and it helps to know which one to try first.
One line, and it is the same line professionals use:
ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset slow -c:a aac -b:a 128k output.mp4
-crf 28 is the quality dial, -preset slow tells the encoder to spend more
time finding savings, and the audio is re-encoded to a sensible 128 kbps. For
most videos you need nothing else.
The two settings that matter
CRF: how much detail to keep
CRF (Constant Rate Factor) is a quality target, not a size target. Lower means better and bigger. The scale runs 0–51, and only a narrow part of it is useful:
| CRF | What it is for |
|---|---|
| 18 | Near-transparent. Archival, or footage you will edit again |
| 23 | The default. Good for almost everything |
| 28 | Visibly compressed on detailed motion, still fine for talking heads |
| 32+ | Getting it under a hard limit, and it shows |
The encoder then uses whatever bitrate it needs to hit that quality. That is why CRF gives a consistent look across clips and a fixed bitrate does not.
Resolution: how many pixels to keep at all
This is the setting people forget, and it is usually the bigger win. Going from 1080p to 480p throws away about three quarters of the pixels before the quality setting applies:
ffmpeg -i input.mp4 -vf "scale=-2:480" -c:v libx264 -crf 28 -c:a copy output.mp4
-2 on the width means "work it out from the height, and keep it an even
number". H.264 needs even dimensions, and -2 saves you doing the sum yourself.
If the video will be watched in a chat window or an email, 480p is plenty. Squeezing 1080p under a limit when nobody will see it bigger than a postcard throws away quality to keep pixels that never get shown.
Getting under a hard limit
Email attachment limits are the usual reason people end up here. This is what works:
- Drop the resolution first. 1080p → 720p, or → 480p if it will be watched small. You lose far less quality this way than by raising CRF.
- Then raise CRF in steps of 2 from 23 until the file fits.
- Check the audio. For speech,
-b:a 96ksounds the same and saves real space on a long recording. For music, keep it at 128k or above. - Watch fifteen seconds of the result before you send it. Compression artefacts show up in motion, not in a still frame.
Each lossy pass decodes to raw frames and compresses again from there, so the damage adds up. Always start from the original file. If it is gone, compress the copy you have once. Doing it again won't make it better.
When the browser tool is the better answer
Three cases:
- You do not have ffmpeg and will use this once. Installing a video encoder to send one clip is not a good trade.
- The file is sensitive. An upload-based converter puts your footage on somebody's server. This one keeps it in the tab: the encoder is compiled to WebAssembly and runs on your machine.
- You want to see the trade-off first. The tool estimates the output size for each quality level, which is quicker than encoding three times to find out.
Large files are slow either way, because this is real encoding work. Expect minutes rather than seconds for anything over a few hundred megabytes.
If you only need a different container
Sometimes the file isn't too big, it is just the wrong kind of file. Changing the container without touching the video is instant and lossless:
ffmpeg -i input.mov -c copy output.mp4
-c copy means "copy the streams as they are". No quality is lost because
nothing is re-encoded. This only works when the codecs inside already fit the
target container, which H.264 video and AAC audio usually do.