[FFmpeg-user] error "Failed to query nvenc max version", how to solve this bug?

Dennis Mungai dmngaie at gmail.com
Sat Jul 29 19:19:52 EEST 2023


On Sat, 29 Jul 2023 at 17:12, will <graperio at 163.com> wrote:

> The error "Failed to query nvenc max version" occurs when using FFmpeg
> with NVIDIA GPU acceleration (hevc_nvenc) on Linux.
>
> Do you know how to solve this bug? Thank you very much.
>
> The following code is the FFmpeg code I entered, along with the output
> content.
> ffmpeg -ss 10:00 -i /www/wwwroot/pyffmpeg/videos/0/011.mp4 -t 20 -r 30
> -b:v 4M -an -vcodec hevc_nvenc -y /www/wwwroot/pyffmpeg/videos/post/999.mp4
> ffmpeg version 6.0 Copyright (c) 2000-2023 the FFmpeg developers
>   built with gcc 8 (GCC)
>   configuration: --extra-cflags='-I/usr/local/cuda/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda/lib64 -ldl ' --pkg-config-flags=--static
> --enable-shared --enable-gpl --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc='nvcc=/usr/local/cuda-12.2/bin/nvcc'
>   WARNING: library configuration mismatch
>   avutil      configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   avcodec     configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   avformat    configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   avdevice    configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   avfilter    configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   swscale     configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   swresample  configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   postproc    configuration:
> --extra-cflags='-I/usr/local/cuda-12.2/include -fPIC '
> --extra-ldflags='-L/usr/local/cuda-12.2/lib64 -ldl '
> --pkg-config-flags=--static --enable-shared --enable-gpl
> --enable-libfreetype --enable-cuvid --enable-nvenc --enable-nonfree
> --nvcc=/usr/local/cuda-12.2/bin/nvcc --prefix=/usr/local/ffmpeg
>   libavutil      58.  2.100 / 58.  2.100
>   libavcodec     60.  3.100 / 60.  3.100
>   libavformat    60.  3.100 / 60.  3.100
>   libavdevice    60.  1.100 / 60.  1.100
>   libavfilter     9.  3.100 /  9.  3.100
>   libswscale      7.  1.100 /  7.  1.100
>   libswresample   4. 10.100 /  4. 10.100
>   libpostproc    57.  1.100 / 57.  1.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from
> '/www/wwwroot/pyffmpeg/videos/0/011.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     encoder         : Lavf59.6.100
>   Duration: 00:17:48.83, start: 0.000000, bitrate: 4617 kb/s
>   Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
> yuv420p(tv, smpte170m/bt470bg/bt709, progressive), 1920x1080 [SAR 1:1 DAR
> 16:9], 4481 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
>     Metadata:
>       handler_name    : ISO Media file produced by Google Inc.
>       vendor_id       : [0][0][0][0]
>   Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz,
> stereo, fltp, 127 kb/s (default)
>     Metadata:
>       handler_name    : ISO Media file produced by Google Inc.
>       vendor_id       : [0][0][0][0]
> Stream mapping:
>   Stream #0:0 -> #0:0 (h264 (native) -> hevc (hevc_nvenc))
> Press [q] to stop, [?] for help
> [hevc_nvenc @ 0x2a577790] Failed to query nvenc max version: unknown error
> (-756041696): (no details)
> Segmentation faul
>
> I have installed FFmpeg, NVIDIA GPU drivers, and SDK. It works fine
> without using GPU acceleration, but it throws an error when using GPU
> acceleration.
>


I suspect you're running this on an NVIDIA GRID vGPU solution.
I've added Philip Langdale and Timo to this thread for guidance on this
because to my knowledge (and I stand corrected if I'm wrong), FFmpeg's
NVENC runtime does not initialize on NVIDIA's GRID vGPU solution. Only the
CUDA and D3D11VA backends are supported for context creation, see
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/nvenc.c#L77

Perhaps Philip or Timo can clarify on that further.

You may need to tear down the vGPU stuff you're running and run FFmpeg
directly on baremetal for that GPU.


More information about the ffmpeg-user mailing list