Author Topic: [Guide] Getting OBS Remote Like Features In OBS Studio  (Read 11730 times)

0 Members and 1 Guest are viewing this topic.

Dante557

  • Advisor
  • Councilor
  • **
  • Posts: 555
  • Karma: +26/-0
  • Sometimes Helpful, Sometimes Not :D
    • View Profile
    • My Twitch Page
  • Twitch Name: Dante557
[Guide] Getting OBS Remote Like Features In OBS Studio
« on: May 30, 2016, 11:41:23 AM »
SECOND EDIT: OBS Remote Functionality is now built directly into Deepbot. You can still get more functionality out of either using the remote or the hotkey method outlined below but the in built functionality in Deepbot is a LOT more stable and reliable

EDIT: OBS Studio Remote Application has been released in update, 0.9.7.1: http://wiki.deepbot.tv/obs_studio_remote (The application is located inside your deepbot folder)

Please note this may or may not work for you. If it turns out to not work for you, feel free to follow the guide below to achieve this control in OBS Studio while we figure out why it works on some machines but not on others.


Hey, you! Do you use OBS Studio? You do? Do you like OBS Remote? You do!? Well I'm sorry to say that OBS Remote is not currently supported in OBS Studio which is probably the one thing that is actually preventing some people from making the great leap over the the new fangled streaming application. In my personal opinion OBS Studio improves upon many aspects of the original and is currently is in a very usable state as it is right now.

Considering you're reading this, you probably are also a Deepbot user (Which is great!). Although this guide will be written with the Deepbot user in mind the essence of this guide should work with whatever application you have in mind. This works on the principle that something will detect when a file is saved in a certain location. This is the reason why a certain number of software is required to make this happen. Lets get started shall we?

Prerequisites

  • A working copy of Deepbot/Whatever you're using (Very important, a broken copy won't work as well as a working one)
  • A VIP Membership if using Deepbot (We're making use of the @savefile@ custom variable available in the bot)
  • OBS Studio (Yup)
  • Autohotkey (This is the program that'll be doing the, you guessed it, hotkeys)
  • Directory Monitor (To monitor our folder for any suspicious packages… and file changes. More likely the second one)

The Guide of Champion Hotkey Pressing

Step 1) Set Up Hotkeys In OBS Studio

OBS Studio comes pre-built with ability to use global hotkeys to affect various parts of the program. For our particular purpose we're just going to be enabling and disabling a source (Specifically the webcam source. We're giving control away to the broadcasting of your mug to the worthy viewing public. May God have mercy on your soul.). Apart from controlling the view-ability of your sources you can do a few other things apart for this particular usage such like;

  • Start/Stop Streaming (Are you SURE you'd want to give someone the ABSOLUTE POWER to stop your stream at a whim? Useful though if the command is accessable only by you though and you're out and about)
  • Start/Stop a recording (Pseudo-Clipping my friends, pseudo-clipping and with the original source material in mind as well ;))
  • Switch to a specific scene (Something special happens? Switch to a scene for x amount of seconds and then switch back. Your viewers will love you for it. Full screen jumpscares!)
  • Capture a specific window for Game source (Ok granted. Not useful at all but you CAN do it in OBS Studio now)
  • Mute/Unmute yourself or any audio source (Has some uses in terms of the stream believe it or not)

To access the Hotkeys menu click File → Settings → Hotkeys. For here just set a few hotkey of your choosing. I myself will be using CTRL + F because finding a suitable hotkey is an incredibly hard task. With that done we can move onto the next step.

Step 2) Setting Up The Folder

