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

x265
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -preset medium \
  -tag:v hvc1 -c:a copy hevc.mp4

CRF 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

  1. 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.mp4
  2. Encode 10-bit HEVC

    -pix_fmt yuv420p10le makes 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.mp4
  3. Check the codec, profile and tag

    ffprobe shows what you wrote. Ours printed hevc,Main,hvc1,yuv420p for 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

The flags in these commands
FlagWhat it doesUsed here
-c:v libx265Encodes the video as HEVC with x265Every encode
-crf 28Quality target from 0 to 51; 28 is the libx265 default, lower is betterEvery encode
-preset mediumEncoder speed against compression; medium is the defaultCRF 28
-tag:v hvc1Writes the hvc1 sample entry that Apple players look forEvery encode
-pix_fmt yuv420p10le10-bit 4:2:0 output, which x265 encodes as Main 1010-bit
-x265-params pass=1Passes options straight to x265, for example the pass number of a two-pass encodeNot 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.

terminalTry it
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"]
  }'
hevc.mp4 from the API: HEVC Main with the hvc1 tag, about 1.7 MB for 11 seconds.Input: clip.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.

Ready to build?

Ship video from your app today

Your first $0.50 is free, and one key covers every endpoint.

Moonlit lake with a lit cabin under the mountains