OBS on Linux - High average time to render
preface
Just switched one of my systems that I use to host applications from WIndows 11 to Ubuntu 23.10. I use OBS + Advnaced Scene Switcher + NDI to share my screen during collaborative sysadmin / software development sessions with my peers. I also use this machine for watching streams while in Discord calls, to offload resources from my other machines (works great). So, I have reasons to use GUI Ubuntu.
the issue
When I got around to configuring OBS I noticed that my average time to render frames was 4x+ higher than what it was on Windows (9ms vs 2mx). Same computer/hardware, screen capture source of the same 4K display. I'm using XSHM as opposed to PipeWire for screen capture. With PipeWrie I get 50ms+ render time, vs 9ms with XSHM. When I'm actually interacting with the PC, the render time jumps into the mid to high teens at times; which results in frame drops. Though, the output isn't unusable or anything.
suspicion
I suspect that this is simply the performance I am to expect for this rig running Ubuntu. But just wondering if anyone has any tips or tricks for increasing performance in OBS on Linux. Or if anyone has any other insight on the subject. I find it Interesting that performance is so much better in Windows in-regards to OBS. Though, I understand it is a completely different environment.
covering some bases
- system power mode is set to "Balanced", which is the highest available option.
- Tested using Ubuntu's standard and lowlatency kernal. Currently using the low latency kernal for audio stability (see here).
- I've verified that my GPU driver is installed & working, as well as trying multiple versions of said driver.
- I installed OBS with Flatpak, but also tried installing the deb version to make sure it wasn't a sandboxing issue.
- I get the same results with a fresh install of OBS. Default scene, one 4k screen capture source, and no plugins installed.
relevant system info
- operating system - Ubuntu 23.10
- cpu - AMD Threadripper 2970WX
- gpu - RTX 4070 Ti (nvidia-driver-545)
- ram - 128GB DDR4 @ 3200Mhz
relevant obs info
- version - 30.0.2 (64 bit)
- base/output canvas - 1920x1080
- framerate - 60
4 Replies
Have you tried forcing OBS to use a higher CPU priority (lower nice) value?
Have you tried forcing OBS to use a higher IO priority (like realtime)?
Looking into this now, thanks for the suggestion. One of the first things I did was look for the priority drop down in the Advanced settings section of OBS's settings. Not there like on Windows.
Pretty new to Ubuntu proper, I didn't know there were adjustable priority levels.
They're a little more obscure to use. You typically have to start the process from the command line like
nice -n -10 obs
for CPU priority or ionice -n3 obs
for IO priorty set to realtime
You an do both with a bash script and then create a symbolic link to your app that wraps around the app you want to prioritize: https://unix.stackexchange.com/a/197523Unix & Linux Stack Exchange
set default process and IO priority on Linux for given application/...
Is it possible to set up some sort of default process and IO priority for given application/executable? I am thinking some sort of FS extended attribute or loadable "policy" of sort?
Was just taking a look at
htop
and my PipeWire processes startup with -11
on nice without providing additional flags. Wonder how they're managing that. Currently building and running PipeWire from source so I can use AES67 (audio over network).
I wonder if I could pack that parameter into a .desktop
file as well. I'll try a few things. Definitely seems like it could make a difference.
Unfortunately, it doesn't look like this changes the time to render. Set them both to negative values like PipeWire, but getting the same result. I think it is what it is.
One thing I could try is using a capture card to grab the 4k monitor. That's always been pointless on Windows PCs, but screen capture seems super inefficient on Linux, or at least Ubuntu.
For now I'll use it as is, I'm not used to seeing the % dropped displaying anything about 0.0%
but it's still relatively low.
Someone on the OBS forums is suggesting it's an X11 problem. Can't quite run Wayland yet due to shoddy compatibility with Nvidia and no support from Synergy. That being said, it sounds like support for Wayland is coming to both of these soon. Maybe I'll get to test that later this year if things pan out.