Launch Parameters in Linux / Raspberry Pi

P17L20

New Member
Hey so i want to use the launch parameter to achiev an automatic Stream start function + no popup savemode warning on start in my Raspberry Pi 5.
Obs software is in Autostart already so my goal is -> Power on Raspberry with Powerswitch -> Obs Starts up -> Stream Starts Automaticly -> Done for Today = Power Off Switch, and than on next day, no savemode warning on obs startup to repeat the workflow cycle.

Hope there is a way to make it work, i would appreciate some help thanks in advance!
 

P17L20

New Member
Solved it myself, but for everyone else maybe wondering about the same here was my solution

First to set obs in autostart on Raspberry:

Step 1 in Terminal create autostart cd
mkdir ~/.config/autostart

Step 2 in Terminal create autostart file
nano ~/.config/autostart/obs-studio.desktop

Step 3 paste following in the Editor (importent is the Exec Filepath + Launch Parameter)
[Desktop Entry]
Type=Application
Name=OBS Studio
Exec=/usr/bin/obs --startstreaming --disable-shutdown-check
Terminal=False

Step4 Save editor file and reboot.

Note you can add you own parameters in the Editor file "Exec=/usr/bin/obs --startstreaming --disable-shutdown-check" these 2 are just my function i wanted.
 

AaronD

Active Member
You might want to consider a graceful shutdown instead of just killing power. Yes, people like the idea of "just being done", and the early personal computers did actually work that way, but modern systems risk corruption and not being able to start again.

The Pi has been getting better about that, but I would never consider it fully solved. If you can, consider using a button on the GPIO header to tell OBS to close. Then when it finishes that, the system shuts down. Then the last thing the Pi does is kill its own power. You can do that last part with a GPIO overlay that is meant to control a UPS...which wouldn't be a bad thing to have either...except that you might have to *make* one that actually works that way. It's so tempting to cut corners and kill the battery, that pretty much all the commercial offerings do.

So:
  • GPIO overlay to control a UPS.
    • Essentially what this amounts to, is setting a specified pin "active" immediately when first receiving power, as one of the first things *before* the OS starts booting, and setting it "inactive" as the last thing after the OS is finished. You also have the choice of active-high or active-low, which depends on what the circuitry wants that you connect it to.
    • Make sure it actually does disconnect the battery, and doesn't run it all the way dead over several hours of the Pi just sitting there doing nothing but drawing power. That's what disqualifies all of the commercial offerings, and most batteries hate it, especially Lithium.
    • The power-on button, simply overrides the disconnection that the Pi calls for by default, even without power. (design the circuitry to make it work that way) The Pi receives power, and takes over holding itself on, via this GPIO pin and the circuitry that it controls.
  • Another GPIO pin to be a "soft shutdown" button. It could actually be a second contact in the same button if you like, or a single contact with a diode or two to keep it isolated, but it does have to be a second GPIO pin that is not connected to the UPS control.
  • Use the Advanced Scene Switcher plugin in OBS to run an external script, which itself looks at the soft-shutdown GPIO. If it's active, Adv. SS automates OBS's cleanup and shutdown.
  • When OBS finishes shutting down, shut down the system too. Since you already have a script to start OBS, this becomes (relatively) easy:
Bash:
#!/bin/bash

# runs on startup


obs --options...    # no & on the end, so the script waits for OBS to finish
shutdown now
 
Top