A phone clip that’s a few minutes long can be hundreds of megabytes, too big to email and slow to upload. “Without losing quality” is the honest sticking point: video is already compressed, so making it smaller means re-encoding, and the trick is choosing a setting where the loss is there in theory but invisible in practice. That’s exactly what CRF encoding gives you.
FFmpeg in WSL does it for free, locally, with one command. No upload limits, no watermark, and the video never leaves your machine.
No WSL yet? See the WSL install guide.
Install FFmpeg
sudo apt update && sudo apt install -y ffmpeg
Confirm:
ffmpeg -version
The command
Compress input.mp4 into a smaller output.mp4 using CRF:
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4
What each part does:
-c:v libx264encodes video with H.264 (widely compatible).-crf 23is the quality target — the main dial.-preset mediumbalances speed against compression.-c:a copykeeps the original audio untouched (fast, no quality loss on sound).
Choosing the CRF value
CRF is where you set the quality/size trade-off. Lower is higher quality and bigger; higher is smaller and softer.
H.264 CRF guide
| 18 | Visually lossless — hard to tell from source |
|---|---|
| 20-22 | Excellent quality, solid size saving |
| 23 | Default — good balance |
| 26-28 | Noticeably smaller, some quality loss |
| 30+ | Small files, visible compression |
Start around 20–23. If the result looks perfect and you want it even smaller, nudge the number up and re-encode a test.
Speed vs size: the preset
-preset controls how hard the encoder works. Slower presets squeeze out smaller files for the same quality, at the cost of time:
ffmpeg -i input.mp4 -c:v libx264 -crf 22 -preset slow -c:a copy output.mp4
Presets run from ultrafast (quick, larger) through medium (default) to veryslow (smallest, slowest). medium or slow is a sensible range for most clips.
Smaller still: H.265
H.265 (HEVC) compresses better than H.264, so files come out smaller at the same quality — but it encodes slower and isn’t supported by every device or app:
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -c:a copy output.mp4
Note that H.265 CRF numbers aren’t directly comparable to H.264 — around 28 is roughly the H.264 23 ballpark. Use it when small size matters more than playing everywhere.
Compress several videos
To compress every MP4 in a folder into a compressed subfolder:
mkdir -p compressed
for f in *.mp4; do ffmpeg -i "$f" -c:v libx264 -crf 23 -preset medium -c:a copy "compressed/$f"; done
Originals stay put; smaller copies land in compressed/.
Wrapping up
Compressing video without visible quality loss comes down to CRF: ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a copy output.mp4, with the CRF number as your quality dial (around 18–23 for clean results) and the preset trading time for size. H.265 goes smaller when compatibility isn’t a concern.
It’s free, it batches, and it runs in WSL — so your videos never get uploaded. The same FFmpeg install also handles converting MOV or MKV to MP4 and trimming clips without re-encoding.