Transcode H264 to HEVC via AMD AMF in FFmpeg

This article provides a brief overview of how to leverage AMD’s Advanced Media Framework (AMF) inside FFmpeg on Linux to convert H264 videos into the resource-efficient HEVC (H.265) format. It details the precise command line syntax, required hardware acceleration flags, and key parameters needed to ensure your AMD graphics card handles the processing load.

The FFmpeg AMF Transcoding Command

To hardware transcode an H264 video to HEVC using AMD AMF on a Linux system, execute the following command structure in your terminal:

ffmpeg -init_hw_device amf=amd -i input_h264.mp4 -c:v hevc_amf -c:a copy output_hevc.mp4

Command Breakdown

Fine-Tuning the Encoding Quality

You can control the bitrate and quality by appending encoder-specific parameters to the end of your statement:

ffmpeg -init_hw_device amf=amd -i input_h264.mp4 -c:v hevc_amf -b:v 4M -quality quality output_hevc.mp4

The -b:v 4M parameter locks the target video bitrate to 4 Megabits per second, while -quality quality instructs the AMF backend to prioritize visual fidelity over compression speed.

Prerequisites for Linux Users

Unlike Windows systems where AMF functions out of the box via DirectX, utilizing the hevc_amf encoder on Linux requires an explicitly configured environment. Your FFmpeg binary must be compiled with the --enable-amf flag, and your operating system requires the proprietary AMDGPU-Pro driver stack or the AMF Vulkan component initialization packages to expose the amf hardware device interface. If your setup relies purely on open-source Mesa drivers, the native open-source alternative encoder flag -c:v hevc_vaapi is typically used instead.