For this guide we'll be making use of the custom logs folder for Deepbot. We're using this folder specifically because @savefile@ already points to this location (Yes, I'm lazy but just deal with it ok?). Within the custom logs folder create another folder called Hotkeys. You don't really need to do this but if you don't organise one simple folder now you're pretty much lost to the world. Within the Hotkey folder (Yes, I'm guilt tripping you into making the folder. Do it!) create the following files, hotkey.txt and OBS.ahk.

These files will be used a little later on. For now, let's leave them blank, shall we?

Step 3) Setting Up The Script

AutoHotkey is an amazing little program really. The program sounds simple in nature (I mean judging from the name of the program it simply automates your hotkey presses to allow for you to do certain things quicker. You can pretty much make the hotkey do anything you want.) but is pretty powerful when put to good use. The program itself just reads little script files to achieve whatever you programmed it to do. Open a new tab in your browser? Sure it can do that. Start the washing machine? Hook a Raspberry Pi up to that and it's probably possible.

The script we'll be using is pretty simple. It reads a file (In our case, hotkey.txt) and puts this into the variable HotkeyToSend. It'll then check to see if OBS is currently open (The check isn’t perfect. It’ll consider ANY window that has OBS in the title.) and, if it is, send the hotkey detailed in that txt file to OBS. I've included the attachment that you need below this forum post but if you want to look into the code itself before doing so, here it is.

Code: [Select]
SetTitleMatchMode, 1 ;A window's title must start with the specified WinTitle to be a match.
SetWorkingDir, C:\DeepBot - Twitch Streamer Assistant\custom logs\hotkeys    ;Change this to where your Deepbot is currently installed.

FileRead, HotkeyToSend, hotkey.txt

sleep, 100

IfWinExist, OBS
{
ControlSend , ahk_parent ,%HotkeyToSend%, OBS
}
exit

Step 4) Set Up Directory Monitor

To make our little script actually work to how we intend it to work, we need to make use of a program that'll check for any changes that are made to the files within the specific folders. That program is call the ingeniously named Director Monitor. When this change happens it will then run the AutoHotkey script that we just created and the magic will happen before your very eyes. Lets get to it shall we? Open up Directory Monitor. You'll be presented with this screen;



From here, right click anywhere in the top white box and click add. From the screen that pops up make the following changes

  • In the directory box point it to the hotkeys folder. This will typically be located at "C:\DeepBot - Twitch Streamer Assistant\custom logs\hotkeys". Turns out the quotation marks don’t need to be included at this stage so don’t include them.
  • In the description box choose something witty to put in there. I chose to insult myself which is not shown in the screenshot below
  • Untick New Files and instead tick Modifications

Basically, make it look similar to how the following screenshot looks



Lets move on over to the Execute tab. Welcome traveler to where the majority of the magic happens. Find out where AutoHotkey.exe is (This is typically located at C:\Program Files\AutoHotkey) and paste the resulting path, including AutoHotkey.exe, in the execute box. Alternatively click the three dots to the right of the box and find AutoHotkey.exe that way.

Now, this is all well and good but at this current point in time we’re basically telling AutoHotkey to just open and do nothing. “That’s no good” as Sonic the Hedgehog would say. To get the true magic to happen we need to give it some parameters to work with. In the parameters box we will need to include the full path to our OBS.ahk script (Which, if you’ve been following these instructions, should typically be located at "C:\DeepBot - Twitch Streamer Assistant\custom logs\hotkeys\OBS.ahk".). The quotation marks do need to be included in these parameters though so make sure you don’t forget them! Otherwise you’ll be a sad panda when it doesn’t function as intended.

Alternatively you could have avoided finding the location of AutoHotkey.exe by just putting the full path to the OBS.ahk script in the execute box. Following this method instead when Save it will automatically move that link into the parameters box instead and autofill the location of where autohotkey.exe currently is residing. I just like to provide a learning experience in any of the rare tutorials that I do. No matter which method you decide to go with the execute tab should like similar to this;



Believe it or not that's practically all you need to do. The setup is complete. The final step is to actually make this method execute a hotkey. Get the champagne ready because this is the finishing line people.

Step 5) Making It All Work

Now it's time to actually test it in Deepbot. For the purpose of this tutorial make a command called !test (I mean, we do need to TEST to see if it works, right?). For the response text make it something similar to below. You can add whatever you wish but the whole point is to save the hotkeys we need to a file so it can be executed. The following example is making use of the shortcut I created earlier (CTRL + F).

Code: [Select]
@savefile@[hotkeys/hotkey.txt,{LControl down}{f down}]
Now you may be wondering what's the deal with the text we're saving. Why are we saving stuff surrounded in curly braces/brackets and why are you telling me to do this!? Well to answer question 2 you foolishly followed this tutorial right to the end but to answer question 1 it basically refers to our shortcut. AutoHotkey defines keys that need to be pressed by the use of these curly braces/brackets so it can automate all of your mundane tasks.

For example here we are pressing down left control and f. You can find a full list of the keys you can use at https://autohotkey.com/docs/commands/Send.htm.

That's it. The setup is all done!

