# Command-line Exit



## chinagreenelvis (Jul 11, 2017)

Does OBS have a command-line exit parameter? If not, I would find one extremely helpful.


----------



## Fenrir (Jul 11, 2017)

Can you explain your use case here? Your request doesn't really make sense.


----------



## chinagreenelvis (Jul 11, 2017)

An exit routine for command-line usage. For instance, you can run the program using a command prompt, but you can't close it that way unless you use something like _taskkill_.

For example: 

> _obs64.exe -exit
_
If you force the application to close using _taskkill _(or AutoHotKey's _program, exit_), it will cause the system tray icon for OBS to hang in limbo until you do something like hover over it with the mouse.


----------



## Fenrir (Jul 11, 2017)

Since OBS allows for multiple instances to be launched, I'm not sure something like this is a good idea. You can just turn off the task tray icon if it bothers you, though.


----------



## chinagreenelvis (Jul 11, 2017)

I'm sure each instance must have an identifier; if no identifier is specified, then the logical thing to do is pass the _-exit_ parameter to the currently running instance and close the second as well. _-exit all_ would be useful as well.

I prefer to have the program running in the system tray rather than the taskbar.

Also, there is no "minimize to taskbar" on startup option, so I'd have to automate this in AHK, creating yet another timer that waits for the OBS window to appear.


----------



## Fenrir (Jul 12, 2017)

Unfortunately, your use case seems far to specific. Please understand what when you request features to be added, we have to evaluate the value for the entire user base, and if it makes sense to add the feature (and the added support cost of that feature) for everyone. While something like this might seem "very simple" to add, often times it's not, and there's a ton of factors you have to take into account to avoid crashes and other instances were things could be corrupted when an exit is called. Is the stream active? Is there a window open? Settings dialog? Checkbox for confirmation? All these things add more code and more UI clutter that is just not necessary for an extremely minor inconvenience of having the icon in the task tray when the program is force-quit.


----------



## chinagreenelvis (Jul 12, 2017)

Well, what you describe is part of the problem as well. Force-quitting the application doesn't take any of that into account and never will. An internal exit routine could take additional steps such as ending the stream or recording first, and then shutting down. It isn't just about the tray icon.

For automation, it would be extremely useful.

I never claimed it would be or seems like it would be simple to add. I'm a programmer myself and I understand how much work goes into it. But _everything _is work when it comes to programming. If you don't feel the work to add more command-line options is worth it, then that's your choice. I'm just making the suggestion.


----------



## chinagreenelvis (Jul 12, 2017)

Alternatively, hotkey assignment for closing the program would be an adequate solution.


----------



## Barabba (May 7, 2020)

Any news here? I also need this, since OBS not good handling RTSP streams, which after some times appear out of sync from each other then I need to restart OBS before recording again. I would like to use Touch Portal to easly switch off and on, but using taskkill I can leave something, it's not a clean exit. 
I would use a process or command line to force it off without confermations, any way? Thanks


----------



## Barabba (May 17, 2020)

please introduce a soft exit from command line with skip all pompts, tanks


----------



## killianbc (Jan 21, 2021)

Any news? I am also interested in this feature


----------



## eburgwedel (Apr 15, 2021)

I would also be interested in having command line with skip all pompts. My use case is simple: I use OBS for Zoom calls and I'd like to create a shortcut to quit both Zoom and OBS without any prompts. I already start OBS with a command line attribute `--startvirtualcam`, so to exit without prompt would just be a perfect fit.


----------



## rmanaka (Apr 16, 2021)

I would also like a way to exit the application, even with a hotkey.  Also stopping the virtual camera(s) would just be icing on the cake!

In my case I am using Touch-Portal and I start OBS with a button but unless OBS is the current focus in Windows, I cannot exit OBS (Alt + F4 only works properly if OBS is the window in focus).


----------



## johnny_bravo (May 10, 2021)

Barabba said:


> Any news here? I also need this, since OBS not good handling RTSP streams, which after some times appear out of sync from each other then I need to restart OBS before recording again. I would like to use Touch Portal to easly switch off and on, but using taskkill I can leave something, it's not a clean exit.
> I would use a process or command line to force it off without confermations, any way? Thanks



Have you ever considered using gstreamer plugin to feed RTSP streams into OBS ? It is quite a steep learning curve but works fast and stable when all set up well. Did make my streaming life a lot relaxter ... ;-)


----------



## Barabba (May 29, 2021)

johnny_bravo said:


> Have you ever considered using gstreamer plugin to feed RTSP streams into OBS ? It is quite a steep learning curve but works fast and stable when all set up well. Did make my streaming life a lot relaxter ... ;-)


thanks for suggestions. I'm trying to figure out what gstreamer is, is it an alternative decoder to VLC? How and why it is useful to OBS? On the readme file nothing about that is explained..


----------



## johnny_bravo (May 31, 2021)

obs-gstreamer
					

An OBS Studio source plugin to feed GStreamer launch pipelines into OBS Studio.  This plugin has interesting use cases but may be difficult to understand and is clunky use if you are not familiar with GStreamer.  Experimental prebuilt 64 Bit...




					obsproject.com


----------



## Streamer1 (Jan 3, 2022)

This  isn't as remote a case as it may seem: I frequently use OBS studio for different things, often even without streaming, e.g. for greenscreen when using Teams for meetings, and I automate my use through Elgato Stream Deck, which is very efficient. However, once I'm done using OBS, leaving it running in the background doesn't just  leave the systray icon, it uses enough resources to keep the cooling fan running at an annoying noise level, so I'd like to shut OBS down while not in use. As it is now, I can only automate that through force killing the processes, which is messy at best.
I'm a programmer by trade, and a command-line parameter for a controlled shutdown is NOT an unreasonable request, nor is it hard to implement. As for what to do if there are streams running, there are several options: You could implement arguments for the user to indicate how to handle ongoing streams, or you could simply call the right-click->shutdown method from the system tray, as you have already implemented the requested shutdown routine there.


----------



## Fenrir (Jan 3, 2022)

That use case itself seems fine, but I still question the "easy to add" part. By all means though, feel free to submit a PR. This just isn't a high enough priority to divert the limited resources we have to develop. I'm sure a PR would be welcome, there's nothing really fundamentally wrong with the feature request itself (though as originally proposed here, the justification was pretty flakey).


----------



## norihiro (Mar 15, 2022)

I'd like to suggest this command.
taskkill.exe /F -IM obs64.exe


----------

