Language: Deutsch English















Last Update: 2021 - 12- 18





Using an External Number Pad for OBS Studio Hotkeys

by Philipp Stiefel, originally published 2021-12-21

last updated 2021-12-23

This text is primarily a “note to self” kind of post for (my) future reference. My own personal requirements to the solution are somewhat exotic, so this whole text might address something that’s a complete non-issue to you.

I needed to find a way to configure and use OBS Studio Hotkeys which are …

  1. super easy to hit, and
  2. do not affect my normal keyboard use.
Elgato Stream Deck

My recording/streaming (not yet) setup involves scenes where I stand next to a desk and face away from the computer/keyboard. So, I need hotkeys I can hit (almost) blindly. Any key combinations, such as [CTRL]+[X] are out of the question for this scenario. It’s hard enough to hit a single key without really looking.

[Links in this paragraph are Amazon Affiliate Links] The normal solution for this kind of requirement would have been the Elgato Stream Deck, which is sort of a special mini keyboard with programmable keys. However, I’m a little cheap and the Elgato Stream Deck Mini with only 6 keys already costs ~80 EUR. The standard Elgato Stream Deck with 15 keys is at ~150 EUR and the Elgato Stream Deck XL with 32 keys at ~225 EUR.

So, I wondered whether I could use a cheap (~15 EUR) external Number Pad instead of the significantly more expensive Stream Decks. - It turned out this is much more difficult than I anticipated.

A cheap external number pad keyboard

Problem 1 – Recognize the Source Device of Keyboard Events

An external num-pad just sends the normal keyboard events of the number block. – But I want to be able to use the built-in num pad to type normally. Therefor I need to be able to recognize the source of the keyboard event to treat the key presses from the external num pad differently than those from the built-in num pad of my keyboard.

There are only very few hotkey tools available which can distinguish keyboard events by their source device. The most promising (=almost only) which I ended up using is LuaMacros.

Another very interesting find was this Raw Input C# project on Codeproject. However, it is a sample application to monitor keyboard input and not a working keyboard shortcut tool. Even though I like this approach very much, I don’t feel inclined to put in the work to enhance this sample to satisfy my requirements.

Problem 2 – Send Synthesized Keyboard Macro to a Specific Application/Window

Only very few keyboard macro tools are able to send synthesized keyboard macros to an application/window which is currently not the active window; LuaMacros is not one of them. Unfortunately, when using OBS to record or stream demos or presentation, OBS usually is not the active application window, so this requirement is mandatory.

The most promising tool that is able to send synthesized keyboard input to a specific, non-active application window is AutoHotkey.

Solution – Combine the Two Keyboard Macro Tools

So, I identified two different major problems and found a tool to solve each, but each tool solves only one of the problems.

My idea to solve both problems was to combine both tools.

1. LuaMacros

I use LuaMacros to translate the conventional num pad input from my external num pad into different keys that do not interfere with my normal typing.

Here is the Lua script to convert the 4 keys on the corner of my number pad ([ESC], [=], [0], and [Enter]) to function key [F21] to [F24]. I choose these F-Keys because they don’t trigger an action in any other application, I usually use during recording videos.

-- assign logical name to macro keyboard lmc_assign_keyboard('MACROS'); -- define callback for whole device lmc_set_handler('MACROS',function(button, direction) if (direction == 1) then return end -- ignore down if (button == 27) then lmc_send_keys('{F21}') elseif (button == 221) then lmc_send_keys('{F22}') elseif (button == 45) then lmc_send_keys('{F23}') elseif (button == 13) then lmc_send_keys('{F24}') else print('Not yet assigned: ' .. button) end end)

2. AutoHotkey

AutoHotkey is able to capture the keyboard input sent to any window, including the synthetic F-Keys generated by LuaMacros. So, as a second processing step, I use AutoHotkey to capture the F-Keys generated from my number pad input and redirect those explicitly to the OBS window.

The AutoHotkey script, using the ControlSend command to send the F-Keys to the OBS window.

F21:: ControlSend,, {F21}, ahk_exe obs64.exe return F22:: ControlSend,, {F22}, ahk_exe obs64.exe return F23:: ControlSend,, {F23}, ahk_exe obs64.exe return F24:: ControlSend,, {F24}, ahk_exe obs64.exe return

3. OBS Studio

Defining the hotkeys in OBS Studio is supported by the UI and straight-forward. I don’t need to address this in detail.

Conclusion

I spent many hours finding the solution described here and I need two different, daisy chained keyboard macro tools. This setup basically works and satisfies my requirements, but it’s still too early to know how stable and reliable it is long term. – In addition to this “solution” I saved about 135 EUR compared to the Elgato Stream Deck. (I’ll soon need more than the 4 keys handled in the scripts above, hence the Stream Deck Mini would not suit my needs.)

My advice to anyone with similar requirements: Spent the money and get yourself a stream deck!

On the other hand, you’ve got it much easier with this text as a guide, while I needed to figure out all this myself. – Your choice. ;-)

First Recording Experiences - Update 2021-12-23

I’ve now recorded multiple videos using my external number pad with the setup describe in this text. – It works extremely well! I consider my time spent on researching and implementing this spent well.

However, I noticed an unexpected drawback, which I should mention. Some applications (e.g. One Note for Windows 10) seem to circumvent the Windows keyboard event queue and still receive the original key presses from my num-pad when they are the active application window even though they should have been swallowed by LuaMacros. – This is no problem for me at all, as I usually do not actively use One Note during my videos. Nevertheless, it might affect you if you use such an application in combination with OBS and this num-pad setup.

Logitech R400 Presentation Remote

This morning I also made an interesting discovery: The very same approach described here for the number pad also works exactly the same with my Logitech R400 Presentation Remote. This opens up even more possibilities for recording setups where I do not need to be near the keyboard at all to trigger OBS hotkeys. – I’ve not tested this in a real recording situation yet.

Share this article: Share on Facebook Tweet Share on LinkedIn Share on XING

Subscribe to my newsletter

*

I will never share your email with anyone. You can unsubscribe any time.
This email list is hosted at Mailchimp in the United States. See our privacy policy for further details.



© 1999 - 2021 by Philipp Stiefel - Privacy Policiy