# [Request] Terminate streaming from the command line



## David White (Jan 14, 2018)

Currently it is easy to automate starting a live stream with the --startstreaming command-line option.  However there is no easy way to automate stopping a live stream.

Ideally, there would be an "obs64 --stopstream" CLI option that would cause OBS to find the currently-running obs64.exe project and terminate its stream (rather than launching a new obs64 instance, of course).  There is currently no such option.


In Windows, one might try running "*taskkill /IM obs64.exe*".  However, since this only sends a "soft" terminate request, the only result is that OBS pops up an "OBS is currently active... are you sure you want to shut down?" box.  Repeated calls to "taskkill" cannot get past this box.

Note that the Settings -> General option "_Show confirmation dialog when stopping streams_" does *not* affect this issue.  Even when the box is unchecked, the "Are you sure?" dialog box will still be shown if the user attempts to exit OBS while a stream is running.


Due to this (again in Windows), one might be tempted to try "*taskkill /F /IM obs64.exe*" to forceably kill OBS.  While this works, it has the unfortunate side effect of preventing OBS from releasing its lock on the video capture card (if that is the stream source).  Therefore if one launches OBS a second time, it will be unable to acquire the capture card and begin streaming again until the PC is rebooted.


Therefore the only solution we've gotten to work is a rather clunky, not-always-reliable AutoHotKey script that pushes the right buttons and clicks the right dialog box buttons (if it works like it it's supposed to, and if nobody is actually using the PC when it runs.)
Requested solutions:

Add a --stopstreaming option to the CLI.  (This is how Adobe Flash Media Live Encoder works, which makes it easy to create Windows Scheduled Tasks that call FMLECmd.exe to both start and stop streams)


Add an option to disable the "OBS is currently active... are you sure you want to shut down?" as a Settings -> General option.  (Possibly this setting should simply be rolled into "_Show confirmation dialog when stopping streams_")  Alternatively, add a checkbox to the "Are you sure?" dialog box labeled "Do not ask about this again".  
This will be of great help to us, since we setup automated broadcasts that start/stop on a regular schedule.  Thank you!


----------



## akumenon (Apr 25, 2018)

God yes I need this. I use OBS Studio not just for recording and streaming (rarely), but as a replacement for NVIDIA Shadowplay, so I have OBS run on startup with the --startreplaybuffer argument but I have to either manually close it or use taskkill or it'll prevent shutdown. I would definitely like if OBS shut down cleanly on its own without user intervention (ideally as an option). I think both of your solutions are reasonable and imo, are worth implementing.


----------



## hsylcate (Jul 3, 2018)

Yes, I really wish there were a --stopstreaming/--stoprecording to math the --startstreaming/--startrecording options.


----------



## sierra_alpha (Aug 22, 2018)

Agreed--this would be absolutely terrific to have! In general it does seem odd to have a "start" function without a "stop". The ability to stop a stream/recording via command-line would significantly complement the existing functionality that comes from having the --startrecording --startstreaming arguments. Providing a --stopstreaming/recording argument would allow the stop action to be based on an *event*--not just simply a _timer_.

Perfects examples and use cases for this would be:
- UPS detect power-failure / on-battery
- System ACPI shutdown signal received (i.e., my cat brushed up against the PC and pressed the power button again. True story.)
- User activity idle for X minutes. (Windows Task Scheduler or AHK, for example.)
 - Any other situation in which a timer by-itself is not an adequate means of controlling OBS streams & recordings.


----------

