bazukas / obs-linuxbrowser

OBS Linux Browser Plugin
GNU General Public License v2.0
501 stars 48 forks source link

High CPU Usage with Streamlabs Widgets #53

Open JeffHoogland opened 6 years ago

JeffHoogland commented 6 years ago

I am using this plugin with OBS 21.0.1 on Ubuntu 16.04. I have 4 difference instances of it active in my scene which are capturing four different URLs from streamlabs. I have a fairly reasonable i7 -4790 processor.

When I watch my task manager while streaming there is a browser-subproc that is constantly using 40%~ of one of my processor cores even when nothing is changing on the URLs being captured. This is more CPU than the rest of OBS is using. When the URLs start seeing some action, there are other browser-subproc instances that start eating CPU as well, some of them using over a full core for a short period of time.

Is there anything I can do to change / improve performance? It causes my system to start to bog in a noticeable way on occasion.

grimmy commented 6 years ago

Alerts seems to be the worst offender here.. Although the tip jar does make a noticable difference to. I'm running version 0.3.1 of the plugin.

NexAdn commented 6 years ago

Maybe #59 can help you if you figure out how to stop some of the scripts that are running.

NexAdn commented 6 years ago

obs-browser had a similar issue (obsproject/obs-browser#78). Apparently CPU usage can be resolved by enabling hardware acceleration and that should be not that hard to implement (as far as I have seen it you just have to pass on some command line flags to the rendering subprocesses).

EDIT: As I recently have this high CPU usage on my machine I did some investigation. I only get a high CPU usage for 1–2 renderer processes when using youtube chat window with a custom CSS file [1]. As far as I see things keyframe animations seem to cause high CPU usages. I could reduce CPU usage of one subprocess to about 3% avg. by reducing most animations.

Using the command line flag --enable-gpu didn't change anything noticeably, but I got another performance boost by passing --enable-gpu-compositing.

[1] https://gist.github.com/NexAdn/a928ea7b00f7fb172825b5ea6f1d4746

JeffHoogland commented 5 years ago

@NexAdn do I need to recompile the plugin to get --enable-gpu-compositing to work or is it a setting somewhere in the plugin in OBS?

NexAdn commented 5 years ago

Should be fine if you pass these args using the provided source properties window.

JeffHoogland commented 5 years ago

Ahh so I just put them here then? image

NexAdn commented 5 years ago

Exactly. I've also noticed that using many keyframe animations can cause high CPU usage.