You are not logged in.

#1 2021-08-24 20:33:32

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

[SOLVED] OBS and nvidia nvenc

I have trouble setting up OBS with nvidia nvenc codec. I have GeForce 840M, and according to https://help.elgato.com/hc/en-us/articl … echnology- this, my card should support it (codename: GM108).

I loaded the 'nvidia_uvm' kernel module by running '# modprobe nvidia_uvm', and ran '# nvidia-modprobe' after. '/dev/nvidia-uvm' exists, but OBS still gives an error, that a generic error happened. I even created the '/etc/udev/rules.d/70-nvidia.rules' file, with the specified content, rebooted, and tried again. I found these instructions here: https://wiki.archlinux.org/title/NVIDIA … with_NVENC

Some info:

$ uname -a
Linux laptop 5.10.60-1-lts #1 SMP Fri, 20 Aug 2021 21:04:02 +0000 x86_64 GNU/Linux
$ pacman -Q | grep nvidia
lib32-nvidia-utils 470.63.01-1
nvidia 470.63.01-3
nvidia-lts 1:470.63.01-2
nvidia-utils 470.63.01-1
opencl-nvidia 470.63.01-1
$ lsmod | grep nvidia
nvidia_drm             69632  10
drm_kms_helper        274432  2 nvidia_drm,i915
nvidia_uvm           1175552  0
nvidia_modeset       1200128  6 nvidia_drm
nvidia              35315712  525 nvidia_uvm,nvidia_modeset
drm                   573440  12 drm_kms_helper,nvidia,nvidia_drm,i915
$ lshw -C video | grep product
       product: Haswell-ULT Integrated Graphics Controller
       product: GM108M [GeForce 840M]

The OBS error:

info: [NVENC encoder: 'streaming_h264'] settings:
	rate_control: CBR
	bitrate:      2500
	cqp:          0
	keyint:       250
	preset:       hq
	profile:      high
	width:        1280
	height:       720
	2-pass:       false
	b-frames:     2
	psycho-aq:    0
	GPU:          0

warning: [NVENC encoder: 'streaming_h264'] Failed to open NVENC codec: Generic error in an external library
warning: Stream output type 'rtmp_output' failed to start!  Last Error: Failed to open NVENC codec: Generic error in an external library

Check your video drivers are up to date. Try closing other recording software which might be using NVENC such as NVIDIA Shadowplay or Windows 10 Game DVR.

I couldn't find any usefull information on the internet, so I decided to ask for help here. What am I missing, or what am I doing wrong? If any more software / config / device information is required please ask, and I'll post it. Thanks.

Last edited by pure_bliss (2021-08-25 09:00:49)

Offline

#2 2021-08-24 21:37:44

Ammako
Member
Registered: 2021-07-16
Posts: 267

Re: [SOLVED] OBS and nvidia nvenc

I've not had to do anything special like this on my end to get NVENC to work, nvidia_uvm was just already loaded by default and NVENC just works, no errors. but I'm on a desktop, not a laptop. It's possible something fucky might be going on between integrated graphics and dedicated GPU. This is always a huge pain on Linux, they like to fight each other over who gets to do the rendering sometimes.

A question mainly for those who know what they're talking about: any chance i915 could be blacklisted, to ensure everything always runs through the dedicated GPU, or would that risk causing issues on a laptop?

It probably wouldn't hurt to add nvidia, nvidia_modeset, nvidia_uvm, and nvidia_drm to the MODULES line in /etc/mkinicpio.conf, and then # mkinitcpio -P to ensure that the modules get loaded as early as possible, in case something is conflicting.

https://wiki.archlinux.org/title/NVIDIA … de_setting

Last edited by Ammako (2021-08-24 21:49:27)

Offline

#3 2021-08-25 07:36:35

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

'nvidia-drm.modeset=1' is in my kernel params

options root=PARTUUID=9e095dbf-43d3-804c-8c3a-85d2edb7c56a rw nvidia-drm.modeset=1 scsi_mod.use_blk_mq=1 resume=/dev/sda3 mitigations=off

Nvidia stuff is in my mkinitcpio modules

MODULES=(ext4 crc16 mbcache jbd2 ahci libahci sd_mod scsi_mod nvidia nvidia_modeset nvidia_uvm nvidia_drm)

And I have i915 blacklisted, so everything should run on the nvidia graphic card

$ cat /etc/modprobe.d/blacklist.conf
blacklist i915
$ nvidia-smi
Wed Aug 25 09:30:00 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01    Driver Version: 470.63.01    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  NVIDIA GeForce ...  Off  | 00000000:03:00.0 Off |                  N/A |
| N/A   40C    P0    N/A /  N/A |    534MiB /  2004MiB |      9%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       487      G   /usr/lib/Xorg                     190MiB |
|    0   N/A  N/A       938      G   picom                               0MiB |
|    0   N/A  N/A       969      G   /usr/bin/plasmashell                8MiB |
|    0   N/A  N/A      2085      G   /usr/lib/firefox/firefox          325MiB |
|    0   N/A  N/A      3726      G   kitty                               1MiB |
+-----------------------------------------------------------------------------+

