Configure limit-modes in FFmpeg libx265
This article explains how to configure the limit-modes
option in the FFmpeg libx265 encoder. You will learn what
the limit-modes parameter does, how to structure the FFmpeg
command line syntax, and how this setting affects your video encoding
speed and efficiency.
What is limit-modes in x265?
The limit-modes option is an efficiency optimization
feature in the HEVC/H.265 encoder (libx265). When enabled,
it instructs the encoder to skip the evaluation of complex rectangular
and asymmetric motion partition shapes if the simpler symmetric
partitions (like square blocks) already yield a good prediction.
Enabling this feature reduces encoding time with a negligible impact on visual quality.
FFmpeg Syntax for limit-modes
To configure x265-specific settings in FFmpeg, you must pass them
through the -x265-params flag. Multiple parameters within
this flag are separated by colons.
The basic syntax to enable limit-modes is:
-x265-params limit-modes=1To disable it, use:
-x265-params limit-modes=0Example FFmpeg Command
Below is a practical command line example that transcodes an input
video using libx265 with limit-modes
enabled:
ffmpeg -i input.mp4 -c:v libx265 -crf 23 -preset medium -x265-params limit-modes=1 output.mp4Combining with Other Parameters
If you want to configure limit-modes alongside other
x265 parameters (such as no-info or aq-mode),
separate them with colons inside the -x265-params
argument:
ffmpeg -i input.mp4 -c:v libx265 -crf 22 -x265-params limit-modes=1:aq-mode=3:no-info=1 output.mp4When to Use limit-modes
- Enable (
limit-modes=1): Use this when you are encoding with slower presets (likeslow,slower, orveryslow) and want to speed up the encoding process without noticeably degrading the output quality. - Disable (
limit-modes=0): Use this (or leave it at default) if you require absolute maximum compression efficiency and do not mind the extra processing time required to evaluate every partition shape.