libx265 -crf 23 matches x264 at CRF 23 on VMAF in a file about a third smaller; its default CRF 28 is 61% smaller than x264's but scores lower. ReelSDK ran that one on an 11-second clip for under three quarters of a cent, at $0.02 per compute minute.
Encode H.265 (HEVC) with ffmpeg
libx265 encodes HEVC, also called H.265; at its default CRF 28 it took about 40% longer than libx264 at CRF 23. ReelSDK's engine has libx265, so the command runs as is, and -tag:v hvc1 makes the file play on Apple devices.
GuidesUpdated
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium \
-tag:v hvc1 -c:a copy hevc.mp4CRF 28 is the libx265 default. On a 1080x1920 video it came out 61% smaller than libx264 at its default CRF 23, and the encode took about 40% longer. -tag:v hvc1 is for Apple players.
Variations
The other commands you will need
Match x264's quality
The smaller file also scored lower: a VMAF of about 94 against 97 for x264. Lower the CRF to close the gap. At CRF 23, x265 matched x264 with 68% of its file size; CRF 25 landed in between.
x265 crf 23 ffmpeg -i input.mp4 -c:v libx265 -crf 23 -tag:v hvc1 \ -c:a copy hevc23.mp4Encode 10-bit HEVC
-pix_fmt yuv420p10lemakes Main 10 output, which HDR needs and which bands less in gradients. From our 8-bit source it came out 2% under the 8-bit file and scored slightly higher.10-bit ffmpeg -i input.mp4 -c:v libx265 -crf 28 -pix_fmt yuv420p10le \ -tag:v hvc1 -c:a copy hevc10.mp4Check the codec, profile and tag
ffprobe shows what you wrote. Ours printed
hevc,Main,hvc1,yuv420pfor the first file.probe ffprobe -v error -select_streams v:0 \ -show_entries stream=codec_name,profile,codec_tag_string,pix_fmt \ -of csv=p=0 hevc.mp4
The flags
The flags in these commands
| Flag | What it does | Used here |
|---|---|---|
-c:v libx265 | Encodes the video as HEVC with x265 | Every encode |
-crf 28 | Quality target from 0 to 51; 28 is the libx265 default, lower is better | Every encode |
-preset medium | Encoder speed against compression; medium is the default | CRF 28 |
-tag:v hvc1 | Writes the hvc1 sample entry that Apple players look for | Every encode |
-pix_fmt yuv420p10le | 10-bit 4:2:0 output, which x265 encodes as Main 10 | 10-bit |
-x265-params pass=1 | Passes options straight to x265, for example the pass number of a two-pass encode | Not used |
Sources: FFmpeg H.265 encoding guide, ffmpeg codecs: libx265, checked November 2026.
x265 against x264 on the same clip
The FFmpeg H.265 guide says x265 at CRF 28 "should visually correspond to libx264 video at CRF 23" at about half the size. On our clip, VMAF disagreed: x265 at CRF 28 scored about 94 and x264 at 23 about 97. x265 had to come down to CRF 23 to match.
The saving held up anyway. At matching scores the x265 file was 68% of the x264 file, a 32% saving, inside the 25 to 50% the guide gives for HEVC. The cost is time: x265 at 28 took about 40% longer than x264 at 23.
Why the hvc1 tag matters
An MP4 marks HEVC with one of two sample entries, hev1 or hvc1. The H.265 guide tells you to add -tag:v hvc1 for Apple's QuickTime and devices, since they look for that one. It changes a label in the file, not a single frame.
Without the flag, ffmpeg 8.1 tagged our HEVC MP4 as hev1. To fix a file you already have, ffmpeg -i in.mp4 -c copy -tag:v hvc1 out.mp4 re-tags it; the video stream came out identical by MD5.
When HEVC is worth it
HEVC pays off when files are stored or sent many times and encoded once: archives, downloads, apps that play their own media. When the video only has to play everywhere, H.264 is still the safer default; see choose a CRF value.
For HDR, 10-bit is not optional, and the sources are often HEVC already. Going the other way, to SDR, takes a tone map: see convert HDR to SDR.
Without installing ffmpeg
The same command as one API call
The engine has libx265, so the same args work as POST /v1/ffmpeg. Each job runs ffmpeg 8.1 on a fresh machine at $0.02 per compute minute, billed per second; this one finished in about 17 seconds and cost under three quarters of a cent.
curl "https://api.reelsdk.com/v1/ffmpeg?wait=60" \
-H "Authorization: Bearer $REELSDK_KEY" \
--json '{
"inputs": {
"input.mp4": "https://api.reelsdk.com/f/lib/demo/clip.mp4"
},
"args": [
"-i", "input.mp4", "-c:v", "libx265", "-crf", "28", "-preset",
"medium", "-tag:v", "hvc1", "-c:a", "copy", "hevc.mp4"
],
"outputs": ["hevc.mp4"]
}'FAQ
Questions, answered
Is x265 CRF 28 the same quality as x264 CRF 23?
Not on our clip. x265 at CRF 28 scored a VMAF of about 94 and x264 at CRF 23 about 97. x265 at CRF 23 matched x264 with a file 68% of the size.
Why doesn't my H.265 MP4 play on an iPhone or in QuickTime?
Often it's the tag. Re-mux it with -c copy -tag:v hvc1 so the file uses the hvc1 sample entry Apple players look for; nothing is re-encoded.
How do I encode 10-bit HEVC with ffmpeg?
Add -pix_fmt yuv420p10le to a libx265 encode. ffprobe then shows the Main 10 profile; our 8-bit source came out 2% smaller at 10-bit.
Can I encode H.265 with an API?
Yes. The engine has libx265: send the args to POST https://api.reelsdk.com/v1/ffmpeg with the video's URL in inputs. It runs ffmpeg 8.1 on a fresh machine per job for $0.02 per compute minute, billed per second, and failed jobs are free.
- Choose a CRF value in ffmpegWhat CRF does in libx264, the file size and VMAF score for CRF 18, 23, 28 and 33 on one clip, and how x265's scale differs.
- Compress a video with ffmpegShrink a video with ffmpeg: CRF 28 in x264 or x265, a smaller frame or a slower preset, with the size and quality each one gets you.
- Encode AV1 with ffmpegEncode AV1 with SVT-AV1 or libaom: presets 4, 8 and 12 against libaom and x264 on one clip, with file size, VMAF and time.
- Encode VP9 WebM with ffmpegMake a VP9 WebM with libvpx-vp9 and Opus: constant quality with -crf, the -b:v 0 rule, -row-mt, -cpu-used and two passes, measured.
- Convert HDR to SDR with ffmpegTone map HDR10 video to SDR with zscale and tonemap, check the color tags, and see why a pixel-format change alone looks washed out.
- Convert MOV to MP4 with ffmpegRemux an H.264 MOV to MP4 with -c copy in a fraction of a second, and transcode ProRes, which MP4 can't hold, to H.264.
- Set the video bitrate with ffmpegSet an average bitrate with -b:v, cap it with -maxrate and -bufsize, or run two passes to land on a file size, with measured results.
- Video compressionCompress a video to a size budget in one ffmpeg call: a 129 MB 1080p clip fits a 5 MB target at 4.6 MB, for under 1 cent.
Sources, checked November 2026
Ready to build?
Ship video from your app today
Your first $0.50 is free, and one key covers every endpoint.
