| tags |
|
||||||
|---|---|---|---|---|---|---|---|
| date-created | 2026-03-17 22:45:53 +0000 | ||||||
| date-modified | 2026-03-17 23:09:58 +0000 |
Also see [[FFmpeg AV1 Hybrid Encoding Pipeline]]
This note details the optimal hardware encoding pipelines for compressing video to HEVC (H) using an AMD Radeon discrete GPU.
To ensure maximum performance and bypass brittle Linux translation layers in WSL2, the WSL commands utilise the Interop feature to call the native Windows ffmpeg.exe binary directly from the Linux terminal.
CQP locks the compression algorithm to a strict mathematical value across the entire video. It guarantees consistent mathematical quality but results in highly unpredictable file sizes. It is best suited for archiving raw footage or creating intermediate files.
Note: The AMD VBAQ (Variance Based Adaptive Quantisation) feature fundamentally conflicts with CQP and is automatically disabled when using this method.
ffmpeg.exe -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 \
-c:v hevc_amf -quality quality -rc cqp -qp_i 28 -qp_p 28 -qp_b 28 \
-c:a copy \
output_cqp.mkvffmpeg -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 `
-c:v hevc_amf -quality quality -rc cqp -qp_i 28 -qp_p 28 -qp_b 28 `
-c:a copy `
output_cqp.mkvVariable Bitrate (VBR) paired with Variance Based Adaptive Quantisation (VBAQ) dynamically analyses the visual complexity of every frame. It steals bits from flat, simple backgrounds and reallocates them to complex textures where human eyes need the detail most. This is the gold standard for everyday viewing, streaming, and hitting strict file size targets.
ffmpeg.exe -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 \
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 5M -maxrate 7M -vbaq 1 \
-c:a copy \
output_vbaq.mkvffmpeg -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 `
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 5M -maxrate 7M -vbaq 1 `
-c:a copy `
output_vbaq.mkv-hwaccel d3d11va: Instructs FFmpeg to use Direct3D 11 Video Acceleration for hardware decoding.-hwaccel_device 1: Routes the workload to the discrete GPU (index 1). Ensure this flag is placed before the input file.-c:v hevc_amf: Calls the AMD Advanced Media Framework encoder to physically compress the video into HEVC.-quality quality: An AMF preset that explicitly prioritises visual fidelity over absolute encoding speed.-rc cqp/-qp_i 28/-qp_p 28/-qp_b 28: Sets the rate control to Constant Quantisation, locking the I, P, and B frames to a compression value of 28. Lower values increase quality and file size; higher values degrade quality to save space.-rc vbr_peak: Sets the rate control to a peak-constrained Variable Bitrate, allowing the encoder to adjust compression frame by frame.-b:v 5M: Sets the target average video bitrate (data budget) to 5 Megabits per second.-maxrate 7M: Sets a hard ceiling of 7 Megabits per second to prevent file size bloat during complex action scenes.-vbaq 1: Explicitly enables Variance Based Adaptive Quantisation to optimise detail retention in complex areas.-c:a copy: Stream-copies the original audio track without re-encoding it, preserving quality and saving CPU cycles.
When encoding for specific network conditions, Variable Bitrate (VBR) paired with Variance Based Adaptive Quantisation (VBAQ) provides the optimal balance of visual fidelity and predictable file sizes.
For harsh network conditions, reducing the physical resolution is necessary so the encoder is not starved of data. The filter -vf "scale=720:-2" locks the width to 720 pixels and automatically calculates the height to maintain the aspect ratio, ensuring the dimension remains mathematically divisible by two.
- Target: 800 kbps
- Max: 1200 kbps
- Resolution: Scaled to 720p width
ffmpeg.exe -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 \
-vf "scale=720:-2" \
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 800k -maxrate 1200k -vbaq 1 \
-c:a copy \
output_harsh_mobile.mkvffmpeg -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 `
-vf "scale=720:-2" `
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 800k -maxrate 1200k -vbaq 1 `
-c:a copy `
output_harsh_mobile.mkv- Target: 2 Mbps
- Max: 3 Mbps
- Resolution: Native 1080p
ffmpeg.exe -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 \
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 2M -maxrate 3M -vbaq 1 \
-c:a copy \
output_standard_mobile.mkvffmpeg -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 `
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 2M -maxrate 3M -vbaq 1 `
-c:a copy `
output_standard_mobile.mkv- Target: 5 Mbps
- Max: 7.5 Mbps
- Resolution: Native 1080p
ffmpeg.exe -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 \
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 5M -maxrate 7.5M -vbaq 1 \
-c:a copy \
output_broadband.mkvffmpeg -hwaccel d3d11va -hwaccel_device 1 -i input.mp4 `
-c:v hevc_amf -quality quality -rc vbr_peak -b:v 5M -maxrate 7.5M -vbaq 1 `
-c:a copy `
output_broadband.mkv