Created
April 6, 2023 13:04
-
-
Save avin/7da3c9cf4562dd6fb0400d93bfcb5ec5 to your computer and use it in GitHub Desktop.
Periodical record in OBS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: This script automates video recording using OBS | |
:: Disable command echoing and clear the screen | |
echo off | |
cls | |
:: Set the log file path | |
set logfile="C:\utils\autorecord\logs\automate.log" | |
echo log file will be %logfile% | |
echo script launched | |
echo script launched > %logfile% | |
:: Set CMD window parameters | |
title obs auto recording | |
color 0a | |
:: Set the counter and maximum counter value (number of videos) | |
set counter=0 | |
set countermax=2 | |
:: Set video duration in seconds, secboot is the time required to open OBS before starting the actual recording | |
set secduration=10 | |
set secboot=5 | |
set /a duration=%secduration%+%secboot% | |
echo the timer will be %duration% seconds | |
echo the timer will be %duration% seconds >> %logfile% | |
:loop | |
:: Change the working directory to the OBS executable directory | |
cd "C:\Program Files\obs-studio\bin\64bit" | |
:: Kill any already running OBS processes | |
Taskkill /IM obs64.exe /F | |
echo task killed | |
echo task killed >> %logfile% | |
echo loop execution number: %counter% of %countermax% | |
echo loop execution number: %counter% of %countermax% >> %logfile% | |
:: Exit the script if the counter equals the maximum counter value | |
if %counter% equ %countermax% goto :quitscript | |
set /a counter+=1 | |
:: Run OBS in recording mode | |
start obs64.exe --profile "Безымянный" --scene "Сцена" --startrecording --minimize-to-tray | |
echo running obs in recording mode | |
echo running obs in recording mode >> %logfile% | |
:: Wait for the specified duration before stopping the recording | |
timeout /t %duration% /nobreak | |
:: Change the working directory to the OBSCommand executable directory | |
cd "C:\utils\OBSCommand" | |
:: Stop the recording to save the video | |
OBSCommand.exe /server=127.0.0.1:4455 /password=b00UOGOkrHIOgIrb /stoprecording | |
echo video ended | |
echo video ended >> %logfile% | |
:: Loop back to start another recording | |
goto :loop | |
:: Final step (script termination) | |
:quitscript | |
echo script terminated | |
echo script terminated >> %logfile% | |
pause | |
exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment