FFmpeg GPU HW-Acceleration Support Table
Fermi | Kepler | Maxwell (1st Gen) | Maxwell (2nd Gen) | Maxwell (GM206) | Pascal | Volta | Turing | Ampere | |
---|---|---|---|---|---|---|---|---|---|
H.264 encoding | N/A | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v4.2 | FFmpeg v4.2 | FFmpeg v4.2 |
HEVC encoding | N/A | N/A | N/A | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v4.2 | FFmpeg v4.2 | FFmpeg v4.2 |
MPEG2, MPEG-4, H.264 decoding | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v4.2 | FFmpeg v4.2 | FFmpeg v4.2 |
HEVC decoding | N/A | N/A | N/A | N/A | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v4.2 | FFmpeg v4.2 | FFmpeg v4.2 |
VP9 decoding | N/A | N/A | N/A | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v3.3 | FFmpeg v4.2 | FFmpeg v4.2 | FFmpeg v4.2 |
For guidelines about NVIDIA GPU-accelerated video encoding/decoding performance, please visit the Video Codec SDK page for more details.
Getting Started with FFmpeg/libav using NVIDIA GPUs
Using NVIDIA hardware acceleration in FFmpeg/libav requires the following steps
- Download and install ffnvcodec:
git clone https://git.videolan.org/git/ffmpeg/nv-codec-headers.git
cd nv-codec-headers && sudo make install && cd –
- Download the latest FFmpeg or libav source code, by cloning the corresponding GIT repositories
- FFmpeg: https://git.ffmpeg.org/ffmpeg.git
- Libav: https://github.com/libav/libav
- Download and install the compatible driver from NVIDIA web site
- Download and install the CUDA Toolkit CUDA toolkit
- Use the following configure command (Use correct CUDA library path in config command below)
./configure --enable-cuda-sdk --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp
--extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 - Use the following command to compile:
make -j 10
- Use FFmpeg/libav binary as required. To start with FFmpeg, try the below sample command line for 1:2 transcoding
ffmpeg -y -hwaccel cuvid -c:v h264_cuvid -vsync 0 -i <input.mp4> -vf scale_npp=1920:1072
-vcodec h264_nvenc <output0.264> -vf scale_npp=1280:720 -vcodec h264_nvenc <output1.264>
For more information on FFmpeg licensing, please see this page. For more information on the build process, and on building for windows, please see the Using FFmpeg with NVIDIA GPU Hardware Acceleration guide.