错误“无法查询 nvenc max 版本”,如何解决这个错误?

错误“无法查询 nvenc max 版本”,如何解决这个错误?

在 Linux 上使用带有 NVIDIA GPU 加速 (hevc_nvenc) 的 FFmpeg 时出现错误“无法查询 nvenc max 版本”。

有人知道如何解决这个错误吗?非常感谢。

下面的代码是我输入的FFmpeg代码,以及输出的内容。

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

我已经安装了FFmpeg、NVIDIA GPU驱动和SDK。不使用GPU加速时,它可以正常工作,但使用GPU加速时会抛出错误。

这是我的 nvidia-smi

+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.54.03              Driver Version: 535.54.03    CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A16                     Off | 00000000:05:00.0 Off |                    0 |
|  0%   34C    P0              25W /  62W |      4MiB / 15356MiB |     13%      Default |
|                                         |                      |                  N/A |
+-----------------------------------------+----------------------+----------------------+
                                                                                         
+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

相关内容