However dmesg outputs this, which doesn't look good:

$ sudo dmesg | grep i915
[    5.036852] i915 0000:00:02.0: vgaarb: deactivate vga console
[    5.045621] i915 0000:00:02.0: vgaarb: changed VGA decodes: olddecodes=io+mem,decodes=io+mem:owns=io+mem
[    5.083144] [drm] Initialized i915 1.6.0 20200917 for 0000:00:02.0 on minor 1
[    5.084845] snd_hda_intel 0000:00:03.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    5.114265] fbcon: i915drmfb (fb0) is primary device
[    5.114392] i915 0000:00:02.0: [drm] fb0: i915drmfb frame buffer device

also

$ lsmod | grep i915
i915                 2707456  4
i2c_algo_bit           16384  1 i915
intel_gtt              24576  1 i915
video                  57344  2 ideapad_laptop,i915
drm_kms_helper        274432  2 nvidia_drm,i915
cec                    61440  2 drm_kms_helper,i915
drm                   573440  12 drm_kms_helper,nvidia,nvidia_drm,i915

But don't know if this is why nvidia nvenc is not working with OBS

Offline

#4 2021-08-25 07:57:53

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,420

Re: [SOLVED] OBS and nvidia nvenc

I'd try to use ffmpeg with nvenc and see if it gives you a more meaningful error message.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#5 2021-08-25 08:10:24

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

I don't know how to try ffmpeg with nvenc, but a quick search got me this: https://docs.nvidia.com/video-technolog … vidia-gpu/, hope this is what you mean. I'm not sure that ffmpeg is complied with nvenc support.

$ file input.mp4
input.mp4: ISO Media, MP4 Base Media v1 [ISO 14496-12:2003]
$ ffmpeg -codecs | grep nvenc
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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
 DEV.LS h264                 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 (decoders: h264 h264_v4l2m2m h264_qsv h264_cuvid ) (encoders: libx264 libx264rgb h264_amf h264_nvenc h264_qsv h264_v4l2m2m h264_vaapi nvenc nvenc_h264 )
 DEV.L. hevc                 H.265 / HEVC (High Efficiency Video Coding) (decoders: hevc hevc_qsv hevc_v4l2m2m hevc_cuvid ) (encoders: libx265 nvenc_hevc hevc_amf hevc_nvenc hevc_qsv hevc_v4l2m2m hevc_vaapi )
$ ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -vf scale_cuda=1280:720 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:10.87, start: 0.086000, bitrate: 7670 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 7580 kb/s, 29.69 fps, 29.83 tbr, 90k tbn, 59.38 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 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 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x55813eadc040] Hardware is lacking required capabilities
[h264 @ 0x55813eadc040] Failed setup for format cuda: hwaccel initialisation returned error.
Impossible to convert between the formats supported by the filter 'graph 0 input from stream 0:0' and the filter 'auto_scaler_0'
Error reinitializing filters!
Failed to inject frame into filter network: Function not implemented
Error while processing the decoded data for stream #0:0
Conversion failed!
$ ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i input.mp4 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.29.100
  Duration: 00:00:10.87, start: 0.086000, bitrate: 7670 kb/s
  Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 7580 kb/s, 29.69 fps, 29.83 tbr, 90k tbn, 59.38 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, mono, fltp, 96 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 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x5649aaed3c40] Hardware is lacking required capabilities
[h264 @ 0x5649aaed3c40] Failed setup for format cuda: hwaccel initialisation returned error.
[h264_nvenc @ 0x5649aa9269c0] OpenEncodeSessionEx failed: unsupported device (2): (no details)
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
Conversion failed!

Last edited by pure_bliss (2021-08-25 08:10:54)

Offline

#6 2021-08-25 08:20:44

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,358

Re: [SOLVED] OBS and nvidia nvenc

You're using an ideapad with optimus, you probably need prime-run or similar as the UI itself is running by default on the IGPU.

This used to be handled by bumblebee, now I think prime-run is the right method. https://wiki.archlinux.org/title/PRIME


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#7 2021-08-25 08:25:03

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,729

Re: [SOLVED] OBS and nvidia nvenc

What are you using for setting up this optimus system? You can't blacklist i915 as you wouldn't have a display at all otherwise, unless you have a BIOS/UEFI option for switching to the dedicated card only.

Not sure what the general contract for setting up NVENC is and whether nvidia has to be the general driving force (... which it seems to be) or whether you just need to pass the correct dri node via an environment env or so

Offline

