Setting OBS to Start and Stop Recording Automatically

(Video at the end…) OBS is a great tool for capturing screencasts for classes and such. I also use it sometimes to capture zoom and webex chats when I want the entire screen recorded full-sized. (By default those apps record and show other things like chat on the screen which isn’t useful for me). Sometimes I’m in class when my webchats start, so I wanted to automate the recording setup just like you used to be able to do with old VHS tapes on a VCR.  Simply program the start time and the stop time (assuming your VCR didn’t just flash 12:00 forever because you never figured out how to set the clock on the thing).  Of course you have to have your chat already started and opened on the screen you wish to record before you start OBS or you won’t record anything but a blank desktop with no sound… ask me how I know.  it works better with dual monitors and muting the external microphone inputs.

OBS has a STOP feature built-in. Simply open OBS and go to Tools–>Output Timer and you can set a time limit for how long you want it to record for.  I also check the box for “start every time” when I set it up this way.

The tricky part is STARTING the recording. Since OBS doesn’t run as a background process, it can’t just open itself and do whatever it wants. That’s just not safe. The work-around for this is to create a Windows Task that will do it for you. Windows Tasks are incredibly helpful. It’s like a cron job on linux. Even windows itself uses this tool for checking for updates and running virus scans for you.  To access it, simply click your windows icon and type “task scheduler”

Once it loads, you’ll need to doubleclick the “Task Schedule Library” in the left pane. If you don’t doubleclick it, then you won’t have the ability to create a task. Kind of a bad design in my opinion, but easy enough to work around.

