obs-spout2-plugin
obs-spout2-plugin copied to clipboard
Very high GPU usage
Describe the bug Every SPOUT output uses around 9% of my GPU (even when the filter is disabled in OBS).
To Reproduce Steps to reproduce the behavior:
- Open Task Manager (CTRL + SHIFT + ESC)
- Locate OBS process
- Add SPOUT output filter to a scene in OBS
- Check GPU percentage growth Bonus: 5. Disable SPOUT output filter in the scene (don't remove it) and check the task manager for any changes.
Expected behavior Better performance? For some reason I'm getting worse performance than when using NDI. Also, shouldn't the GPU usage decreases when the filter is disabled? This would at least allow the user to programmatically disable SPOUT outputs for better GPU performance while streaming.
About the Software:
- OBS 27.2.4
- OBS Spout 2 Source Plugin Version 1.2
About Your Machine :
- OS: Windows 11
- GPU NVIDIA GeForce RTX 2070 SUPER
- GeForce Game Ready Driver Version 512.15
- RAM 32GB
- Desktop - AMD Ryzen 9 3900X
Hi @febox6 thanks for taking the time to write this to us. I think it may be you has been in touch with us on our discord, but in case its not:
- Spout should not consume any computational resources on the GPU. All it does is at most copy textures to the GPU (and only when it can't access existing GPU textures).
- If you have very large textures, it is possible that it could be consuming more GPU RAM, but no shaders are being executed on the GPU and therefore it should not be consuming computational resources on the GPU
Where are you sending your Spout filter to? Do you have any other filters on your output? What resolution is the OBS workspace?
Thanks for the reply. It's not me on discord though.
For my project I'm sending the Spout output to an Unity project - but the issue happens no matter if the receiver is open or not. My resolution is 1920x1080.
I just tested this:
- Backed up my OBS;
- Added new empty scene;
- Removed all other scenes;
- GPU is back to 0%;
- Added Spout filter to empty scene;
- GPU shows ~ 8.6% usage;
- Added a second scene with the Spout output filter;
- GPU usage goes to ~ 17.5%.
In the task manager for the OBS process the GPU engine is "GPU 0 - 3D".
Thanks a lot for that information. I have been able to replicate locally.
We'll look into it and get back to you.
Do you have any updates on this?
I managed to replicate the issue on my end, changing the FPS value in OBS Settings > Video > FPS
makes the GPU usage go lower.
I also have an issue with my DAC, seems like the high GPU usage is producing a crackle and pop in my sound, the frequency of the sound artifacts increase and decrease with the FPS I set.
60 FPS - High GPU Usage - Higher Frequency of Audio pop and crackle 30 FPS - Half the GPU Usage relative to 60 - Half the Pop and crackle 1 FPS - Virtually no GPU usage - 1 pop and crackle per couple of seconds
It seems like the texture PULL is causing the GPU to take up a lot of resources, and the possible fix needs to be implemented in the code found in this file.
https://github.com/Off-World-Live/obs-spout2-plugin/blob/master/source/win-spout-filter.cpp#L94-L178
I messed around with this today, using Spout2 SendTexture
lets us avoid multiple copies GPU->CPU, CPU->CPU and then CPU->GPU.
https://github.com/millenium-cyborg/obs-spout2-plugin/tree/spout-sendtexture
From early experiments this makes the render time in OBS drop by a few ms per frame when using Spout2 sources. I haven't made a PR yet because the colours on the output texture are wrong, I suspect it's to do with the sRGB handling. Still just getting started learning how the OBS rendering works!