#8 2021-08-25 08:32:30

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,420

Re: [SOLVED] OBS and nvidia nvenc

This example works for me without prime-run even when offloading the nvidia gpu; i use the igp as my primary card; ffmpeg seems smart enough to understand the context:

ffmpeg -hwaccel nvdec -y -i file.mkv -c:v nvenc -qp 18 -preset hq -profile:v high -c:a copy out.mkv

Anyway i've no experience with bumblebee or laptops.


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#9 2021-08-25 08:35:17

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

As far as I know I don't use an optimus system ... Since now I thought that everything ran on my nvidia card.

I tried 'prime-run obs', but still got that error. Don't know what you mean by 'UI itself is running by default on the IGPU', 'nvidia-smi' shows obs without running it with 'prime-run'

$ nvidia-smi                                                                                                                                                                          10:33:12
Wed Aug 25 10:33:17 2021       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 470.63.01    Driver Version: 470.63.01    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  NVIDIA GeForce ...  Off  | 00000000:03:00.0 Off |                  N/A |
| N/A   44C    P0    N/A /  N/A |    848MiB /  2004MiB |     68%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A       487      G   /usr/lib/Xorg                     306MiB |
|    0   N/A  N/A       936      G   picom                               0MiB |
|    0   N/A  N/A       971      G   /usr/bin/plasmashell                8MiB |
|    0   N/A  N/A      1256      G   /usr/lib/firefox/firefox          345MiB |
|    0   N/A  N/A      1860      G   /usr/lib/firefox/firefox          139MiB |
|    0   N/A  N/A      2190      G   kitty                               6MiB |
|    0   N/A  N/A      2327      G   kitty                               6MiB |
|    0   N/A  N/A      9172      G   kitty                               1MiB |
|    0   N/A  N/A      9502      G   kitty                               1MiB |
|    0   N/A  N/A      9823      G   obs                                19MiB |
+-----------------------------------------------------------------------------+

I don't have BIOS setting for which card to use.

Offline

#10 2021-08-25 08:38:28

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

Also I'm using nvidia graphics only, described here: https://wiki.archlinux.org/title/NVIDIA … phics_only

$ cat /usr/share/sddm/scripts/Xsetup
#!/bin/sh
# Xsetup - run as root before the login dialog appears
xrandr --setprovideroutputsource modesetting NVIDIA-0
xrandr --auto

Offline

#11 2021-08-25 08:45:21

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,420

Re: [SOLVED] OBS and nvidia nvenc

can you try the posted ffmpeg command? it strips out the cuda part.

Last edited by kokoko3k (2021-08-25 08:46:04)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#12 2021-08-25 08:47:09

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 22,729

Re: [SOLVED] OBS and nvidia nvenc

The "only" is a bit of a misnomer as you will still use the integrated GPU it just won't have many jobs outside of displaying the image rendered by nvidia.

From that aspect this looks fine, what are the perms of the device file the rule you created should've set up?

ls -l /dev/nvidia*

Offline

#13 2021-08-25 08:47:48

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

kokoko3k wrote:

can you try the posted ffmpeg command? it strips out the cuda part.

$ file file.mkv
file.mkv: Matroska data
$ ffmpeg -hwaccel nvdec -y -i file.mkv -c:v nvenc -qp 18 -preset hq -profile:v high -c:a copy out.mkv
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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, matroska,webm, from 'file.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:00:11.01, start: 0.086000, bitrate: 7565 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.69 fps, 29.69 tbr, 1k tbn, 59.38 tbc (default)
    Metadata:
      DURATION        : 00:00:11,013000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, mono, fltp (default)
    Metadata:
      DURATION        : 00:00:10,956000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x5633e625e880] Hardware is lacking required capabilities
[h264 @ 0x5633e625e880] Failed setup for format cuda: hwaccel initialisation returned error.
[nvenc @ 0x5633e5c85100] This encoder is deprecated, use 'h264_nvenc' instead
[nvenc @ 0x5633e5c85100] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[nvenc @ 0x5633e5c85100] OpenEncodeSessionEx failed: unsupported device (2): (no details)
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
Conversion failed!
$ prime-run ffmpeg -hwaccel nvdec -y -i file.mkv -c:v nvenc -qp 18 -preset hq -profile:v high -c:a copy out.mkv
ffmpeg version n4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with gcc 11.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-librsvg --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-nvdec --enable-nvenc --enable-shared --enable-version3
  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, matroska,webm, from 'file.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:00:11.01, start: 0.086000, bitrate: 7565 kb/s
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.69 fps, 29.69 tbr, 1k tbn, 59.38 tbc (default)
    Metadata:
      DURATION        : 00:00:11,013000000
  Stream #0:1: Audio: aac (LC), 48000 Hz, mono, fltp (default)
    Metadata:
      DURATION        : 00:00:10,956000000
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (nvenc))
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[h264 @ 0x55c537262880] Hardware is lacking required capabilities
[h264 @ 0x55c537262880] Failed setup for format cuda: hwaccel initialisation returned error.
[nvenc @ 0x55c536c89100] This encoder is deprecated, use 'h264_nvenc' instead
[nvenc @ 0x55c536c89100] The selected preset is deprecated. Use p1 to p7 + -tune or fast/medium/slow.
[nvenc @ 0x55c536c89100] OpenEncodeSessionEx failed: unsupported device (2): (no details)
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
Conversion failed!

