Voice Control for OBS
Written by Paul Richards on August 2, 2022
Open Broadcaster Software (OBS) can be used with PTZOptics camera to control a variety of robotic movements including pan, tilt, zoom and PTZ preset recall. It is also possible to control OBS with your voice using a microphone connected to a Windows computer with a software called VoiceMacro. VoiceMacro is able to send voice commands directly to OBS using OBSCommands.
This blog post reviews how to control a PTZOptics camera with OBS. Extending the PTZ camera preset controls with voice commands in OBS is an extension of this knowledge discussed in this chapter. Using this workflow, you can recall PTZ camera presets that are saved into unique scenes inside of OBS.
Prerequisites:
- OBS
- VoiceMacro (Windows Only)
- OBSCommand Tool (Includes OBS Websockets installer)
In order to gain voice control over OBS software, you need to download VoiceMacro, the OBS Command Line Tool, and the OBS Websockets plugin. VoiceMacro is the main software used for voice recognition and it has the ability to pass arguments directly to the OBS Command Line tool to control OBS.
Getting Started with VoiceMacro
- Step 1: Create a Profile
- Step 2: Add Macro
- Step 3: Add Action
VoiceMacro is free tool you can use to create voice commands and send them to OBS. You can download VoiceMacro at voicemacro.net (Windows only). Once you have installed VoiceMacro you should open the software in “Administrator Mode.” VoiceMacro uses the Windows Speech Recognizer Engine. To configure the microphone you want to use to issue voice commands you can click on the hamburger button in the top right corner of the program and select “Recognizer Settings.” Here you can click the “Audio Input” button to make sure the microphone you wish to use is selected as the “Default Device.” Once your microphone is setup with VoiceMacro you can create a profile, add a voice command and define your command action.
To create a profile, click the Edit.. button to open the Profiles and Macros window. Here you can click “Add New” under the Profiles section to create a new profile to organize your voice commands. Next under the Macros section click “Add New” to create a voice command. Check the “Voice Command” box and give your voice command a name. These will be the words you would like to say in order to execute your desired action. Under the Actions section select the Other dropdown menu, where you will find the “Execute / Open a File…” option. This option will allow you to select the “OBSCommand.exe” file which should be unzipped on your desktop and ready to access. You can download the Command Line Tool for OBS from the OBS forums.
When you are setting up the VoiceMacro Action to execute the OBSCommand.exe program file, you can also pass an argument to OBS to select what you want to happen in OBS when the action is performed. For example, if you would like your Voice Command to switch to scene “Webcam” you should enter “OBSCommand.exe /scene=Webcam” into the arguments box. Below is a list of example commands that you can use with the Command Line Tool.
Examples:
OBSCommand.exe /scene=myscene
OBSCommand.exe /toggleaudio=”Desktop Audio”
OBSCommand.exe /mute=myAudioSource
OBSCommand.exe /unmute=”my Audio Source”
OBSCommand.exe /setvolume=Mic/Aux,0,50
OBSCommand.exe /setvolume=Mic/Aux,100
OBSCommand.exe /fadeopacity=Mysource,myfiltername,0,100,5,2
OBSCommand.exe /slidesetting=Mysource,myfiltername,contrast,-2,0,100,0.01
OBSCommand.exe /slideasync=Mysource,myfiltername,saturation,*,5,100,0.1
OBSCommand.exe /stopstream
OBSCommand.exe /profile=myprofile /scene=myscene /showsource=mysource
OBSCommand.exe /showsource=mysource
OBSCommand.exe /hidesource=myscene/mysource
OBSCommand.exe /togglesource=myscene/mysource
OBSCommand.exe /showsource=”my scene”/”my source”
You can now continue to create new macros for each voice command that you need to control OBS. In each unique Macro, you have the ability to create new trigger words for a variety of actions in OBS. You can also include additional Actions in Windows such as a Keyboard press, Mouse movement, and other easy-to-use options.
PTZ Camera Voice Control
Now that you have VoiceMacro set up you can use it to switch to an OBS Scene which is set up to call a PTZ camera preset. A PTZ camera preset is a saved pan, tilt and zoom location saved inside of your PTZ camera that you can recall with a command. You can actually call PTZOptics commands over the network using a Browser source inside of OBS with the unique IP address for your camera. This works by sending a scene switch command from VoiceMacro to a scene in OBS with Browser source input setup to send a command to a PTZOptics camera using an HTTP Command. The PTZOptics HTTP Command list is available at PTZOptics.com/downloads.
This process has been documented via video here and it quite easy to set up. Inside of your desired OBS scene you can select a Browser Source as the input. For the URL, you can enter “http://192.168.1.99/cgi-bin/ptzctrl.cgi?ptzcmd&poscall&1” where the IP address of the camera you wish to control is used and the last number is the preset number you wish to call.
In this way, you can add browser sources for each scene which will trigger your PTZOptics camera to move to a specific location based on a saved PTZ preset number.
Conclusion
Voice control over OBS is a powerful tool especially if you are an on-camera content creator or professional who has their hands busy. If you are on a production team or putting together a live stream with PTZ cameras you can automate your production by using voice control to call PTZ camera preset and other robotic camera movements. Because multiple sources can be included in a single OBS Scene you can set up multiple PTZ cameras to move with a single scene switch. This could be useful to changing scenes on a stage or preparing for a new section of live video production. There are many exciting ways to use voice control for your next OBS video production.