gpu – ffmpeg custom compile options with hardware/software support

My last compile enabled nvidia/cuda but even though I included –enable-nonfree in the configure, I had issues encoding videos, with outputs like:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -resize 1920x1080 -i Input.mkv -c:a copy -c:v h264_nvenc -preset slow -rc vbr_hq -cq 18 Output.mkv

Giving errors like:

ffmpeg -hwaccel cuvid -c:v h264_cuvid -resize 1920x1080 -i /media/zuultux/Video/Movies/Lawrence.of.Arabia.1962.UHD.BluRay.2160p.TrueHD.Atmos.7.1.HEVC.mkv -c:a copy -c:v h264_nvenc -preset slow -rc vbr_hq -cq 18 /media/zuultux/Video/Lawrence.of.Arabia.1962.UHD.BluRay.1080p.TrueHD.Atmos.7.1.HEVC.mkv
[hevc_cuvid @ 0x5624718179c0] Codec hevc_cuvid is not supported.
Stream mapping:
  Stream #0:0 -> #0:0 (hevc (hevc_cuvid) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (copy)

My actual configure reads:

./configure --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64

There a heaps of options on Githhub. Can anyone suggest how to include parameters that specifically:

  • Toggle enable AMD64/Nvidia or non-hardware processing
  • All free and non-free codecs, but particularly VC9, H264/265
  • Or basically enable as many features as possible!

Note I already have ubuntu-restricted-extras installed.

Configuration used compiled correctly but gave errors when using. Several media files selected to test. nvidia-smi command responds NVIDIA-SMI 470.161.03 Driver Version: 470.161.03 CUDA Version: 11.4


After fixing the problem I thought to share my results on Github.

Read more here: Source link