Configure HEVC AMF Rate Control and Quality in FFmpeg

This article provides a practical guide on how to configure the rate control and quality settings for the AMD Advanced Media Framework (AMF) HEVC encoder (hevc_amf) in FFmpeg. You will learn about the available rate control modes, quality presets, and specific command-line arguments required to optimize your hardware-accelerated video encodes for streaming, archiving, or recording.

Rate Control Modes in hevc_amf

Rate control determines how the encoder allocates bitrate across the video frames. The hevc_amf encoder supports several rate control modes via the -rc parameter.

1. Constant QP (CQP)

Constant QP mode encodes every frame using a fixed quantization parameter. This mode prioritizes image quality over file size and is ideal for local recording and archiving. Lower QP values result in higher quality and larger file sizes.

2. Constant Bitrate (CBR)

CBR maintains a strict, consistent bitrate throughout the video. This is best suited for live streaming environments where bandwidth is limited and predictable data flow is required.

3. Variable Bitrate (VBR Peak)

VBR adjusts the bitrate depending on the complexity of the scene, while ensuring the bitrate does not exceed a specified peak limit. This is highly efficient for general video playback and local storage.


Quality Presets and Optimization

To balance encoding speed and output quality, hevc_amf offers a direct quality preset option alongside other tuning parameters.

The -quality Parameter

You can set the overall encoding quality preference using the -quality option. This adjusts internal encoder settings to favor either execution speed or compression efficiency.

ffmpeg -i input.mp4 -c:v hevc_amf -quality quality output.mp4

Additional Quality Adjustments

For further optimization, you can combine rate control and quality presets with the following parameters:

Comprehensive High-Quality Example

This command uses VBR with the highest quality preset, a defined keyframe interval, and a 10-bit color profile:

ffmpeg -i input.mp4 -c:v hevc_amf -rc vbr_peak -b:v 6M -maxrate 10M -quality quality -profile:v main10 -g 120 output.mp4