NVENC 或笔记本电脑屏幕,但不能同时使用!

NVENC 或笔记本电脑屏幕,但不能同时使用!

Dell Precision M6800
NVIDIA GK104GLM [Quadro K5100M]
Ubuntu Studio 22.04 LTS
已完全更新 ( sudo apt update && sudo apt full-upgrade)


这个答案似乎是最有希望让 NVENC 正常工作的。它的一系列命令是:

sudo apt update
sudo apt remove '^nvidia'
sudo apt autoremove
sudo apt install nvidia-driver-???
sudo reboot

目前???大概是最新的。撰写本文时,Tab 补全功能显示:

aaron@aaron-ubuntustudio-m6800:~$ sudo apt install nvidia-driver-
nvidia-driver-390         nvidia-driver-435         nvidia-driver-450-server  nvidia-driver-465         nvidia-driver-510         nvidia-driver-515-server  nvidia-driver-525-open
nvidia-driver-418         nvidia-driver-440         nvidia-driver-455         nvidia-driver-470         nvidia-driver-510-server  nvidia-driver-520
nvidia-driver-418-server  nvidia-driver-440-server  nvidia-driver-460         nvidia-driver-470-server  nvidia-driver-515         nvidia-driver-520-open
nvidia-driver-430         nvidia-driver-450         nvidia-driver-460-server  nvidia-driver-495         nvidia-driver-515-open    nvidia-driver-525
aaron@aaron-ubuntustudio-m6800:~$ sudo apt install nvidia-driver-

按照上述说明,首先尝试了 525 驱动程序。它似乎挂在文本错误上,而不是 GUI 桌面,提示不支持此 GPU。最高支持版本为 470。

好的。在谷歌上搜索了一番,弄清楚如何从中获取命令提示符(Ctrl++ )后,我使用命令历史记录再次执行该过程并选择 470 驱动程序。这样我就可以进入桌面,但只能在外接显示器上看到。它不再识别笔记本电脑屏幕了。AltF3

逐步降低每个非服务器版本 - 相同的过程 - 寻找支持笔记本电脑屏幕的最新版本。只有 390 个支持。

仔细一看,高于这个分数线的所有分数(418 及以上)似乎都取决于 470 之前的分数线,所以我认为无论如何我都能拿到 470 分。除非我选择了 390 分,然后我就拿到了 390 分。

因此看来(至少不采用什么技巧)我必须使用 390 才能使笔记本电脑屏幕工作。


同时,ffmpeg 似乎不支持低于 418/470 的任何 NVENC。(无论我安装 418 包时实际得到了什么)

在390:

aaron@aaron-ubuntustudio-m6800:~$ nvidia-smi
Wed Dec 21 14:20:57 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.157                Driver Version: 390.157                   |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro K5100M       Off  | 00000000:01:00.0  On |                  N/A |
| N/A   57C    P0    24W /  N/A |    295MiB /  8110MiB |      1%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      1654      G   /usr/lib/xorg/Xorg                           195MiB |
|    0      2043      G   /usr/bin/kwin_x11                             78MiB |
|    0      2107      G   /usr/bin/plasmashell                          16MiB |
+-----------------------------------------------------------------------------+
aaron@aaron-ubuntustudio-m6800:~$ ffmpeg -i Radioactive.mp4 -c:v h264_nvenc output.mp4
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Radioactive.mp4':
Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Radioactive
    artist          : EZ Wolf
    date            : 20141121
    encoder         : Lavf58.76.100
    comment         : https://www.youtube.com/watch?v=uhfbForokYk
    description     : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
    synopsis        : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
Duration: 00:02:58.72, start: 0.000000, bitrate: 4773 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4640 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
    handler_name    : VideoHandler
    vendor_id       : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
    handler_name    : SoundHandler
    vendor_id       : [0][0][0][0]
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 @ 0x557f2ebb8300] Driver does not support the required nvenc API version. Required: 11.1 Found: 8.1
[h264_nvenc @ 0x557f2ebb8300] The minimum required Nvidia driver for nvenc is (unknown) or newer
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
[aac @ 0x557f2ebbcc40] Qavg: 15980.515
[aac @ 0x557f2ebbcc40] 2 frames left in the queue on closing
Conversion failed!
aaron@aaron-ubuntustudio-m6800:~$ rm output.mp4
aaron@aaron-ubuntustudio-m6800:~$ 

