NVENC Codec does not load in obs. (Shared object "libnvidia-encode.so.1" not found, required by "obs")

Hello, please help me with the nvenc plant on the obs!

My characteristics
GPU - Nvidia GTX 1650 Overclocked Low Profile
OS - FreeBSD 14.4
GPU driver - nvidia-driver 595.58.03
Window Manager - bspwm

I tried changing the module's paths through the AI, but it was no use.
The AI also suggested running the recording in advanced mode and checking, but the program returned the error "Operation not permitted."

I spent more than 2-3 hours on this but nothing helped, please help!

My configs:

/etc/rc.conf
Code:
hostname="freebsd"
ifconfig_re0="inet 192.168.0.101 netmask 255.255.255.0"
defaultrouter="192.168.0.1"
sshd_enable="YES"
moused_nondefault_enable="NO"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
kld_list="nvidia-drm nullfs fusefs"
snd_driver_load="YES"
linux_enable="YES"

/etc/sysctl.conf
Code:
security.bsd.unprivileged_chroot=1
vfs.usermount=1
hw.snd.vpc_0db=45
hw.snd.vpc_mixer_bypass=1
hw.snd.default_unit=5
hw.snd.latency=2
hw.snd.feeder_rate_quality=1

/boot/loader.conf
Code:
hw.nvidiadrm.modeset=1

Issue files:

/usr/local/bin/with-glibc-shim
Code:
#!/usr/bin/env ruby
# encoding: UTF-8

if ARGV.length == 0
  STDERR.puts "Run application with libc6-shim:\n\s\s[env SHIM_DEBUG=1] #{File.basename($PROGRAM_NAME)} <application> [application args]"
  exit(0)
end

SHIM_LIB64_DIR = File.join(__dir__, '../lib/libc6-shim')
SHIM_LIB32_DIR = File.join(__dir__, '../lib32/libc6-shim')

def libmap(target_dir, libdir_suffix)

  shim_path = File.expand_path(ENV['SHIM_DEBUG'] == '1' ? 'libc6-debug.so' : 'libc6.so', target_dir)

  lmap = {
    'ld-linux.so.2'        => shim_path,
    'ld-linux-x86-64.so.2' => shim_path,
    'libanl.so.1'          => shim_path,
    'libc.so.6'            => shim_path,
    'libdl.so.2'           => shim_path,
    'libm.so.6 '           => shim_path,
    'libpthread.so.0'      => shim_path,
    'libresolv.so.2'       => shim_path,
    'librt.so.1'           => shim_path,
    'libcxxrt.so.1'        => (File.expand_path('fakecxxrt.so', target_dir) if ENV['SHIM_FAKECXXRT'] == '1')
  }

  if libdir_suffix == '' && File.exist?("/lib/librt.so.1")
    lmap['bsd-librt.so.1'] = "/lib/librt.so.1"
  else
    lmap['bsd-librt.so.1'] = "/usr/lib#{libdir_suffix}/librt.so.1"
  end

  lmap.compact.map{|k, v| '%-40s %s' % [k, v]}.join("\n")
end

ENV['LD_LIBMAP']    = [libmap(SHIM_LIB64_DIR, ''),   ENV['LD_LIBMAP']   ].compact.join("\n")
ENV['LD_32_LIBMAP'] = [libmap(SHIM_LIB32_DIR, '32'), ENV['LD_32_LIBMAP']].compact.join("\n")

exec([ARGV[0]] * 2, *ARGV[1..-1])


When launching through the console, a module loading error appears.
Code:
debug: Loading module: obs-nvenc.so

error: os_dlopen(libnvidia-encode.so.1->libnvidia-encode.so.1): Shared object "libnvidia-encode.so.1" not found, required by "obs"



info: NVENC not supported

warning: Failed to initialize module 'obs-nvenc.so'

Using nv-sglrun
Code:
info: OpenGL loaded successfully, version 3.3.0 NVIDIA 595.58.03, shading language 3.30 NVIDIA via Cg compiler
shim_fcntl_impl(45, 1030, ...) is not implemented
0x860cfb195 <shim_fcntl+0x3f5> at /usr/local/lib/libc6-shim/libc6.so
0x860cfae1b <shim_fcntl+0x7b> at /usr/local/lib/libc6-shim/libc6.so
0x89e0077b0 <NvGlEglGetFunctions+0x5f00> at /compat/linux/usr/lib64/libnvidia-eglcore.so.595.58.03
0x89e087476 <NvGlEglGetFunctions+0x85bc6> at /compat/linux/usr/lib64/libnvidia-eglcore.so.595.58.03
0x89e020066 <NvGlEglGetFunctions+0x1e7b6> at /compat/linux/usr/lib64/libnvidia-eglcore.so.595.58.03
0x89dfd41bd <_glDeterministicTPCModeDistParams+0xb63cd> at /compat/linux/usr/lib64/libnvidia-eglcore.so.595.58.03
0x89dff8de2 <NvGlEglApiInit+0xa52> at /compat/linux/usr/lib64/libnvidia-eglcore.so.595.58.03
0x89b68be38 <NvEglApiGetAccess+0x5498> at /compat/linux/usr/lib64/libEGL_nvidia.so.0
0x89b68c798 <NvEglApiGetAccess+0x5df8> at /compat/linux/usr/lib64/libEGL_nvidia.so.0
0x89b699995 <NvEglwlaf47906in+0x9885> at /compat/linux/usr/lib64/libEGL_nvidia.so.0
0x85657b3f1 <eglMakeCurrent+0x311> at /usr/local/lib/libEGL.so.1
0x89afcee66 <device_create+0x246> at /usr/local/lib/libobs-opengl.so.30
0x8283f7afe <gs_create+0x9e> at /usr/local/lib/libobs.so.30
0x8283b1370 <obs_reset_video+0x380> at /usr/local/lib/libobs.so.30
0x5aeedc <???> at /usr/local/bin/obs
0x5ab0dd <???> at /usr/local/bin/obs
0x65f717 <???> at /usr/local/bin/obs
0x830ab12f0 <__libc_start1+0x150> at /lib/libc.so.7
Abort trap                 nv-sglrun obs

I looked at this before, there was another problem with with-glibc-shim, and the error in the condition had been fixed long ago.
 
If you're looking for the port that installed that .so file, try something like this: find /usr/ports -iname pkg-plist -exec grep libnvidia-encode.so {} +
This library is NOT provided by upstream for FreeBSD but Linux.

It should be installed as /compat/linux/lib64/libnvidia-encode.so (actually a symlink to libnvidia-encode.so.1 in the same directory and libnvidia-encode.so.1 is actually a symlink to libnvidia-encode.so.595.58.03 currently in the same directory) by x11/linux-nvidia-libs.

Not sure why, but pkg-which doesn't show the origin of the file. But it should be installed.

Code:
% pkg info -l x11/linux-nvidia-libs-devel | grep libnvidia-encode.so.595.58.03
    /compat/linux/usr/lib/libnvidia-encode.so.595.58.03
    /compat/linux/usr/lib64/libnvidia-encode.so.595.58.03

Note that I'm using -devel variant.
 
I got rid of the array altogether since apparently we only need 2 bits of state per condattr and can just store them directly in condattr. Now nothing should crash. At least not for that reason.
 
Being that BSD does not directly support CUDA I have to hypothesize that even if nvenc runs, it will fall back to CPU encoding. I could be wrong...I was wrong once...Can't say as I liked it, so I vowed to never be wrong again.
 
NVENC doesn't have any kind of CPU fallback. There is the "Video Engine Utilization" metric in the GPU section of nvidia-settings if you want to be 100% sure.
 
Back
Top