Compress a Video to a Smaller File (FFmpeg H.264)
Reduce a video's file size with FFmpeg's constant-quality CRF mode so it fits email and chat upload limits.
Run ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset medium -c:a aac -b:a 128k output-small.mp4 and raise CRF if you still need it smaller.
01Command
Command
$ ffmpeg -i input.mp4 -c:v libx264 -crf 28 -preset medium -c:a aac -b:a 128k output-small.mp402What it does
CRF is FFmpeg's constant-quality mode: the encoder keeps the visual quality you ask for and uses whatever bitrate that needs. The wiki's practical range is 18–28, and every +6 roughly halves the file size, so 28 is a good start for email and 32+ for aggressive shrinking. The -preset medium option balances speed against compression; slower presets like slow squeeze a bit more at the same quality.
03Risk
!Warning: Compression is lossy and cannot be undone — keep the original file and preview the compressed result before deleting anything.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- H.264 Video Encoding GuideEvidence: Explains CRF rate control: constant-quality mode where higher CRF values (18–28 practical range) mean smaller files, and the -preset speed/compression tradeoff.
Last verified: 2026-09-18 · Category: Media