Question / Help OBS in Background?

GreenBrainsEcke

New Member
I plan to build a StreamDeck. The whole thing runs with shortcuts. What is when obs is running in the background? Can I still use it?
 

Narcogen

Active Member
I think if you want a way to interact with OBS programmatically even when it is in the background, you want to use websocket, not keyboard shortcuts.

 

GreenBrainsEcke

New Member
Its an Arduino Pro Micro that sends Shortcuts to the PC if i press a button. In the case of Websockets i have to connect with TCP/IP?
Then i have to youse a esp8266 an connect it via w-lan?
 

koala

Active Member
If your streamdeck is able to simulate keystrokes, it's possible to send some hotkey, and if in OBS some action is connected to this hotkey, it's possible to invoke that action from your streamdeck. Regardless of OBS running in background or foreground.
For Windows, thus for OBS, and for every other app on the connected PC, your streamdeck appears as keyboard device.

However, the websocket plugin allows more control over OBS than simple hotkeys.
 

Narcogen

Active Member
Koala, what is the source of the complaints about OBS being unable to capture hotkeys when not in the foreground? Is that a resolved issue?
 

koala

Active Member
If the current foreground app is running as admin, and OBS isn't running as admin as well, OBS isn't able to capture hotkeys. This is a security measure from Windows, not some OBS flaw. It's to prevent malicious background apps from capturing what some admin app is receiving from the keyboard. To enable OBS receiving hotkeys from a foreground app that's running as admin, OBS has to run as admin as well.

So either run your foreground apps and OBS both not as admin, or if you run one of your foreground apps as admin, run OBS as admin as well.

(With "foreground app" I mean the active app. The app that currently has the focus. The app that is currently receiving entered keys in the first place. The focus usually changes if you stream more than simply one game)
 

Narcogen

Active Member
Cool. Not suggesting it was a flaw, just that some people have issues getting keystrokes to be received. Most of the 3rd party software I've seen (including that which actually ships with the real Elgato Streamdeck) uses websockets and not keystrokes to send commands to OBS, and it's my understanding that this always works, whether OBS is run as admin or not. Thanks for the clarification.
 

koala

Active Member
Remote control through Websocket will always work, because a socket connection isn't restricted by being admin or non admin. Only the hotkey transport mechanism within Windows is restricted by Windows.

This brings up a related issue. Hotkeys can also be artificially generated by mouse or keyboard companion apps like the widely known Logitech Gaming Software. For these companion apps, the same restrictions apply as with OBS, only the other way round. These cannot send (generate) hotkeys to an app running as admin, as long as they are not themselves running as admin.

This means, if you start OBS as admin, you need your companion app to start as admin as well. Otherwise you cannot generate hotkeys that OBS will recognize.

For example, if you have a MMO mouse with 12 keys and assign some of these keys in your companion software to send the hotkey for start/stop recording or switch to some scene. If you run your game as admin, thus run OBS as admin to be able to receive hotkeys while your game is active, you need your companion app run as admin as well, otherwise it would not be able to send a hotkey with a "priority" so high that your admin-running OBS is able to recognize it.

This is all basic Windows security stuff, it doesn't exhibit any flaw in OBS, your game, or the mouse companion app. Best practice is to not ever run any app as admin. The change in OBS 24.0.3 to enable OBS to reserve GPU resources if it is started as admin is a workaround for lost frames with this ugly side effect. I hope, Jim will find a way to enable this feature without the need of running OBS as admin.
 
Top