You will need to open the Directory Monitor everytime you want to make use of this but apart from this, it should work pretty well for your OBS Remote like needs. Hopefully the guide explained everything clearly and got you on the right track.

GLHF (Turning Webcams Off)
El PresiDante

Extra Special Super Awesome Extra Bit – Opening Required Programs Using a Batch Script

Referring to the fact we need to open these programs every time we want this kind of functionality to happen it can be such a mundane tasks to open ALL those programs manually. How about we just smash that down all into one tiny little batch script to automate the hell out of everything we do? Other then bowing to our robot overlords this is actually a clever use of our time and is so stupidly simple you’ll kick yourself that you weren’t doing it before reading this very paragraph.

Here’s the batch file that I use for example. The code should explain itself really but all it does is….open the program detailed and then wait 3 seconds before opening the next one. Why 3 seconds? Do you want to bombarded your CPU with ALL these opening commands? Didn’t think so.

Code: [Select]
@echo off

:Open Snaz
cd "C:\Program Files (x86)\JimsApps\Snaz"
START Snaz.exe

TIMEOUT 3

:Open SMG
cd "C:\Users\Jordan\Documents\Useful Tool\SMG 1.63 beta"
START SMG.exe

TIMEOUT 3

:Open FooBar
cd "C:\Program Files (x86)\foobar2000"
START foobar2000.exe

TIMEOUT 3

:Open OBS
cd ""C:\Program Files (x86)\obs-studio\bin\64bit"
START obs64.exe

TIMEOUT 3

:open Chatty
cd "C:\Users\Jordan\Documents\Useful Tool\Chatty"
START Chatty.jar

TIMEOUT 3

:open DirectoryMonitor
cd "C:\Program Files\DevEnterprise\Directory Monitor 2"
START DirectoryMonitor.exe

TIMEOUT 3

:open VSTHost
cd "C:\Users\Jordan\Downloads\vsthostx86"
START vsthost.exe

TIMEOUT 5

:open Logitech Gaming Software
cd ""C:\Program Files\Logitech Gaming Software"
START LCore.exe

TIMEOUT 5

:open Deepbot
cd "C:\Users\Jordan\Documents\DeepBot - Twitch Streamer Assistant"
START deepbot.exe

exit

Save the resulting file as Livestream.bat and congratulations, you have your one stop shop for opening all that you need in your livestreaming career. Now lets open that champagne!
« Last Edit: July 07, 2017, 03:39:40 AM by Dante557 »
If you need to get through to me you can try to contact me on Twitter @ http://www.twitter.com/dante556

CreamBRabbit

  • Youngling
  • *
  • Posts: 5
  • Karma: +0/-0
    • View Profile
  • Twitch Name: CreamBRabbit
Re: [Guide] Gettings OBS Remote Like Features In OBS Studio
« Reply #1 on: June 02, 2016, 03:25:17 PM »
I'm getting an error that looks like this:

The window that pops up comes from AutoHotKey. Any idea how to fix this?

Dante557

  • Advisor
  • Councilor
  • **
  • Posts: 555
  • Karma: +26/-0
  • Sometimes Helpful, Sometimes Not :D
    • View Profile
    • My Twitch Page
  • Twitch Name: Dante557
Re: [Guide] Gettings OBS Remote Like Features In OBS Studio
« Reply #2 on: June 02, 2016, 08:36:40 PM »
Make sure to put quotation marks around it. Due to the space in the folder name it sometimes causes issues as far as certain programs if you don't surround it in them. With execute it classes the space as a new parameter so it throws an error at you. As such, two solutions

1) Change the folder name to Deepbot
OR
2) Surround it with quotes, so it looks like "C:\Users\Jordan\Documents\DeepBot - Twitch Streamer Assistant\custom logs\hotkeys\OBS.ahk"

I'll update the picture as well. This is what happens when you write stuff at 3 in the morning Kappa

Thanks,
Dante557
If you need to get through to me you can try to contact me on Twitter @ http://www.twitter.com/dante556

brettcadet

  • Youngling
  • *
  • Posts: 13
  • Karma: +0/-0
    • View Profile
  • Twitch Name: brettcadet
Re: [Guide] Getting OBS Remote Like Features In OBS Studio
« Reply #3 on: July 13, 2016, 04:21:33 PM »
There have been a few Deepbot releases since this post was made. So what is the "companion app that will be made available when the next Deepbot update is released."? Is it out?