How to Check Supported Codecs and Hardware Acceleration with FFmpeg
When using FFmpeg to process videos, we often need to know exactly which codec formats it supports and whether our computer hardware (like a GPU) can be used to accelerate video processing. If hardware acceleration is available, video processing can be much faster. This article teaches you the most direct way to check this information.
1. View All Supported Codecs
The easiest way to find out which audio and video formats your FFmpeg can handle is to have it list them itself.
1. View All Codecs
Open your command line terminal (CMD or PowerShell in Windows, Terminal in macOS or Linux) and enter the following command:
ffmpeg -codecsAfter running it, you'll see a long list. Each line has a similar format, and the key is to understand the letters at the beginning:
Codecs:
D..... = Decoding supported
.E.... = Encoding supported
..V... = Video codec
..A... = Audio codec
..S... = Subtitle codec
...I.. = Intra frame-only codec
....L. = Lossy compression
.....S = Lossless compression
-------
D.V.L. h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
DEV.LS h264_amf AMD AMF H.264 Encoder (codec h264)
DEV.L. h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)
D.A.L. aac AAC (Advanced Audio Coding)How to read this list?
- The letters in the first column are the most important. For example,
D.V.L.means it's a codec that supports Decoding, is a Video codec, and uses Lossy compression. - If both
DandEare present, it means the format can both be decoded (read) and encoded (generated). - The second column is the codec name, such as
h264,h264_nvenc,aac. In FFmpeg commands, we use these names to specify codecs. - The third column is the description, which helps you understand what it is.
2. View Only Encoders or Decoders
If the list is too long, you can also view only the parts you're interested in.
View only supported encoders:
bashffmpeg -encodersView only supported decoders:
bashffmpeg -decoders
This makes it easier to find what you need.
2. Check Hardware Acceleration Support
Hardware acceleration generally involves two aspects: first, whether FFmpeg itself supports a specific hardware acceleration technology, and second, whether there are corresponding codecs that can utilize this technology.
Step 1: Check Which Hardware Acceleration Technologies FFmpeg Supports
This command tells you which hardware acceleration features were included when your version of FFmpeg was compiled.
ffmpeg -hwaccelsYou might see output like this:
Hardware acceleration methods:
vaapi
qsv
cuda
cuvid
d3d11va
videotoolboxThese names correspond to different technologies and vendors:
cuda,cuvid,nvenc: Primarily for NVIDIA GPUs.nvencis mainly for encoding,cuvidmainly for decoding.qsv: Intel integrated graphics' Quick Sync Video technology.vaapi,vdpau: Common video acceleration interfaces on Linux systems, often used with Intel and AMD GPUs.d3d11va,dxva2: Windows-specific, based on DirectX, mainly for decoding.videotoolbox: macOS-specific.amf: For AMD GPUs.
If this list is empty, it means your FFmpeg version does not support any hardware acceleration.
Step 2: Find Codecs Corresponding to the Hardware Technology
Once you know which technology is supported, you can look for the specific codecs that use it. These codecs usually have a special suffix, such as _nvenc (NVIDIA encoding), _qsv (Intel encoding), _cuvid (NVIDIA decoding).
You can use grep (Linux/macOS) or findstr (Windows) to filter quickly.
If you have an NVIDIA GPU:
Find hardware encoders:
bash# Linux or macOS ffmpeg -encoders | grep nvenc # Windows ffmpeg -encoders | findstr "nvenc" # Example output V....D av1_nvenc NVIDIA NVENC av1 encoder (codec av1) V....D h264_nvenc NVIDIA NVENC H.264 encoder (codec h264) V....D hevc_nvenc NVIDIA NVENC hevc encoder (codec hevc)Find hardware decoders:
bash# Linux or macOS ffmpeg -decoders | grep cuvid # Windows ffmpeg -decoders | findstr "cuvid" # Example output V..... av1_cuvid Nvidia CUVID AV1 decoder (codec av1) V..... h264_cuvid Nvidia CUVID H264 decoder (codec h264) V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc) V..... mjpeg_cuvid Nvidia CUVID MJPEG decoder (codec mjpeg) V..... mpeg1_cuvid Nvidia CUVID MPEG1VIDEO decoder (codec mpeg V..... mpeg2_cuvid Nvidia CUVID MPEG2VIDEO decoder (codec mpeg V..... mpeg4_cuvid Nvidia CUVID MPEG4 decoder (codec mpeg4) V..... vc1_cuvid Nvidia CUVID VC1 decoder (codec vc1) V..... vp8_cuvid Nvidia CUVID VP8 decoder (codec vp8) V..... vp9_cuvid Nvidia CUVID VP9 decoder (codec vp9)
If you have Intel integrated graphics:
- Find QSV-related codecs:bash
# Linux or macOS ffmpeg -codecs | grep qsv # Windows ffmpeg -codecs | findstr "qsv" # Example output DEV.L. av1 Alliance for Open Media AV1 (decoders: libdav1d libaom-av1 av1 av1_cuvid av1_qsv) (encod : libaom-av1 librav1e libsvtav1 av1_nvenc av1_qsv av1_amf av1_vaapi) DEV.LS h264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_qsv h264_cuvid) (encoders ibx264 libx264rgb h264_amf h264_mf h264_nvenc h264_qsv h264_vaapi h264_vulkan) DEV.L. hevc H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_cuvid) (encode libx265 hevc_amf hevc_d3d12va hevc_mf hevc_nvenc hevc_qsv hevc_vaapi hevc_vulkan) DEVIL. mjpeg Motion JPEG (decoders: mjpeg mjpeg_cuvid mjpeg_qsv) (encoders: mjpeg mjpeg_qsv mjpeg_vaa DEV.L. mpeg2video MPEG-2 video (decoders: mpeg2video mpegvideo mpeg2_qsv mpeg2_cuvid) (encoders: mpeg2vide peg2_qsv mpeg2_vaapi) D.V.L. vc1 SMPTE VC-1 (decoders: vc1 vc1_qsv vc1_cuvid) DEV.L. vp8 On2 VP8 (decoders: vp8 libvpx vp8_cuvid vp8_qsv) (encoders: libvpx vp8_vaapi) DEV.L. vp9 Google VP9 (decoders: vp9 libvpx-vp9 vp9_cuvid vp9_qsv) (encoders: libvpx-vp9 vp9_vaapi _qsv) DEV.L. vvc H.266 / VVC (Versatile Video Coding) (decoders: vvc vvc_qsv) (encoders: libvvenc)
If you're on macOS:
- Find VideoToolbox-related codecs:bash
# macOS ffmpeg -codecs | grep videotoolbox
3. Comprehensive Example: A Complete Check Process
Let's say you have an NVIDIA GPU and want to convert a video from HEVC (H.265) format to H.264 format using hardware acceleration.
1. Check if HEVC can be hardware decoded:
Run ffmpeg -decoders | grep cuvid. If you see hevc_cuvid in the results, it's supported.
V..... hevc_cuvid Nvidia CUVID HEVC decoder (codec hevc)2. Check if H.264 can be hardware encoded:
Run ffmpeg -encoders | grep nvenc. If you see h264_nvenc in the results, it's supported.
V..... h264_nvenc NVIDIA NVENC H.264 encoder (codec h264)3. Use Hardware Acceleration
Since the checks confirm support, you can confidently use them in your FFmpeg command. A typical command would look like this:
# -hwaccel cuvid # Globally enable cuvid hardware decoding acceleration
# -c:v hevc_cuvid # Specify the hevc_cuvid decoder for the input video
# -c:v h264_nvenc # Specify the h264_nvenc encoder for the output video
# -c:a copy # Copy audio directly without re-encoding
ffmpeg -hwaccel cuvid -c:v hevc_cuvid -i input.mkv -c:v h264_nvenc -c:a copy output.mp4With these simple commands, you can get a comprehensive understanding of your FFmpeg's capabilities and write more efficient video processing commands.
