H.265 (HEVC) compresses much better than H.264, but encoding it can fail in several ways.
Error 1: libx265 not found
Error message
Unknown encoder 'libx265'
FFmpeg 8.1 then also prints:
Error opening output files: Encoder not found
Cause
Your FFmpeg build doesn’t include libx265. This happens with self-built FFmpeg and with reduced distribution packages such as Fedora’s standard ffmpeg-free.
Ubuntu / Debian’s stock package is not one of them. The apt build includes
libx265. Here are three entries in a row from theconfiguration:line of Ubuntu’sffmpeg 6.1.1-3ubuntu5:--enable-libwebp --enable-libx265 --enable-libxml2If an apt install still gives
Unknown encoder 'libx265', runwhich -a ffmpeg. Another FFmpeg (a self-built one, or a snap) is probably ahead of it on your PATH.
How to check
ffmpeg -buildconf | grep x265
If --enable-libx265 appears, your build has libx265. If nothing appears, it doesn’t.
How to fix
Ubuntu/Debian — install a full build:
# Ubuntu only: enable the universe repository (Debian has ffmpeg in main)
sudo add-apt-repository universe
sudo apt update && sudo apt install ffmpeg
If that still doesn’t work, use a static build (one program file with the libraries built in):
# Static build (john van sickle)
wget https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz
tar -xf ffmpeg-release-amd64-static.tar.xz
macOS:
brew install ffmpeg
Use another HEVC encoder:
# NVENC (NVIDIA hardware encoding)
ffmpeg -i input.mp4 -c:v hevc_nvenc output.mp4
# VideoToolbox (macOS)
ffmpeg -i input.mp4 -c:v hevc_videotoolbox output.mp4
# QSV (Intel Quick Sync)
ffmpeg -i input.mp4 -c:v hevc_qsv output.mp4
Error 2: HEVC won’t play on iPhone or Apple devices
Symptom
An HEVC file made with FFmpeg won’t play on an iPhone or a Mac, or shows no thumbnail.
Cause
Apple devices expect the HEVC tag hvc1 (a code inside the file that names the format). FFmpeg writes hev1 by default.
How to fix
Add -tag:v hvc1:
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -tag:v hvc1 output.mp4
Error 3: Profile or level issues
Error message
x265 [error]: main profile not supported, internal bit depth 10.
[libx265 @ 0000026dae75f7c0] Invalid or incompatible profile set: main.
How to fix
Match the profile to the bit depth:
Setting -profile:v main (an 8-bit profile) on 10-bit video causes this error. Set the bit depth with -pix_fmt too. -profile:v main10 alone does not make the output 10-bit; 8-bit video is still written as Main profile.
# Main profile (8-bit, best compatibility)
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -pix_fmt yuv420p -profile:v main output.mp4
# Main10 profile (10-bit, for HDR)
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -pix_fmt yuv420p10le -profile:v main10 output.mp4
Common level settings:
libx265 ignores -level:v. Set the level with level-idc inside -x265-params. Without high-tier=0, the stream is written as High tier.
# Specify an explicit level (improves device compatibility)
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -x265-params level-idc=4.1:high-tier=0 output.mp4
Error 4: File size is larger than expected
If H.265 gives a larger file than H.264, your CRF value is probably too low. CRF sets the quality: a lower value means higher quality and a bigger file.
Recommended CRF values
| Use case | CRF | Notes |
|---|---|---|
| High-quality archive | 18–22 | About H.264 CRF 16–20 |
| Balanced (recommended) | 24–28 | About H.264 CRF 22–26 |
| Small-size priority | 30–34 | Visible quality loss |
# Balanced setup
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset medium -c:a aac output.mp4
Error 5: Encoding is extremely slow
How to fix
Switch the preset to fast or faster:
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast output.mp4
preset trade-offs (speed vs. quality):
ultrafast > superfast > veryfast > faster > fast > medium > slow > slower > veryslow
← faster, larger files slower, smaller files →
Error 6: x265 log spam makes it look frozen
How to fix
x265 writes its own x265 [info] lines to stderr. In FFmpeg 8.1, -v quiet hides them too, and -stats keeps only the progress line (FFmpeg 8.0 and earlier also need -x265-params log-level=error):
ffmpeg -v quiet -stats -i input.mp4 -c:v libx265 -crf 26 output.mp4
Baseline H.265 Encoding Commands
# Basic (quality-first)
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -c:a aac output.mp4
# Apple compatibility
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -tag:v hvc1 -c:a aac output.mp4
# Speed-first
ffmpeg -i input.mp4 -c:v libx265 -crf 26 -preset fast -c:a aac output.mp4
Frequently Asked Questions
Why does HEVC fail in browsers?
It depends on the browser and the device. Safari plays HEVC from version 11. Chrome 107+ and Firefox 134+ (Windows; 136+ on macOS, 137+ on Linux) play it when the device can decode HEVC in hardware (on the GPU or a similar chip). For video on the web, convert to H.264, which all major browsers play. Safari plays AV1 only on devices with AV1 hardware decoding, such as iPhone 15 Pro.
My HEVC plays in VLC but not in Premiere — why?
Premiere imports HEVC (H.265) directly; it is on Adobe’s list of supported formats. That list mentions the Microsoft Store HEVC extension only for importing HEIF images on Windows. If a file still won’t open, convert it to H.264 with the command in the next answer. VLC plays it because it has its own HEVC decoder.
How do I quickly convert HEVC to H.264?
Run ffmpeg -i in.mp4 -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k out.mp4. CRF sets quality, not size, so the H.264 file won’t necessarily be close to the HEVC file’s size. In a test with FFmpeg 8.1 on a 10-second 1080p clip of Big Buck Bunny (CC BY 3.0), settings with almost the same VMAF (a video quality score) gave 4.94 MB for libx265 at CRF 25 and 7.12 MB for libx264 at CRF 23.
What is the difference between HEVC and H.265?
None. They are the same standard: H.265 is the ITU name and HEVC is the MPEG name. The file extension doesn’t change either.
Will I lose quality re-encoding HEVC to H.264?
A little. H.264 needs 30–50% more bitrate for the same visual quality. In a test with FFmpeg 8.1 on a 1080p clip of Big Buck Bunny, H.264 at CRF 20 and HEVC at CRF 22 got almost the same VMAF.
Related Articles
- Compressing Video — H.264 vs H.265 by CRF
- Video Compression Tool (Browser-based)
- Common FFmpeg Errors and Fixes
Primary source: trac.ffmpeg.org/wiki/Encode/H.265