Compress Video with ffmpeg and H.265
Re-encode a video with libx265 at CRF 28 to cut file size dramatically while keeping quality (requires brew-installed ffmpeg).
Run `ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 96k output.mp4` to compress a video.
01Command
Command
$ ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -c:a aac -b:a 96k output.mp402What it does
The CRF value is the quality dial: 28 for HEVC is a good general target, and each +6 roughly halves the bitrate. The -preset medium tradeoff matters — slower presets like slow give smaller files for the same quality but take much longer. HEVC plays in QuickTime and modern browsers, but if you need maximum compatibility for old devices, swap libx265 for libx264 with -crf 23.
03Risk
!Warning: Re-encoding is lossy — never write the output over the source file.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- FFmpeg documentationEvidence: Official ffmpeg manual describing input seeking, codec selection, and audio bitrate options.
- Encode/H.265 — FFmpeg wikiEvidence: Documents -c:v libx265 with -crf and -preset for H.265/HEVC encoding; higher CRF means smaller files.
Last verified: 2026-09-17 · Category: Media