在 418/470 上:

aaron@aaron-ubuntustudio-m6800:~$ nvidia-smi
Wed Dec 21 14:08:18 2022
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.161.03   Driver Version: 470.161.03   CUDA Version: 11.4     |
|-------------------------------+----------------------+----------------------+
| 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  Quadro K5100M       Off  | 00000000:01:00.0  On |                  N/A |
| N/A   51C    P8     6W /  N/A |    162MiB /  8110MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1611      G   /usr/lib/xorg/Xorg                100MiB |
|    0   N/A  N/A      1865      G   /usr/bin/kwin_x11                  38MiB |
|    0   N/A  N/A      1941      G   /usr/bin/plasmashell               17MiB |
+-----------------------------------------------------------------------------+
aaron@aaron-ubuntustudio-m6800:~$ ffmpeg -i Radioactive.mp4 -c:v h264_nvenc output.mp4
ffmpeg version 4.4.2-0ubuntu0.22.04.1 Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
configuration: --prefix=/usr --extra-version=0ubuntu0.22.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-librsvg --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 70.100 / 56. 70.100
libavcodec     58.134.100 / 58.134.100
libavformat    58. 76.100 / 58. 76.100
libavdevice    58. 13.100 / 58. 13.100
libavfilter     7.110.100 /  7.110.100
libswscale      5.  9.100 /  5.  9.100
libswresample   3.  9.100 /  3.  9.100
libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Radioactive.mp4':
Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Radioactive
    artist          : EZ Wolf
    date            : 20141121
    encoder         : Lavf58.76.100
    comment         : https://www.youtube.com/watch?v=uhfbForokYk
    description     : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
    synopsis        : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
Duration: 00:02:58.72, start: 0.000000, bitrate: 4773 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 4640 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
    Metadata:
    handler_name    : VideoHandler
    vendor_id       : [0][0][0][0]
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
    handler_name    : SoundHandler
    vendor_id       : [0][0][0][0]
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:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    title           : Radioactive
    artist          : EZ Wolf
    date            : 20141121
    synopsis        : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
    comment         : https://www.youtube.com/watch?v=uhfbForokYk
    description     : Fun little project with Masada!
                    : German users: please use this link to watch it:
                    : https://vimeo.com/112515413
    encoder         : Lavf58.76.100
Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 2000 kb/s, 25 fps, 12800 tbn (default)
    Metadata:
    handler_name    : VideoHandler
    vendor_id       : [0][0][0][0]
    encoder         : Lavc58.134.100 h264_nvenc
    Side data:
    cpb: bitrate max/min/avg: 0/0/2000000 buffer size: 4000000 vbv_delay: N/A
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
    handler_name    : SoundHandler
    vendor_id       : [0][0][0][0]
    encoder         : Lavc58.134.100 aac
frame= 4467 fps= 69 q=28.0 Lsize=   43837kB time=00:02:58.73 bitrate=2009.3kbits/s speed=2.77x
video:40918kB audio:2801kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.268805%
[aac @ 0x560c12875c40] Qavg: 315.715
aaron@aaron-ubuntustudio-m6800:~$ rm output.mp4
aaron@aaron-ubuntustudio-m6800:~$ 

我的 ffmpeg 命令基于此,然后精简为使用默认值,而不是指定现在已弃用的内容:
https://trac.ffmpeg.org/wiki/HWAccelIntro#NVENC


因此,似乎我可以选择笔记本电脑屏幕或硬件视频编码,具体取决于我选择的驱动程序,但不能同时使用两者。至少不容易。有人可以指导我如何同时获得两者吗?

也许这样我就能摆脱 OBS 中的这个错误弹出窗口,而且仍然有一个有用的装备:
在此处输入图片描述

答案1

事实证明 BIOS 确实有影响。谁知道呢?

无论如何,感谢这个答案,我让笔记本电脑屏幕能够使用较新的驱动程序!我的 BIOS 标记不太清楚,但这是设置:

在此处输入图片描述

勾选该框,应用,然后退出。然后笔记本电脑屏幕就可以使用 470 驱动程序了。


毕竟,xrandr说笔记本电脑屏幕已从 重命名DP-4eDP-1-1。所以我还必须更新一个脚本,以保持触摸屏正确对齐。

相关内容