Skip to content

AMF

currentMigrated from docs/encoders_hw/amf.mdx at 37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0

AMF (Advanced Media Framework) is AMD’s API for the video encode/decode block (VCN) on Radeon GPUs and Ryzen APUs. FFmpeg exposes it as h264_amf, hevc_amf and av1_amf. It is mainly a Windows route: on Linux most people encode through VAAPI with Mesa instead.

AMF is fast and cheap on power, but its compression efficiency has historically trailed NVENC and QSV, and all of them trail x264, x265 and SVT-AV1 at slow presets. It suits game capture, streaming and fast transcodes. For archival encodes, use a software encoder.

CodecSupport
H.264, HEVCAMD’s current support table starts at VCN 2.0: RDNA 1 (RX 5000), Cezanne (Ryzen 5000) APUs and everything after. H.264 is 8-bit; HEVC is 8 and 10-bit.
AV1VCN 4.0 and newer: RDNA 3 (RX 7000), RDNA 4 (RX 9000) and Phoenix (Ryzen 7040/8040, 8000G) or newer APUs, 8 and 10-bit. RDNA 1 and RDNA 2 (RX 6000) cannot encode AV1.
VP9No encoder.

The AMF runtime comes with the Windows Radeon driver. FFmpeg must be built with --enable-amf. On Linux the AMF runtime from the amdgpu-pro packages is required, and it initialises through Vulkan.

Constant QP is the simplest quality-targeted mode:

Terminal window
ffmpeg -i input.mkv -c:v hevc_amf -usage transcoding -quality quality -rc cqp -qp_i 24 -qp_p 24 -c:a copy output.mkv

-usage transcoding is the offline profile. -quality quality is a slow preset; high_quality is slower still. CQP makes size unpredictable; give -qp_b too when H.264 or AV1 uses B-frames. The scale is 0–51 for H.264 and HEVC and 0–255 for AV1, so AV1 values are several times higher:

Terminal window
ffmpeg -i input.mkv -c:v av1_amf -usage transcoding -quality high_quality -rc cqp -qp_i 100 -qp_p 100 -c:a copy output.mkv

For a size target, use peak-constrained VBR (also what FFmpeg picks when you give only -b:v):

Terminal window
ffmpeg -i input.mkv -c:v hevc_amf -usage transcoding -quality quality -rc vbr_peak -b:v 8M -maxrate 12M -c:a copy output.mkv

For 10-bit HEVC or AV1 pass -pix_fmt p010le. Rate control is chosen automatically if you leave -rc out: any -qp_*, -min_qp_* or -max_qp_* option means CQP, -b:v equal to -maxrate means CBR, otherwise peak VBR.

The closest thing to CRF is QVBR: -rc qvbr -qvbr_quality_level N with -preanalysis 1, since AMD’s API documentation says QVBR, HQVBR and HQCBR only work with pre-analysis enabled.

FFmpeg also has AMF filters that keep frames on the GPU, vpp_amf for scaling and format conversion and sr_amf for upscaling, but a plain command that uploads frames is the common case.

OptionWhat it does
-usagetranscoding, high_quality, lowlatency, lowlatency_high_quality, ultralowlatency, webcam. Sets the encoder’s overall tuning.
-qualitySpeed/quality preset: speed, balanced, quality, high_quality. The numeric values differ between codecs, so use the names.
-rccqp, cbr, vbr_peak, vbr_latency, qvbr, hqvbr, hqcbr. The last three need -preanalysis 1.
-qp_i, -qp_p, -qp_bQuantizers for -rc cqp. HEVC has no -qp_b.
-bf, -max_b_framesB-frames (H.264 and AV1, 0–3). The HEVC wrapper has no B-frame option.
-preanalysis 1Pre-analysis pass for better bit distribution on supported hardware. Adds latency; the -pa_* options tune it.
-vbaq 1 (H.264, HEVC), -aq_mode caq (AV1)Adaptive quantization.
-header_insertion_modeRepeat headers per GOP or frame; useful for streaming.
  • Quality presets, QP scales and -quality numbers differ between H.264, HEVC and AV1. Do not copy values across codecs.
  • An accepted option does not mean the hardware used it. Many auto defaults leave the choice to the driver, and pre-analysis and B-frames depend on the GPU generation.
  • If the encoder fails to open on Linux, AMF could not initialise (libamfrt64.so.1 or the amdgpu-pro runtime is missing). Switch to VAAPI.

Every private option of av1_amf in FFmpeg 9.0.2; h264_amf and hevc_amf have a similar but not identical set. -1 and auto leave the setting to the AMF driver. -qvbr_quality_level uses its own 0–51 scale.

