ERROR "OBS did not shut down properly ..."

What program should I use to run these scripts? I'm a complete beginner to them. A picture of the script would also be really helpful, thanks in advance!
I keep all my pc's in sync, so I place a few batch files, in shell:startup, to keep my pc's uniform, and also it minimises future work to get the pc up to speed. My one batch file is now as follows, obs.cmd.
This is probably way overkill, but I delete the safe_mode file once, then launch without the safemode check, and after the obs launches, I delete the file again. You can guess I was a bit annoyed by this constant pop-up.

Start -> run: shell:startup <enter> and create obs.cmd there. I go one step further, and drag and drop the startup folder into my OneDrive, that's how I keep my pc's in sync. The reference to shell:startup will then take you to your %onedrive%\startup

@Echo Off
echo Deleting %APPDATA%\obs-studio\safe_mode
if exist %APPDATA%\obs-studio\safe_mode del %APPDATA%\obs-studio\safe_mode
timeout /t 3 > nul

cd "C:\Program Files\obs-studio\bin\64bit\"
start "" "C:\Program Files\obs-studio\bin\64bit\obs64.exe" --disable-shutdown-check

echo Deleting %APPDATA%\obs-studio\safe_mode again
timeout /t 10 > nul
del %APPDATA%\obs-studio\safe_mode
 
I'm running a script similar to this but still getting the error message on Windows/OBS startup. Also, I always have OBS running as an administrator (for resource priority/preventing recording lag).
I'm the same as Wisq, using OBS as a replacement for ShadowPlay. Are there any other startup scripts that work?

The script I'm using is:
del %APPDATA%\obs-studio\safe_mode /y
cd "C:\Program Files\obs-studio\bin\64bit\"
start "" "C:\Program Files\obs-studio\bin\64bit\obs64.exe" --startreplaybuffer



Log file attached if needed!
apologies, i didn't know that the del command doesn't support /y. See my post above. I've fixed the script in the post above. there is no way that file is ever showing up on your pc again!
 

bbeaudoin

New Member
Useful information. Sometimes OBS just hangs (refuses to shut down), especially if one of the sources is not present. That occurs more frequently than I would like, such as when the RTSP feed is interrupted from a remote camera or a source was not plugged in that was present before causing it to fail to start/shut down.

The error first presented after upgrading to the latest version of OBS around October. The error was also inconsistent (appeared on most, but not all attempts to start). I always selected to "Start OBS normally" and presumed a scene or source was to blame.

I fully removed all of OBS along with all settings and %APPDATA%/obs-studio, rebooted my system, reinstalled OBS, added a single source (my dedicated webcamera), shut OBS down cleanly, restarted it, shut it down cleanly again, restarted it once more. On the next attempt, OBS was slow to shut down and, when restarting OBS, the error appeared again. On the next attempt, no error, the "safe_mode" file is definitely created when OBS is started, apparently it isn't always getting removed or OBS just isn't shutting down completely.

Definitely seems to be a bug with the current version, on the previous version(s) even when OBS crashed or had to be force-killed due to a hang, I didn't have this error on startup. I also don't understand why such a mode even exists but, knowing this file always exists, explains why the behavior isn't consistent, something is causing it to be left behind some, but not all of the time, even on a fresh installation with a single scene and a single source.
 

Attachments

  • Screenshot 2024-01-12 113359.png
    Screenshot 2024-01-12 113359.png
    11 KB · Views: 88

bbeaudoin

New Member
Checking the logs, it seems if there are 0 or 2 memory leaks, the process shuts down cleanly without leaving the `safe_mode` file. If there is 1 memory leak, the file is left behind. Windows 11 23H2 with all updates applied (newer version than when OBS was first updated and started having this issue, I consider that unrelated as it also occurred on 22H2). The most recent execution ran ~12 hours with virtual camera on, I have not tried multiple scenarios, just an uncomplicated one.

Noting this does not occur on all of my systems, just an older 10th gen i9 with an NVidia RTX 2070 Super and a Logitech Brio as the source camera. Logitune is installed, that enough can be problematic given how it crashes on shutdown and reboot. Nothing in the crashes folder, profiler has mostly timing data from what I can tell. The version is 30.0.2, nothing looks unusual. The only thing I did differently on this fresh install was I used the Windows Store to install the app rather than the installer OBS downloaded last time for its update.

I consider the script a workaround until the issue is resolved, for my case I'll just dismiss normally rather than try to mask the issue. I don't know if it was a new feature added recently for the unclean shutdown detection or why it leaves the file behind when there's 1 memory leak and not when there's 0 or 2 memory leaks.
 
[Not a Happy New Year 2025]
Almost a Year since last person posted on this Subject. Tolerated this Program Malfunctioning for Over a Year Now. Crashes during Update, Then Says it didn't shutdown properly. Even Reinstalled the whole program 3 times over year...this recent time, Fresh Brand New Year, I Close to Restart the Computer before Login into Twitch....brand new launch............Once Again, Same Error Popped Up on Brand New Install with Latest Download.

Not Looking put strings or do any code........do You need a Monthly Fee to Continue Upkeep? Sounds like time We Pay for Premium Service, though, got work with Us Not having to Worry or become programmer to fix it. [Not Many People can just buy 12th GEN+ with RTX3060, just pass whatever restrictions & recommendations]

Therefore, Soon a Further Ghost Town Internet, cause as long Bitcoin Miners are buying up RTX3060+, keep price outrageously high, to barely break even anymore at $100,000BTC mining, hardly anyone can upgrade, while our Light Bills exceed $600+ in City. I'll work on when buying lower prices on that RTX3060+ with Windows 11 with 12th GEN+? or will I be Out Dated by End of The Year??? Literally sitting here Mad about RTX2060 Not Enough of Enough with Xeon Processor Workstation, What Most of You Programmers work on to Make Us these Software Apps, don't work Flawless.

Asking for a Solid Year Working, with zero issues, Can it be Your New Year Resolution, OBS Studios??
 
Top