These commands transcode a video to AV1 using AMD Radeon VAAPI hardware acceleration. They were tested with a Radeon RX 7800 XT.
Your Radeon card must have the AV1 encoder hardware installed, this is only the case for RDNA3/Navi33 architectures, ie Radeon 7600++ - earlier RDNA2 cards have only the AV1 decoder installed, not the encoder
Speed-optimized command
Use this when you want to have super fast encoding speed (approximately 100% playback speed on 4K video on Radeon 7800 XT):
LIBVA_DRIVER_NAME=radeonsi ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -c:v av1_vaapi -rc_mode CQP -global_quality:v 105 -c:a copy output-av1.mkvReplace input.mp4 and output-av1.mkv with your file names. The default render device is /dev/dri/renderD128; if you are not sure which device belongs to your Radeon card, see How to Identify Which /dev/dri/renderD Device Is Your AMD Radeon GPU.
What the flags do
LIBVA_DRIVER_NAME=radeonsiforces the Radeon VAAPI driver. You may not need this on every distribution, but it helps when multiple GPU drivers are installed.-hwaccel vaapienables hardware-accelerated decoding.-hwaccel_device /dev/dri/renderD128points FFmpeg at the default DRM render node.-hwaccel_output_format vaapikeeps the decoded frames in video memory so the encoder can read them directly.-c:v av1_vaapiselects the AV1 VAAPI encoder.-rc_mode CQPuses constant-quantizer (CQP) rate control.-global_quality:v 105sets the encoder quality. Lower is higher quality and larger file; higher is smaller and lower quality.-c:a copycopies the audio stream without re-encoding.
File-size optimized command
For smaller files at the cost of encoding speed, use a higher global_quality and force the encoder to work harder with a pre-encode pass, VBAQ, B-frames and an extended GOP:
LIBVA_DRIVER_NAME=radeonsi ffmpeg \
-hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi \
-i input.mp4 \
-c:v av1_vaapi -rc_mode CQP -global_quality:v 140 \
-compression_level 29 \
-bf 4 \
-g 240 \
-c:a copy \
output-av1.mkvThis example uses the default render node. If your Radeon is at a different device, override RENDER_DEVICE or use the device found in How to Identify Which /dev/dri/renderD Device Is Your AMD Radeon GPU.
Wrapper script
Save this as transcode-av1-radeon.sh and run it with the input file; it will automatically write <basename>-av1.mkv next to the input:
#!/bin/bash
set -euo pipefail
RENDER_DEVICE="${RENDER_DEVICE:-/dev/dri/renderD128}"
if [ $# -ne 1 ]; then
echo "Usage: $0 <input video>" >&2
exit 1
fi
input="$1"
base="${input%.*}"
output="${base}-av1.mkv"
LIBVA_DRIVER_NAME=radeonsi ffmpeg \
-hwaccel vaapi -hwaccel_device "$RENDER_DEVICE" -hwaccel_output_format vaapi \
-i "$input" \
-c:v av1_vaapi -rc_mode CQP -global_quality:v 140 \
-compression_level 29 \
-bf 4 \
-g 240 \
-c:a copy \
"$output"Example:
chmod +x transcode-av1-radeon.sh
./transcode-av1-radeon.sh input.mp4
# Produces input-av1.mkvUse a different render node by exporting it:
RENDER_DEVICE=/dev/dri/renderD129 ./transcode-av1-radeon.sh input.mp4What the extra flags do
-global_quality:v 140: Targets “below standard quality” in the table, sacrificing some fidelity for a smaller file.-compression_level 29: Uses a bitmask that enables the Quality preset, a pre-encode analysis pass and Variance-Based Adaptive Quantization (VBAQ). The pre-encode pass collects per-frame statistics, and VBAQ redistributes bits away from flat/simple regions toward areas where the human eye is more likely to notice detail.-bf 4: Enables 4 B-frames. B-frames are not used by default because they slow encoding, but they improve compression by looking both backward and forward in time for motion.-g 240: Extends the GOP/keyframe interval to roughly 8 seconds at 30 FPS. Fewer I-frames means more consecutive P/B frames, which are much smaller.
Quality / bitrate guidance
The global_quality scale for av1_vaapi is 0–255, which is different from the 0–63 CRF scale used by CPU AV1 encoders. These are approximate mappings; always test with your own source:
| Target quality | CPU CRF (0–63) | av1_vaapi global_quality (0–255) | Typical 720p | Typical 1080p | Typical 4K | Typical 8K |
|---|---|---|---|---|---|---|
| High quality / near-transparent | 20 | 80 | ~3 – 5 Mbps | ~6 – 9 Mbps | ~25 – 35 Mbps | ~80 – 120 Mbps |
| Standard quality (recommended) | 26 | 105 | ~1.5 – 2.5 Mbps | ~3 – 5 Mbps | ~12 – 18 Mbps | ~40 – 60 Mbps |
| Moderate compression | 30 | 120 | ~1 – 1.8 Mbps | ~2 – 3.5 Mbps | ~8 – 12 Mbps | ~25 – 40 Mbps |
| Below standard quality | 35 | 140 | ~0.5 – 1 Mbps | ~1 – 2 Mbps | ~4 – 7 Mbps | ~12 – 25 Mbps |
| High compression / archival low | 40 | 160 | ~0.3 – 0.6 Mbps | ~0.6 – 1.2 Mbps | ~2 – 4 Mbps | ~6 – 12 Mbps |
The bitrates for 720p, 1080p and 8K are rough estimates scaled from the 4K values; always test with your own source.
Confirming AV1 hardware encoding is available
Check the relevant part of vainfo:
VAProfileAV1Profile0 : VAEntrypointVLD
VAProfileAV1Profile0 : VAEntrypointEncSliceOn this machine vainfo reports the AMD driver as:
vainfo: Driver version: Mesa Gallium driver 26.0.8-1ubuntu0.3 for AMD Radeon RX 7800 XT (radeonsi, navi32, ACO, DRM 3.64, 7.0.0-31-generic)Verification on this computer
Both commands were run against a short 1920×1080 test clip. The default (speed) command produced:
Output #0, matroska, to 'testsrc_av1_q105.mkv':
Stream #0:0: Video: av1 (Main) (AV01 / 0x31305641), vaapi(tv, progressive), 1920x1080, q=2-31, 30 fps
Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s
[out#0/matroska] video:82KiB audio:43KiB ... bitrate= 208.9kbits/s speed=16xThe file-size optimized command produced:
Output #0, matroska, to 'testsrc_optimized.mkv':
Stream #0:0: Video: av1 (Main) (AV01 / 0x31305641), vaapi(tv, progressive), 1920x1080, q=2-31, 30 fps
Stream #0:1: Audio: aac (LC), 44100 Hz, mono, fltp, 69 kb/s
[out#0/matroska] video:63KiB audio:43KiB ... bitrate= 178.5kbits/s speed=6.26xOn this simple clip the optimized command reduced the video bitrate by roughly 15% while running at about one third the speed.
On this particular PC the Radeon card is actually /dev/dri/renderD129 because /dev/dri/renderD128 belongs to the integrated Intel GPU. Always use the device that vainfo reports as your Radeon card.