Configure AMP in FFmpeg libx265
This article provides a quick guide on how to configure the
Asymmetric Motion Partitions (AMP) option in the libx265
HEVC encoder using FFmpeg. You will learn what the AMP feature does, how
it impacts your encoding speed and file size, and the exact command-line
syntax required to enable or disable it for your video compression
workflows.
What is AMP in libx265?
Asymmetric Motion Partitions (AMP) is a coding tool in the HEVC (H.265) standard that allows block partitioning of Coding Tree Units (CTUs) into asymmetric sizes (such as 1/4 and 3/4 splits) rather than just symmetric halves. Enabling AMP improves compression efficiency, resulting in higher video quality at a lower bitrate. However, because the encoder must analyze more partition shapes, enabling AMP significantly increases encoding complexity and CPU usage.
How to Configure AMP in FFmpeg
To configure AMP in FFmpeg, you must pass the amp option
to the libx265 encoder using the -x265-params
private flag.
By default, the amp option is disabled in faster x265
presets and enabled automatically in slower presets (like
veryslow and placebo).
Prerequisite: Rectangular Motion Partitions (rect)
AMP cannot be enabled unless Rectangular Motion Partitions
(rect) is also enabled. If you manually enable AMP, you
must also ensure rect is enabled.
Command to Enable AMP
To manually force AMP on, set both rect=1 and
amp=1 inside the -x265-params argument:
ffmpeg -i input.mp4 -c:v libx265 -x265-params rect=1:amp=1 output.mp4Command to Disable AMP
If you are using a slow preset that enables AMP by default, but you
want to speed up the encoding process, you can manually disable it by
setting amp=0:
ffmpeg -i input.mp4 -c:v libx265 -preset veryslow -x265-params amp=0 output.mp4Summary of Parameter Values
amp=1(ortrue): Enables Asymmetric Motion Partitions. Requiresrect=1to function. Increases compression efficiency at the cost of encoding speed.amp=0(orfalse): Disables Asymmetric Motion Partitions. Decreases encoding time but may slightly increase file size for the same quality level.