ParameterTypeDefaultMeaningRange / named values
-usageint-1Use case that sets the encoder’s defaults: transcoding, high_quality, lowlatency, ultralowlatency, webcam, lowlatency_high_quality. -1 = driver default.-1 to 5; transcoding=0, ultralowlatency=2, lowlatency=1, webcam=3, high_quality=4, lowlatency_high_quality=5
-bitdepthint0Output bit depth, 8 or 10. 0 follows the input pixel format.0 to 10; 8=8, 10=10
-profileint-1AV1 profile (main); -1 = driver default.-1 to 1; main=1
-levelintautoAV1 level limit; auto lets the driver choose.-1 to 23; auto=-1, 2.0=0, 2.1=1, 2.2=2, 2.3=3, 3.0=4, 3.1=5, 3.2=6, 3.3=7, 4.0=8, 4.1=9, 4.2=10, 4.3=11, 5.0=12, 5.1=13, 5.2=14, 5.3=15, 6.0=16, 6.1=17, 6.2=18, 6.3=19, 7.0=20, 7.1=21, 7.2=22, 7.3=23
-qualityint-1Quality preset: high_quality, quality, balanced, speed. Same field as -preset.-1 to 100; high_quality=0, quality=30, balanced=70, speed=100
-presetint-1Alias of -quality.-1 to 100; high_quality=0, quality=30, balanced=70, speed=100
-latencyint-1Latency mode: none, power_saving_real_time, real_time, lowest_latency. -1 = driver default.-1 to 3; none=0, power_saving_real_time=1, real_time=2, lowest_latency=3
-rcint-1Rate control: cqp, cbr, vbr_peak, vbr_latency, qvbr, hqvbr, hqcbr. -1 picks cqp if any QP option is set, cbr if -b:v equals -maxrate, otherwise vbr_peak.-1 to 6; cqp=0, vbr_latency=1, vbr_peak=2, cbr=3, qvbr=4, hqvbr=5, hqcbr=6
-qvbr_quality_levelint-1Quality target for -rc qvbr.-1 to 51
-header_insertion_modeint-1When to repeat sequence headers: none, gop or frame. -1 = driver default.-1 to 2; none=0, gop=1, frame=2
-async_depthint16Frames queued on the GPU; higher improves throughput and adds latency.1 to 42
-preencodebooleanautoPre-encode pass that assists rate control; ignored with CQP.-1 to 1
-enforce_hrdbooleanautoEnforce HRD (decoder buffer) compliance.-1 to 1
-filler_databooleanautoInsert filler data to keep CBR output at the target rate.-1 to 1
-max_b_framesint-1Maximum consecutive B-frames the encoder may use (0–3).-1 to 3
-bfint-1B-frame pattern: number of B-frames between references (0–3), if the GPU supports them.-1 to 3
-high_motion_quality_boost_enablebooleanautoSpend more bits on high-motion scenes.-1 to 1
-min_qp_iint-1Lowest QP for I-frames.-1 to 255
-max_qp_iint-1Highest QP for I-frames.-1 to 255
-min_qp_pint-1Lowest QP for P-frames.-1 to 255
-max_qp_pint-1Highest QP for P-frames.-1 to 255
-min_qp_bint-1Lowest QP for B-frames.-1 to 255
-max_qp_bint-1Highest QP for B-frames.-1 to 255
-qp_pint-1Fixed QP for P-frames (CQP).-1 to 255
-qp_iint-1Fixed QP for I-frames (CQP).-1 to 255
-qp_bint-1Fixed QP for B-frames (CQP).-1 to 255
-skip_framebooleanautoLet rate control drop frames to hold the bitrate.-1 to 1
-aq_modeint-1Adaptive quantization: none or caq (content-adaptive).-1 to 1; none=0, caq=1
-forced_idrbooleanfalseMake forced I-frames key frames.0 to 1
-alignintnoneResolution alignment: none, 64x16 (reject other sizes) or 1080p (64×16 plus 1920×1080).1 to 3; 64x16=1, 1080p=2, none=3
-smart_access_videobooleanautoOn systems with an AMD APU and GPU, use both for better performance.-1 to 1
-preanalysisbooleanautoPre-analysis stage that feeds AQ, scene-change and lookahead decisions; enables the pa_* options.-1 to 1
-pa_activity_typeint-1Activity measure for pre-analysis: luma only (y) or yuv.-1 to 1; y=0, yuv=1
-pa_scene_change_detection_enablebooleanautoDetect scene changes in pre-analysis.-1 to 1
-pa_scene_change_detection_sensitivityint-1Scene-change sensitivity: low, medium, high.-1 to 2; low=0, medium=1, high=2
-pa_static_scene_detection_enablebooleanautoDetect static scenes in pre-analysis.-1 to 1
-pa_static_scene_detection_sensitivityint-1Static-scene sensitivity: low, medium, high.-1 to 2; low=0, medium=1, high=2
-pa_initial_qp_after_scene_changeint-1QP used immediately after a scene change.-1 to 51
-pa_max_qp_before_force_skipint-1QP threshold above which a frame may be skipped.-1 to 51
-pa_caq_strengthint-1Content-adaptive quantization strength: low, medium, high.-1 to 2; low=0, medium=1, high=2
-pa_frame_sad_enablebooleanautoUse frame SAD (sum of absolute differences) in pre-analysis.-1 to 1
-pa_ltr_enablebooleanautoLong-term reference management from pre-analysis.-1 to 1
-pa_lookahead_buffer_depthint-1Pre-analysis lookahead, in frames.-1 to 41
-pa_paq_modeint-1Perceptual AQ: none or caq.-1 to 1; none=0, caq=1
-pa_taq_modeint-1Temporal AQ: none, 1 or 2.-1 to 2; none=0, 1=1, 2=2
-pa_high_motion_quality_boost_modeint-1High-motion quality boost from pre-analysis: none or auto.-1 to 1; none=0, auto=1
-pa_adaptive_mini_gopbooleanautoAdapt the number of B-frames to the content.-1 to 1

Codec-specific generic initialization overrides

Section titled “Codec-specific generic initialization overrides”

The wrapper replaces these generic FFmpeg defaults for this encoder. -b is in bits/s; -g and -bf count frames. -1, and 0 for -b and -refs, leave the value to the preset, driver or rate-control logic.

Generic parameterDefault
-refs-1
-aspect0
-b0
-g-1
-qmin-1
-qmax-1