Click Action–>Create Basic Task to open the wizard for you. It’ll walk you through the steps for setting the trigger you want. (In my case, I just want it to be a timed trigger at a certain date, but you can have it repeating, or based on a user’s action, or even every time you login. I set the time for about 5 minutes before the start time of my webchat.

 

Then it asks for what action it should perform when this task is triggered.  This is where we will tell it to open OBS and start the recording. To figure out what to type here, you’ll click your windows icon and type “OBS” but instead of opening it, right-click the icon and select “open file location” This will open the start menu folder.  Right click the OBS icon and click “properties”

Copy and paste the “Target” to the task Scheduler’s “”Program/Script” box.

Then copy and paste the “Start- in” path to the Task Scheduler’s “start in” box. But you have to remove the quotation marks on this one or it will not work!

Finally, you’ll need to type in some arguments for the Task Scheduler. Type:

--startrecording -m

 

The -m is there to allow multiple OBS windows to run at the same time in case for some reason you forget to close the previous one. Without this in the command, OBS will just give an error if another window is already opened.

Click OK to finish this task.  You will then be able to find your new task in the Scheduler’s window. If it is a long time before your trigger point, you can test it by right-clicking and selecting “run” and it should immediately open OBS and start recording.  If this doesn’t happen, then go back and make sure you don’t have quotation marks on the “Start in” function of the task.

I had a bit of trouble setting this up on my older laptop for some reason. I just could not get it to run directly from Task Scheduler. Instead, I wrote a windows batch script with the command in it, then passed the path to it as an argument to the “cmd” command (the windows command terminal/console).  Worked like a charm. First, open notepad and enter the following:

"C:\ProgramData\Microsoft\Windows\Start Menu\Programs\OBS Studio\OBS Studio (64bit).lnk" --startrecording -m

and save this file as “obsScript.bat”  The icon should change from a notepad file to a script icon as shown below.

If you can’t get it to change even by adding “.bat” to the file name, then you need to show file extensions in windows. Open any folder, click View–>Show filename Extensions as shown below then change the filename.

Once this batch script is created, simply create a task for it like we tried to do above, but the path to the program/script should point to our new batch script.

Remember, you can always doubleclick the task in the schedule window to edit the different features. The command itself is listed under the “Actions” and the time is set under the “Triggers” tab.

When you run it, you should see the black command window pop up with the command, then OBS should start.

COMMON QUESTIONS:

Question: I want it to stream instead of record
Answer: Then use –startstreaming instead of –startrecording

Question: How can I make it record multiple times without opening a new window each time?
Answer: There are a couple of ways to do this.  The easiest is to close the window first.

Question: How do I make it automatically close the OBS window when done recording?
Answer: Schedule a “taskkill” command in the scheduler. This is like using the task manager to kill an app. You’ll need to know the time that you want it to end.  The command might be:

taskkill \IM obs.exe

If that doesn’t work, add a “\F” to the end of that line to force-close the program.

Question: How can I start a recording automatically when a call stats on zoom or other services?
Answer: You might be able to do this in TaskScheduler, but I did find a solution script for the program AutoHotKey on the OBS forum that checks to see if zoom is started.

Question: It doesn’t work, even with the batch script. What do?
Answer: You need to be in an Admin account in windows for it to work.

Question: I only have one screen. Wheen OBS starts it hides the content I am trying to record. What d?
Answer: In OBS Open Settings, under General tab > System Tray, select “Minimize to system tray when started”

Here’s the video showing the whole setup. You’re welcome!

 

17 thoughts on “Setting OBS to Start and Stop Recording Automatically”

  1. Is there a way to start a live stream? –startstream… -m??? Somthing like this? Thank you in advance.

  2. Issue i have is being able to record a TV Show (ex: on Roku Channel) and have OBS output one file per episode. Roku Channel will continuously play the next episode one after another. But with OBS I have to manually stop and start the recording.

  3. I don’t know of a clean way to solve that. If all the episodes are exactly the same length, then you could set the timer for that time, then set the scheduled task to restart continuously in that same amount of time.

  4. Hi Adam, how to make the recording start automatically after stopping? I need to make a continuous recording but if there’s something wrong like a power failure then my hours of recording will be gone. So I need not only it can stop after a specified time but also start again automatically and make a loop of it.

  5. That is a tough problem to solve for sure. I have a couple of suggestions that might work:
    1. Set up your scheduled task to begin as soon as the computer boots up. That way it’ll record as soon as power is restored. Make sure any other apps you are trying to record from are scheduled in the scheduler to start up before OBS. This should cause the least amount of lost data.
    2. Maybe break the recordings up into multiple smaller scheduled recordings. For instance, I would se up the scheduled task to repeat each hour. This way if you lose power after say 45 minutes, there’s only 15 minutes of lost data before the next recording starts. You’ll need to use the -m in the task for sure to allow multiple instances of OBS to run at once. Every now and then you will need to go in and kill the old OBS instances manually that are no longer recording because they will still be opened. I’m not sure if there’s a way to close them automatically.

    Good luck!

  6. Did you say to
    reboot the computer with Task Manager schedule
    to stop OBS recording
    because MKV file will not be corrupted with power down?

  7. I don’t think I ever said anything about rebooting using task manager. In another comment I mentioned if someone has power outages, then you can set up in the task scheduler to start recording as soon as the computer comes back on. Rebooting with task manager while a video is being recorded will likely lose some data. However, MKV formats are more forgiving than MP4. If data gets written to the hard drive as a partial MKV file, then it can be saved in most cases. MP4s must have the entire file encoded otherwise the file is corrupted and unusable and cannot be fixed.

    There are certain situations that will even cause the MKV files to be damaged beyond repair. For instance, if you shutdown the process before any part is written to the hard drive, then no, there will not be any data you would be able to retrieve at that point. This can happen when data is being saved in RAM by the computer but has not yet been written to the hard drive.

  8. Hi Adam,

    I have only one screen, and when the OBS start recording it is shown on the screen and cover the Kodi program I want to record.
    Is there a way to start the OBS recording in minimized window?
    Thanks,
    Green.

  9. With only one screen, you want OBS to start minimized to the system tray (near your clock on the bottom taskbar. You can set that up by opening Settings, under General tab > System Tray, select “Minimize to system tray when started”

  10. Thanks for the replay 🙂
    I found another way to do it:
    in the scheduler task, I add the argument: “–startrecording -m –minimize-to-tray”

    the –startrecording is your idea!

  11. Hi, thank you for all your work on this topic. I think I’ve found a solution that will be helpful, the Advanced Scene Switcher plugin. I’ve tried it a couple times and it seems to work really well. It’s different from the Automatic Scene Switcher feature that comes with OBS.

    You can use Windows task scheduler to start OBS. Then make OBS macros to handle all the timing. Using the Output Timer in OBS doesn’t work well with the macros. Just make a macro for when to start and another for when to stop.

    See comment #7 here:
    https://obsproject.com/forum/threads/how-to-schedule-recording-to-start-at-a-specific-time.151940/

    A couple other things I’ve run across yesterday. I see you mentioned MKV vs MP4 files. I’ve found VLC or XMedia Recode can easily remux (copy) MKV files to MP4 files in a matter of seconds. By default most programs will re-encode which can take hours. So if someone wants the robustness of MKV when recording but the universality of MP4 afterward, it’s not difficult to do. And Lossless Cut works well for trimming MP4 files. By using that, it again only takes seconds rather than hours to re-encode like most editing programs. It cuts at key frames so it’s not as precise but it’s really quick and often good enough for what I want.

  12. With a series of macros it should be possible to record single episodes like Nnyan had asked about. Otherwise Lossless Cut could cut a longer recording into individual episodes without too much work. Looks like Lossless Cut is supposed to handle MKV files directly but I’ve had multiple issues with it. It can also quickly remux MKV to MP4. So far it seems like most of the time it will take in an MKV file. Then can trim/cut if wanted and export to MP4 all in just a couple minutes. Seems to have issues exporting to MKV though. Years ago on my XP computer I had a program similar to Lossless Cut that also had scene detection and was pretty good at automatically removing commercials. I found a scene detection feature in Lossless cut but not sure how useful it is.

  13. Is there a way to make a screenshot?
    ex) –screenchot -m
    Somthing like this? Thank you in advance.

  14. Thanks Adam
    It worked for me thank you.
    I added the start streming option as well –startrecording -m –startstreaming -m
    I am a novice with streaming and have added my stream in your website link
    GMT 05.00-19.00

Leave a Comment