Command-line Exit

chinagreenelvis

New Member
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

Forum Admin
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

New Member
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

Forum Admin
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

New Member
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.
 

Barabba

Member
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
 

eburgwedel

New Member
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

New Member
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).
 
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

Member
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..
 
 

Streamer1

New Member
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

Forum Admin
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).
 

rvangaal

New Member
It does seem like an easy feature to support; just exit at the earliest idle convenience, much like responding to the close button. As an alternative I am (also for automation):
- starting OBS Studio using ShellExecuteEx()
- grab the process handle through SHELLEXECUTEINFO.hProcess
- get the process ID through GetProcessId(hProcess)
- upon exit time, call EnumWindows() and filters out window for that process ID
- when found, do a SendMessage(hwnd, WM_CLOSE, 0, 0)
 
Top