# AMF

Canonical URL: https://encode.wiki/tools/hardware-encoders/amf/
Content version: ca42e61ede0a24f789d7287a0001244ad22f4abf
Status: current
License: CC BY-SA 4.0
Checksum (SHA-256): a35b1d1586309febbc399eea5452470cb4086fe5bff1eec0e179b59d55ad2541

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](/tools/hardware-encoders/vaapi/) with Mesa instead.

## Hardware or software encoder?

AMF is fast and cheap on power, but its compression efficiency has historically trailed [NVENC](/tools/hardware-encoders/nvenc/#hardware-or-software-encoder) and [QSV](/tools/hardware-encoders/qsv/), and all of them trail [x264](/tools/software-encoders/x264/), [x265](/tools/software-encoders/x265/) and [SVT-AV1](/tools/software-encoders/svt-av1/) at slow presets. It suits game capture, streaming and fast transcodes. For archival encodes, use a software encoder.

## Which hardware supports what

| Codec | Support |
| --- | --- |
| H.264, HEVC | AMD'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. |
| AV1 | VCN 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. |
| VP9 | No 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.

## Quality-oriented encode

Constant QP is the simplest quality-targeted mode:

```sh
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:

```sh
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`):

```sh
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.

## Options that matter

| Option | What it does |
| --- | --- |
| `-usage` | `transcoding`, `high_quality`, `lowlatency`, `lowlatency_high_quality`, `ultralowlatency`, `webcam`. Sets the encoder's overall tuning. |
| `-quality` | Speed/quality preset: `speed`, `balanced`, `quality`, `high_quality`. The numeric values differ between codecs, so use the names. |
| `-rc` | `cqp`, `cbr`, `vbr_peak`, `vbr_latency`, `qvbr`, `hqvbr`, `hqcbr`. The last three need `-preanalysis 1`. |
| `-qp_i`, `-qp_p`, `-qp_b` | Quantizers for `-rc cqp`. HEVC has no `-qp_b`. |
| `-bf`, `-max_b_frames` | B-frames (H.264 and AV1, 0–3). The HEVC wrapper has no B-frame option. |
| `-preanalysis 1` | Pre-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_mode` | Repeat headers per GOP or frame; useful for streaming. |

## Pitfalls

- 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.

## Full option reference

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.

{/* ffmpeg-parameters:start */}

### Private options

| Parameter | Type | Default | Meaning | Range / named values |
| --- | --- | --- | --- | --- |
| `-usage` | `int` | `-1` | Use 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` |
| `-bitdepth` | `int` | `0` | Output bit depth, 8 or 10. 0 follows the input pixel format. | `0` to `10`; `8`=`8`, `10`=`10` |
| `-profile` | `int` | `-1` | AV1 profile (`main`); -1 = driver default. | `-1` to `1`; `main`=`1` |
| `-level` | `int` | `auto` | AV1 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` |
| `-quality` | `int` | `-1` | Quality preset: `high_quality`, `quality`, `balanced`, `speed`. Same field as `-preset`. | `-1` to `100`; `high_quality`=`0`, `quality`=`30`, `balanced`=`70`, `speed`=`100` |
| `-preset` | `int` | `-1` | Alias of `-quality`. | `-1` to `100`; `high_quality`=`0`, `quality`=`30`, `balanced`=`70`, `speed`=`100` |
| `-latency` | `int` | `-1` | Latency 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` |
| `-rc` | `int` | `-1` | Rate 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_level` | `int` | `-1` | Quality target for `-rc qvbr`. | `-1` to `51` |
| `-header_insertion_mode` | `int` | `-1` | When to repeat sequence headers: `none`, `gop` or `frame`. -1 = driver default. | `-1` to `2`; `none`=`0`, `gop`=`1`, `frame`=`2` |
| `-async_depth` | `int` | `16` | Frames queued on the GPU; higher improves throughput and adds latency. | `1` to `42` |
| `-preencode` | `boolean` | `auto` | Pre-encode pass that assists rate control; ignored with CQP. | `-1` to `1` |
| `-enforce_hrd` | `boolean` | `auto` | Enforce HRD (decoder buffer) compliance. | `-1` to `1` |
| `-filler_data` | `boolean` | `auto` | Insert filler data to keep CBR output at the target rate. | `-1` to `1` |
| `-max_b_frames` | `int` | `-1` | Maximum consecutive B-frames the encoder may use (0–3). | `-1` to `3` |
| `-bf` | `int` | `-1` | B-frame pattern: number of B-frames between references (0–3), if the GPU supports them. | `-1` to `3` |
| `-high_motion_quality_boost_enable` | `boolean` | `auto` | Spend more bits on high-motion scenes. | `-1` to `1` |
| `-min_qp_i` | `int` | `-1` | Lowest QP for I-frames. | `-1` to `255` |
| `-max_qp_i` | `int` | `-1` | Highest QP for I-frames. | `-1` to `255` |
| `-min_qp_p` | `int` | `-1` | Lowest QP for P-frames. | `-1` to `255` |
| `-max_qp_p` | `int` | `-1` | Highest QP for P-frames. | `-1` to `255` |
| `-min_qp_b` | `int` | `-1` | Lowest QP for B-frames. | `-1` to `255` |
| `-max_qp_b` | `int` | `-1` | Highest QP for B-frames. | `-1` to `255` |
| `-qp_p` | `int` | `-1` | Fixed QP for P-frames (CQP). | `-1` to `255` |
| `-qp_i` | `int` | `-1` | Fixed QP for I-frames (CQP). | `-1` to `255` |
| `-qp_b` | `int` | `-1` | Fixed QP for B-frames (CQP). | `-1` to `255` |
| `-skip_frame` | `boolean` | `auto` | Let rate control drop frames to hold the bitrate. | `-1` to `1` |
| `-aq_mode` | `int` | `-1` | Adaptive quantization: `none` or `caq` (content-adaptive). | `-1` to `1`; `none`=`0`, `caq`=`1` |
| `-forced_idr` | `boolean` | `false` | Make forced I-frames key frames. | `0` to `1` |
| `-align` | `int` | `none` | Resolution alignment: `none`, `64x16` (reject other sizes) or `1080p` (64×16 plus 1920×1080). | `1` to `3`; `64x16`=`1`, `1080p`=`2`, `none`=`3` |
| `-smart_access_video` | `boolean` | `auto` | On systems with an AMD APU and GPU, use both for better performance. | `-1` to `1` |
| `-preanalysis` | `boolean` | `auto` | Pre-analysis stage that feeds AQ, scene-change and lookahead decisions; enables the `pa_*` options. | `-1` to `1` |
| `-pa_activity_type` | `int` | `-1` | Activity measure for pre-analysis: luma only (`y`) or `yuv`. | `-1` to `1`; `y`=`0`, `yuv`=`1` |
| `-pa_scene_change_detection_enable` | `boolean` | `auto` | Detect scene changes in pre-analysis. | `-1` to `1` |
| `-pa_scene_change_detection_sensitivity` | `int` | `-1` | Scene-change sensitivity: `low`, `medium`, `high`. | `-1` to `2`; `low`=`0`, `medium`=`1`, `high`=`2` |
| `-pa_static_scene_detection_enable` | `boolean` | `auto` | Detect static scenes in pre-analysis. | `-1` to `1` |
| `-pa_static_scene_detection_sensitivity` | `int` | `-1` | Static-scene sensitivity: `low`, `medium`, `high`. | `-1` to `2`; `low`=`0`, `medium`=`1`, `high`=`2` |
| `-pa_initial_qp_after_scene_change` | `int` | `-1` | QP used immediately after a scene change. | `-1` to `51` |
| `-pa_max_qp_before_force_skip` | `int` | `-1` | QP threshold above which a frame may be skipped. | `-1` to `51` |
| `-pa_caq_strength` | `int` | `-1` | Content-adaptive quantization strength: `low`, `medium`, `high`. | `-1` to `2`; `low`=`0`, `medium`=`1`, `high`=`2` |
| `-pa_frame_sad_enable` | `boolean` | `auto` | Use frame SAD (sum of absolute differences) in pre-analysis. | `-1` to `1` |
| `-pa_ltr_enable` | `boolean` | `auto` | Long-term reference management from pre-analysis. | `-1` to `1` |
| `-pa_lookahead_buffer_depth` | `int` | `-1` | Pre-analysis lookahead, in frames. | `-1` to `41` |
| `-pa_paq_mode` | `int` | `-1` | Perceptual AQ: `none` or `caq`. | `-1` to `1`; `none`=`0`, `caq`=`1` |
| `-pa_taq_mode` | `int` | `-1` | Temporal AQ: `none`, `1` or `2`. | `-1` to `2`; `none`=`0`, `1`=`1`, `2`=`2` |
| `-pa_high_motion_quality_boost_mode` | `int` | `-1` | High-motion quality boost from pre-analysis: `none` or `auto`. | `-1` to `1`; `none`=`0`, `auto`=`1` |
| `-pa_adaptive_mini_gop` | `boolean` | `auto` | Adapt the number of B-frames to the content. | `-1` to `1` |

### 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 parameter | Default |
| --- | --- |
| `-refs` | `-1` |
| `-aspect` | `0` |
| `-b` | `0` |
| `-g` | `-1` |
| `-qmin` | `-1` |
| `-qmax` | `-1` |

{/* ffmpeg-parameters:end */}
