NVENC : Hardware Video Acceleration Not Woking

These are a couple of NVENC error I found in my system:

  • Getting this error in OBS(NVENC.HEVC Video Encoder):
    image

  • ffmpeg -i pollappvideo_noaudio.mkv -c:v h264_nvenc output.mp4

ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, matroska,webm, from 'pollappvideo_noaudio.mkv':
  Metadata:
    ENCODER         : Lavf60.16.100
  Duration: 00:05:30.24, start: -0.021000, bitrate: 2803 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn
    Metadata:
      DURATION        : 00:05:30.217000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:05:30.239000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[h264_nvenc @ 0x63a548d1c1c0] dl_fn->cuda_dl->cuCtxCreate(&ctx->cu_context_internal, 0, cu_device) failed -> CUDA_ERROR_UNKNOWN: unknown error
[h264_nvenc @ 0x63a548d1c1c0] No capable devices found
[vost#0:0/h264_nvenc @ 0x63a548cd3b00] Error while opening encoder - maybe incorrect parameters such as bit_rate, rate, width or height.
Error while filtering: Generic error in an external library
[out#0/mp4 @ 0x63a548b47140] Nothing was written into output file, because at least one of its streams received no packets.
frame=    0 fps=0.0 q=0.0 Lsize=       0kB time=00:00:00.14 bitrate=   0.0kbits/s dup=1 drop=0 speed=3.14x    
[aac @ 0x63a5490548c0] Qavg: 65536.000
Conversion failed!

System Details:

  • I have EOS+KDE+Wayland System(X11 is also installed, but currently using wayland)
  • Optimus Laptop + Nvidia Driver + mesa + EnvyControl(Hybrid Mode)
  • inxi -GFNazx | eos-sendlog
    https://0x0.st/HFKn.txt
    

After Installing cuda:

  • Same OBS error
  • ffmpeg -i pollappvideo.mkv -c:v h264_nvenc output.mp4
ffmpeg version n6.1.1 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 13.2.1 (GCC) 20230801
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      58. 29.100 / 58. 29.100
  libavcodec     60. 31.102 / 60. 31.102
  libavformat    60. 16.100 / 60. 16.100
  libavdevice    60.  3.100 / 60.  3.100
  libavfilter     9. 12.100 /  9. 12.100
  libswscale      7.  5.100 /  7.  5.100
  libswresample   4. 12.100 /  4. 12.100
  libpostproc    57.  3.100 / 57.  3.100
Input #0, matroska,webm, from 'pollappvideo.mkv':
  Metadata:
    ENCODER         : Lavf60.16.100
  Duration: 00:05:30.24, start: -0.021000, bitrate: 2966 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn
    Metadata:
      DURATION        : 00:05:30.217000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp
    Metadata:
      DURATION        : 00:05:30.239000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, mp4, to 'output.mp4':
  Metadata:
    encoder         : Lavf60.16.100
  Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 60 fps, 15360 tbn
    Metadata:
      DURATION        : 00:05:30.217000000
      encoder         : Lavc60.31.102 h264_nvenc
    Side data:
      cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
  Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s
    Metadata:
      DURATION        : 00:05:30.239000000
      encoder         : Lavc60.31.102 aac
[h264_nvenc @ 0x55ef2b451c00] Failed locking bitstream buffer: invalid param (8): up=1 drop=0 speed= 3.2x    
[vost#0:0/h264_nvenc @ 0x55ef2b9d8600] Error submitting video frame to the encoder
Error while filtering: Invalid argument
[h264_nvenc @ 0x55ef2b451c00] Failed locking bitstream buffer: invalid param (8): 
[vost#0:0/h264_nvenc @ 0x55ef2b9d8600] video encoding failed
[out#0/mp4 @ 0x55ef2b27c700] video:4kB audio:6kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 15.394862%
frame=    3 fps=0.0 q=2.0 Lsize=      12kB time=00:00:00.34 bitrate= 284.4kbits/s dup=1 drop=0 speed=1.61x    
[aac @ 0x55ef2b801200] Qavg: 16268.926
[aac @ 0x55ef2b801200] 2 frames left in the queue on closing
Conversion failed!
  • inxi -GFNazx | eos-sendlog
    https://0x0.st/HFKR.txt