Offline

#14 2021-08-25 08:48:55

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

V1del wrote:

The "only" is a bit of a misnomer as you will still use the integrated GPU it just won't have many jobs outside of displaying the image rendered by nvidia.

From that aspect this looks fine, what are the perms of the device file the rule you created should've set up?

ls -l /dev/nvidia*
$ /usr/bin/ls -l /dev/nvidia*
crw-rw-rw- 1 root root  195,   0 aug   25 10:15 /dev/nvidia0
crw-rw-rw- 1 root root  195, 255 aug   25 10:15 /dev/nvidiactl
crw-rw-rw- 1 root root  195, 254 aug   25 10:15 /dev/nvidia-modeset
crw-rw-rw- 1 root root  237,   0 aug   25 10:15 /dev/nvidia-uvm
crw-rw-rw- 1 root root  237,   1 aug   25 10:15 /dev/nvidia-uvm-tools

/dev/nvidia-caps:
total 0
cr-------- 1 root root 240, 1 aug   25 10:26 nvidia-cap1
cr--r--r-- 1 root root 240, 2 aug   25 10:26 nvidia-cap2

Offline

#15 2021-08-25 08:50:17

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,420

Re: [SOLVED] OBS and nvidia nvenc

Found this:
seems ffmpeg is right
https://forums.developer.nvidia.com/t/n … us/45034/3
https://developer.nvidia.com/video-enco … ew#Encoder
maybe your card is not really capable.
It doesn't even seem to support decoding.
vdpauinfo may confirm that.

Last edited by kokoko3k (2021-08-25 08:55:08)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#16 2021-08-25 08:57:38

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

kokoko3k wrote:

Found this:
seems ffmpeg is right
https://forums.developer.nvidia.com/t/n … us/45034/3
maybe your card is not really capable.

Yea that can be true (sadly). This site https://help.elgato.com/hc/en-us/articl … echnology- said that my gpu with 'GM108M' should be compatible, but turns out that it is wrong

If the codename of your graphic card begins with GK (Kepler microarchitecture), GM (Maxwell microarchitecture), or GP (Pascal microarchitecture), TU (Turing microarchitecture) then your graphic card does support NVENC; if not, then your graphic card likely does not support NVENC.

https://developer.nvidia.com/nvidia-vid … NCFeatures here it sais:

* Except GM108 and GP108 (not supported)

$ lshw -C video | grep product
       product: Haswell-ULT Integrated Graphics Controller
       product: GM108M [GeForce 840M]

Mine is 'GM108M', and I guess it doesn't support it, just like 'GM108'

Edit:

$ vdpauinfo
display: :0   screen: 0
GPU at BusId 0x3 doesn't have a supported video decoder
Error creating VDPAU device: 1

So yea, solved, thanks for your time and help!

Last edited by pure_bliss (2021-08-25 08:59:06)

Offline

#17 2021-08-25 09:04:32

progandy
Member
Registered: 2012-05-17
Posts: 5,221

Re: [SOLVED] OBS and nvidia nvenc

Maybe you could try this nvencinfo tool to query your graphics card?

https://medium.com/@multi.flexi/how-to- … cc9a5d4dac (Edit: Install the ffnvcodec-headers package instead of the headers mentioned there)
https://github.com/philipl/nv-video-info

Edit: Too slow, so it really is impossible.

Nvidia has a confusing naming scheme and listing: https://developer.nvidia.com/video-enco … ew#Encoder
Support in 940M / GM107 (listed as GeForce 845M / 940M / 940MX / 945M)
No support in 940M / GM108 (listed as GeForce 830M > 945M)

Last edited by progandy (2021-08-25 09:13:52)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#18 2021-08-25 09:11:47

pure_bliss
Member
Registered: 2021-04-17
Posts: 29

Re: [SOLVED] OBS and nvidia nvenc

progandy wrote:

Maybe you could try this nvencinfo tool to query your graphics card?

https://medium.com/@multi.flexi/how-to- … cc9a5d4dac (Edit: Install the ffnvcodec-headers package instead of the headers mentioned there)
https://github.com/philipl/nv-video-info

Edit: Too slow, so it really is impossible.

yea, kinda sad that i got the one of the two exceptions

Offline

Board footer

Powered by FluxBB