FFmpeg recipe
FFmpeg: Compress an MP4 with HEVC (H.265)
HEVC is roughly half the size of H.264 at the same visual quality. Trade-off: not playable in Chrome / Firefox without H.264 fallback.
Command
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium -tag:v hvc1 -c:a copy -y output.mp4Prefer no terminal?
Use the Video Compressor in your browser
What each flag does
| -i | Input file. Can be a video, audio, or image. Repeat for multiple inputs. |
|---|---|
| -c:v | Video codec for output. e.g. libx264, libx265, libvpx-vp9. |
| -crf | Constant Rate Factor — quality target (lower = better, larger file). 23 is visually lossless for libx264. |
| -c:a | Audio codec for output. e.g. aac, libmp3lame, copy. |
| -preset medium | HEVC presets are slower than H.264 — medium is a good default. |
| -tag:v hvc1 | Apple-friendly HEVC tag. Without this, Final Cut and QuickTime may not recognize the codec. |
Notes & gotchas
- HEVC CRF 28 ≈ H.264 CRF 23 in visual quality.
- Output will not play in Chrome / Firefox. Use H.264 if you need browser-wide compatibility.
Check it worked
ffprobe -v error -show_entries stream=codec_name,codec_tag_string -of csv=p=0 output.mp4hevc with the tag hvc1. The tag hev1 will not play in Safari or QuickTime.
What to change
| CRF numbers are not H.264 numbers | x265 CRF 28 is roughly x264 CRF 23. Copying an H.264 CRF across is how people end up with a file far smaller and softer than they meant. |
|---|---|
| Add the hvc1 tag for Apple | -tag:v hvc1 is what makes an H.265 MP4 play in QuickTime and on iOS. Without it the file is fine and will not open. |
| Check it plays where it is going | H.265 halves the size and is still refused by plenty of browsers, editors and TVs. H.264 is the safe answer when you do not control the player. |
If it fails
The file plays in VLC but not in QuickTime or on an iPhone.
Why: FFmpeg wrote the hev1 tag, which Apple players do not accept.
Fix: Add -tag:v hvc1, which changes only the tag and not the video data.
Encoding is much slower than H.264 at the same settings.
Why: HEVC does far more analysis per frame, which is what buys the smaller file.
Fix: Add -preset faster, or use hardware encoding with -c:v hevc_videotoolbox on macOS.