C.W.K.
Stream
Lesson 02 of 10 · published

H.265 / HEVC (libx265) — Half the Bits, Apple's Default

~12 min · h265, hevc, libx265, apple

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

The 50% codec

H.265 (HEVC) is the successor to H.264 and gives roughly the same visual quality at ~50% of the bitrate. Apple adopted it for Photos, FaceTime, and as the default for iPhone video capture. Most modern devices can decode it. The catch: encoding is 2–10x slower than libx264 in CPU mode, and licensing pushed it out of browsers (Safari yes, Chrome only on hardware).

When to use it

Archival masters where storage matters, Apple-ecosystem distribution, 4K HDR content (Dolby Vision rides on top of HEVC). Avoid for web uploads where the audience is browser-mixed — H.264 still wins on universal compatibility, and YouTube re-encodes everything anyway.

CRF scale shifts

libx265 CRF is roughly 'libx264 CRF + 6 for the same perceptual quality'. So libx264 -crf 18libx265 -crf 24. Don't carry over the CRF number from H.264 muscle memory.

The hvc1 tag

By default, libx265 writes the hev1 codec tag in MP4. QuickTime and Apple TV refuse to play hev1 (same bytes, different label) — you must add -tag:v hvc1 for Apple-friendly output.

Code

libx265 recipes·bash
# Daily — small file, Apple-friendly
ffmpeg -i in.mp4 \
  -c:v libx265 -crf 24 -preset slow -tag:v hvc1 \
  -pix_fmt yuv420p \
  -c:a aac -b:a 192k \
  -movflags +faststart \
  out_h265.mp4

# Archive master
ffmpeg -i in.mp4 \
  -c:v libx265 -crf 22 -preset slower -tag:v hvc1 \
  -pix_fmt yuv420p10le \
  -c:a aac -b:a 256k \
  master_h265.mp4

# 10-bit (better gradient handling, slight quality bump on 1080p)
# yuv420p10le instead of yuv420p
Hardware HEVC on Apple Silicon·bash
# 5–10x faster than libx265, slightly worse compression efficiency
ffmpeg -i in.mp4 \
  -c:v hevc_videotoolbox -b:v 6M -tag:v hvc1 \
  -pix_fmt yuv420p \
  -c:a aac -b:a 192k \
  -movflags +faststart \
  out_hw.mp4

# Caveat: hevc_videotoolbox uses bitrate, not CRF. -b:v 6M is the rough
# equivalent of libx265 -crf 24 for 1080p content.

External links

Exercise

Encode one source three ways: libx264 -crf 20 -preset slow, libx265 -crf 26 -preset slow -tag:v hvc1, hevc_videotoolbox -b:v 6M -tag:v hvc1. Note file sizes and encode times. Open all three in QuickTime — does HEVC play? Now open them in Chrome — does HEVC play? Identify which combination is fastest, smallest, most compatible.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.