Verify FFmpeg Linux GPU Encoding
This article provides a straightforward guide on how to verify if your Linux GPU is actively hardware-accelerating your FFmpeg encoding tasks. You will learn how to check your command syntax for GPU-specific codecs and use real-time monitoring tools for NVIDIA, AMD, and Intel graphics cards to confirm your hardware is doing the heavy lifting.
Check Your FFmpeg Command
The quickest indicator that FFmpeg is attempting to use your GPU is
the command you executed. Standard CPU encoding typically uses
libx264 or libx265. If your command is
leveraging the GPU, you should see specific hardware-accelerated codecs
inside your command string:
- NVIDIA (NVENC): Look for
h264_nvencorhevc_nvenc. - AMD (AMF/VAAPI): Look for
h264_amf,hevc_amf, orh264_vaapi. - Intel (Quick Sync/VAAPI): Look for
h264_qsv,hevc_qsv, orh264_vaapi.
While a correct command starts the process, you must use system monitoring tools to confirm the hardware is actually processing the load.
Monitor NVIDIA GPUs
If you are using an NVIDIA graphics card, the proprietary driver
includes a powerful command-line utility called
nvidia-smi.
Open a new terminal window while your FFmpeg command is running and execute:
nvidia-smiLook at the output table under the Processes section
at the bottom. If FFmpeg is successfully utilizing the GPU, you will see
ffmpeg listed by name under the process list, alongside its
dedicated VRAM usage. You can also monitor the GPU-Util
percentage near the top to see the overall rendering and encoding
load.
To watch this update in real-time every second, use:
watch -n 1 nvidia-smiMonitor AMD and Intel GPUs
For AMD and Intel graphics, Linux offers open-source tools that display GPU engine utilization.
Using nvtop
Despite its name, nvtop (Neat Videocard Top) supports
NVIDIA, AMD, and Intel GPUs. It provides a visual, interactive bar chart
of your GPU usage in the terminal.
- Install it via your package manager (e.g.,
sudo apt install nvtop). - Launch it by typing
nvtop. - Look at the process list at the bottom to verify
ffmpegis active, and check the command’s corresponding device utilization percentage.
Using intel-gpu-top (Intel Only)
If you are using Intel Quick Sync Video (QSV) or Intel graphics via VAAPI, you can use the dedicated Intel tool.
- Install the Intel GPU tools package (e.g.,
sudo apt install intel-gpu-tools). - Run the monitoring tool with root privileges:
sudo intel-gpu-top. - Watch the Video/Enhance or Video bar. If FFmpeg is encoding on the GPU, this specific engine metric will spike well above 0%.
Verify via FFmpeg Console Output
When you launch your encoding string, closely read the initial text stream that FFmpeg outputs to the terminal.
If FFmpeg fails to initialize your GPU driver or lacks the proper
environment variables, it will print an error message (such as
Device creation failed or Driver not found)
and either crash immediately or automatically fallback to software CPU
encoding. If the stream continues to process frames smoothly without
showing hardware initialization errors in the first few lines, your
configuration is likely correct.