In many cases, especially if you are running unattended automation, you are using logs and similar tools to document what Foxtrot is doing throughout the process for documentation and to be able to backtrack event if an error did occur. It is greatly appreciated both from a technical and business perspective to screen record either the whole or parts of a process to be able to (re)watch the executed automation. When you have unattended automation running, you will also have automated error handling, meaning that you will not actually see the error and the state of the different applications in the moment of the error. Sometimes, this makes it close to impossible to troubleshoot as many errors are caused by abnormalities that are difficult to recreate. By recording the execution of the automation, you will be equipped with a video that shows you everything that happened, which will help to troubleshoot situations like that plus offer general documentation on what your Foxtrot projects are doing in your systems.
In this article, we will explore how you can smoothly perform screen recording using the free and highly popular Open Broadcaster Software (OBS) application.
Installation
To get started, you need to first download and install the OBS Studio application from their website:
After downloading and performing the installation, you need to implement two additional tools in order to be able to automate the process of starting and stopping the screen recording. First, download this websocket plugin tool from their resources site. Make sure to select the zip version as shown in below screenshots:
Scroll down to find the assets and select the zip file.
After downloading the zip file, you should unzip it (anywhere is fine):
After unzipping the files, copy the two folders:
And paste them into the OBS Studio installation folder:
Now, after doing that, you only need one last thing. Go to this second resource page to download the command line tool that we will be using to control OBS Studio (start and stop the recordings) directly via the CMD:
Again, after downloading it, simply unzip the files anywhere:
The files you will need are in the "OBSCommand" folder. You will actually use these files quite often, therefore, we recommend placing them somewhere convenient, for example, directly on the C: drive. Simply copy the folder:
And place it on the C: drive.
You are now ready to get started!
Set up OBS Studio
Go ahead and open the OBS Studio application.
After opening it, you should see the OBS Studio application like this.
The OBS Studio application is very powerful. You can customize it however you would like. You can manage everything from Frames Per Second (FPS), resolution in- and output, have different sources, etc. For this article, we will just show you the bare minimum to get started:
- Make sure the tools are installed correctly
- Add your desktop screen as a source
- Make sure it is working properly
- Adjust the output destination of recordings
Make sure the tools are installed correctly
First, you need to make sure that the websocket plugin tool is installed correctly. You check that by navigating to tools and "Websocket server settings".
Here, make sure it is enabled and you have unchecked the alert option.
You should now be good to proceed.
Add display as "Source"
The first thing you need to do is add the display as a "Source", meaning you wish to include this in your recordings. Simply click the plus icon and select "Display Capture":
You can give it any name you would like. We will just stick with the standard name and hit OK.
Now, you select the display. Usually, you will have only one screen to select, especially if you are on a machine running automation, but if you have multiple, select the appropriate one for you and hit OK.
IMPORTANT: Now, notice that in the above screenshot, the preview is blank. That indicates that something is wrong and we will need to adjust some settings to enable OBS Studio to record our screen. If you do see the preview, you should be fine to skip the next part.
Now, the solution to fix this issue might not work universally. So, if the presented solution does not work for you, you can Google the problem and you should be able to find alternative approaches to solving the issue that might fit you. On this PC, the problem is with the graphics settings. To solve it, we right-click on the desktop to the NVIDIA Control Panel:
In the control panel, we go to "Manage 3D settings" and "Program Settings". Here, we select the "Open Broadcaster Software" program to change the preferred graphics processor from being the NVIDIA GPU to the Integrated graphics.
After selecting the option, make sure to click to apply the changes. Then, close the control panel and restart OBS Studio. Now it should work properly. Again, if it doesn't, you will need to try to Google it to find the solution. You know that it works when you see the screen inside of OBS Studio:
You are now ready to record!
Adjust the output destination
The last thing before we get to the fun part, here is where you manage the destination of the output files:
So, let's do a short test. Simply press "Start Recording", let it record for a while, and you should see an output file like this:
That's it! Now we are ready to use Foxtrot to automatically record your screen.
Get Started Recording
After everything is installed, it is now time to get started with the fun part! To smoothly record the screen during Foxtrot projects, there are four steps to consider:
- Open OBS Studio (in minimized mode)
- Start recording
- Stop recording
- Close OBS Studio
Now, it is important to keep in mind that the optimal way of recording your automation fully depends on your specific needs. Some people like shorter recorded videos, one video per executed project, sometimes even one video per executed loop inside the project, other times you might want to just have it record for a long period of time over a timespan where multiple projects have been executed. The general concept of HOW to perform the above mentioned four steps is the same, then you can always decide when you would like to do it as you can do it:
- Inside a project in Foxtrot, for example, open OBS and start recording at the beginning of the project and stop recording and close OBS at the end of the project
- Using batch files and the Windows Task Scheduler, for example, to schedule one job to open OBS and start a recording every day at a specific time and a second scheduled job to stop the recording and close OBS.
For this article, we will set up the logic in Foxtrot, again, you can use the same commands in, for example, batch files if this suits your needs better.
Open OBS Studio (in minimized mode)
To open the OBS Studio application in minimized mode - minimized mode is best as your Foxtrot projects should be able to run without the OBS application being visible on the screen and potentially interfere with the automation - you can use the following command:
"C:\Program Files\obs-studio\bin\64bit" && start obs64 --minimize-to-tray
IMPORTANT: Remember to keep in mind that the path to your OBS Studio might be different from the above and all the following examples. Make sure to adjust it to your specific path.
Now, when doing this inside of Foxtrot, we recommend that you create a variable with the path to the OBS Studio exe file to make it easier to maintain:
The command would then be:
"cd "[?LeftOf([%Path_OBSStudio],"\",,False)]" && start obs64 --minimize-to-tray
This command will open the OBS Studio application in minimized mode. After running this command (or as an appended part of the command), make sure to implement some forced wait to make sure that OBS Studio is offered enough time to fully open before moving on to start the recording. Because, if the OBS Studio is not fully opened by the time you run the command to start the recording, it will not work properly.
Start Recording
After the OBS Studio application is opened, you can now start the recording. To do this, we will use the "OBSCommand.exe" program that we downloaded. The command to start the recording is:
"C:\OBSCommand\OBSCommand.exe" /startrecording
IMPORTANT: Remember to keep in mind that the path to your OBSCommand.exe program might be different from the above and all following examples. Make sure to adjust it to your specific path.
Now, when doing this inside of Foxtrot, we recommend that you create a variable with the path to the "OBSCommand.exe" program to make it easier to maintain:
The command would then be:
"[%Path_OBSCmd]" /startrecording
This command will start the recording exactly as if you click "Start Recording" manually in the OBS Studio application.
Stop Recording & Close OBS Studio
The beautiful thing is that in order to stop the recording, you will do the exact same thing as when you start the recording, except you write "/stoprecording" instead of "/startrecording". The full list of commands is outlined on the page where you downloaded the command line tool:
And to close the OBS Studio, you can simply use a Stop Process action or the DOS Command action to stop the process. You just have to make sure that you leave an appropriate number of seconds/minutes between stopping the recording and closing OBS Studio as it might take some time for OBS Studio to compile the output video file. If you close OBS Studio before it is done doing that, you will not get the full video in your file!
Here is an example of how it could look in Foxtrot:
Obviously, then you can automate the part of grabbing the output video file, maybe rename it to something appropriate and move to a certain folder or maybe send it in an email. You basically have infinite options to design it exactly the way you would like it to work.
Comments
2 comments
This has helped me in many ways than you can imagine. thanks. please do see my blog at https://www.clevernero.com/how-to-screen-record-on-iphone/
Hej med dig
Please sign in to leave a comment.