Skip to the tool workspace
Browser 143

Handleidingen Video and audio

How to compress a video

Make a video small enough to send without making it look bad. What CRF does, which setting to change first, and the one ffmpeg command that does most of the work.

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.

The direct wayffmpegmacOS · Linux · Windows

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.

Match the resolution to the screen

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:

  1. 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.
  2. Then raise CRF in steps of 2 from 23 until the file fits.
  3. Check the audio. For speech, -b:a 96k sounds the same and saves real space on a long recording. For music, keep it at 128k or above.
  4. Watch fifteen seconds of the result before you send it. Compression artefacts show up in motion, not in a still frame.
Never compress a compressed copy

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.

Questions people ask

What CRF number should I use?

Start at 23. Below 18 you are storing detail nobody can see. Above 30 the picture starts to fall apart on anything that moves. Change it in steps of 2 and watch the result. The right number depends on the footage, not on a rule.

Why did my file get bigger?

You re-encoded something that was already compressed harder than your settings. Compression doesn't add up: each pass decodes to raw frames and compresses again from there, so a gentler second pass gives you a larger, worse file than the original.

Is resolution or CRF the better knob?

Resolution, if the video will be watched small. Halving the dimensions removes three quarters of the pixels before quality settings even apply, and nobody watching on a phone can tell. Fine-tune with CRF after that.

Does compressing lose quality every time?

Yes, with lossy codecs like H.264. Keep the original and compress from it each time rather than compressing an already-compressed copy.

Tools in deze handleiding

Alles draait op je apparaat

Alle handleidingen First published 20 jan. 2025