UPDATED WITH 120.00hz NVIDIA xrandr INSTRUCTIONS IN POST 5!
Anthony from LTT gave us instructions for Nvidia users on Linux the holy grail of capture APIs: NVFBC! (go to the “A Shadowplay alternative (optional)” chapter)
However most of you will run into initial issues if you add your own PPA for OBS so this is the full guide with troubleshooting steps:
First, are you on 21.04 or 20.04 LTS? This is important as it determines whether you need to take out a package from your dependencies installation.
Second, did you already install OBS from the PPA? Does /usr/include/obs
contain anything? This determines if it’s gonna be easier to do an extra troubleshooting step that is necessary if your libobs0 has surpassed the version set as a dependency by libobs-dev (thanks Canonical.)
This guide will assume you already installed from the PPA and potentially installed additional plugins like obs-ndi
.
With these set, let’s proceed with the steps from the video with troubleshooting steps:
First, you will need to patch the shared library just like in the video from here:
But what if your Vulkan driver is NEWER than the listed drivers in the script?
Believe it or not, you can see the patch contents don’t differ greatly between the same generation of driver (the 470 series for example) so all you need to do is manually enter the driver (in my case 470.62.02) and re-use the contents from the previous driver in the script (470.63.01, which actually was released BEFORE 470.62.02)
--- patch-fbc.sh 2021-09-15 16:37:08.834207320 -0700
+++ patch-fbc-new.sh 2021-09-15 16:38:05.109758564 -0700
@@ -117,6 +117,7 @@
["465.31"]='s/\x83\xfe\x01\x73\x08\x48/\x83\xfe\x00\x72\x08\x48/'
["470.42.01"]='s/\x83\xfe\x01\x73\x08\x48/\x83\xfe\x00\x72\x08\x48/'
["470.57.02"]='s/\x83\xfe\x01\x73\x08\x48/\x83\xfe\x00\x72\x08\x48/'
+ ["470.62.02"]='s/\x83\xfe\x01\x73\x08\x48/\x83\xfe\x00\x72\x08\x48/'
["470.63.01"]='s/\x83\xfe\x01\x73\x08\x48/\x83\xfe\x00\x72\x08\x48/'
)
@@ -191,6 +192,7 @@
["465.31"]='libnvidia-fbc.so'
["470.42.01"]='libnvidia-fbc.so'
["470.57.02"]='libnvidia-fbc.so'
+ ["470.62.02"]='libnvidia-fbc.so'
["470.63.01"]='libnvidia-fbc.so'
)
Now it’s ready for my fresh Vulkan beta driver.
Now exactly like in the video, after doing the modification:
sudo ./patch-fbc.sh
A successful patch will spit out checksums for a original backup going to /opt/nvidia
and the patched file going to it’s intended destination in /usr/lib/x86_64-linux-gnu
Next, building the shared library/plugin for OBS.
For 21.04 and up, use the same dependency installation as described in the video:
sudo apt install libgl-dev libobs-dev libsimde-dev meson ninja-build
For 20.04 LTS, do not install libsimde-dev. It builds fine without it.
sudo apt install libgl-dev libobs-dev meson ninja-build
Uh oh. I hit a dependency problem… libobs0 needs version 25.x.x…
This is extremely unfortunate and is why the official PPA needs to supply some packages to remedy some of these dependency problems.
This is where you will have to brute force install libobs-dev
by extracting the .deb files.
Grab it from the web interface for the Universe repository:
21.04: Ubuntu – Details of package libobs-dev in hirsute
20.04: Ubuntu – Details of package libobs-dev in bionic
Open the .deb in Archive Manager (or Ark) and extract data.tar.xz
Within data.tar.xz
, navigate into the /usr/lib/x86_64-linux-gnu
folder. The important folder is the cmake
folder, where you will copy one folder inside that folder to the actual /usr/lib/x86_64-linux-gnu/cmake
folder on your system.
If your /usr/include/obs
is already populated, do not extract the include
(*.h) files from this deb package.
Copy the LibObs
folder from within cmake
into the cmake
folder in /usr/lib/x86_64-linux-gnu
. I prefer to use Nemo and “Open as Root” to do this, but you can extract and use cp
as root if you’re comfortable with that instead.
Copy all libobs.*
files from /usr/lib
to /usr/lib/x86_64-linux-gnu
(including the symlinks)
You will now want to apt-mark hold obs-studio
so it doesn’t automatically update and break everything. If you wish to still keep OBS up to date, see POST 2.
NOW we are ready to proceed with building. This part is exactly like the video once again. cd
to the place you extracted this:
and execute these commands, just like in the video:
meson build
ninja -C build
Now comes time to move the plugin into the proper place. Do exactly as described in the video by making these directories:
~/.config/obs-studio/plugins
~/.config/obs-studio/plugins/nvfbc
~/.config/obs-studio/plugins/nvfbc/bin
~/.config/obs-studio/plugins/nvfbc/bin/64bit
and putting the nvfbc.so
in the build
folder (like in the video, but the video didn’t show you had to go into the build
folder) and copying it to the 64bit
folder you just created.
The folder name nvfbc
is case sensitive, so it must remain in lower case for OBS to read it properly.
You DO NOT need to reboot to test it out.
Once it is complete, it will function assuming your build logs all check out, your paths are correct (remember, case sensitive on the plugin folder names) and you should be off to the races.
It will load as a “NvFBC Source” in the sources list.
Do keep in mind that for some reason the FPS option in the plugin is only in whole integers from 1 to 120. (you can’t go beyond 120fps because that’s the limit in the source code) This is unfortunate if your display is using NTSC drop frame, (which 120fps equals 119.88fps and 144fps equals 143.856fps) so this might cause some issues or it might not. Maybe with some fancy source code tweaking this can be added and 144fps could also be added. (The key here is making it a floating point value with decimals rather than a whole integer)
Optimally, you will want to run 60.00hz according to the monitor listing in Nvidia X Server Settings. Or you can get adventurous with randr
and set it to exactly 120.00hz. (UPDATE: SEE POST 5!) Going to 144hz will actually be a detriment to capture because of the 120fps cap on NVFBC in the source code for this plugin. (Hopefully this is a source code issue and not a hard cap in the API. If it’s a hard cap, then you will need to stick to 60.00hz and 120.00hz)
Thanks once again to Anthony for letting me know NVFBC is actually possible natively with said patch, and there’s an OBS plugin for it! (aside from the whole integers problem, this is very nice.)