Configure fast-intra in FFmpeg libx265
This article explains how to configure the fast-intra
option in the FFmpeg libx265 encoder to speed up H.265/HEVC
video encoding. You will learn the correct command-line syntax for
applying this setting and understand how it impacts both your encoding
performance and the final video quality.
What is the fast-intra Option?
In the HEVC (H.265) standard, intra-prediction (compressing space within a single frame) involves analyzing up to 35 different angular prediction modes to find the most efficient one. This process is highly CPU-intensive.
The fast-intra option in libx265 speeds up
this process. When enabled, the encoder performs a simplified, faster
evaluation of these intra modes, significantly reducing encoding time at
the expense of a minor loss in compression efficiency (slightly larger
file sizes or minor quality reduction at the same bitrate).
How to Configure fast-intra in FFmpeg
Because fast-intra is a native option of the underlying
x265 library rather than a standard FFmpeg flag, you must
pass it to the encoder using the -x265-params flag.
To enable fast-intra, use the following command
structure:
ffmpeg -i input.mp4 -c:v libx265 -x265-params fast-intra=1 output.mp4To explicitly disable fast-intra (which is the default
behavior for slower presets to ensure maximum quality), set the value to
0:
ffmpeg -i input.mp4 -c:v libx265 -x265-params fast-intra=0 output.mp4Combining fast-intra with Other Parameters
If you are already passing other parameters through
-x265-params, you can append fast-intra by
separating the arguments with a colon (:):
ffmpeg -i input.mp4 -c:v libx265 -crf 23 -x265-params fast-intra=1:keyint=240 output.mp4When to Use fast-intra
- Enable it (fast-intra=1): When you are performing live streaming, doing draft renders, or encoding on low-power hardware where CPU resources are limited and encoding speed is a priority.
- Disable it (fast-intra=0): When archiving video or preparing final renders where file size optimization and maximum visual quality are more important than how long the encoding process takes.