Run OBS and start streaming automatically - AUDIO NOT CAPTURED

Reikidude

New Member
Hi at all,
I'm trying to autostart obs via cron, but i am not able to capture audio.
I've followed this discussion.

OBS starts but it is not able to detect the global audio settings.

If I run the same command via CLI manually, it works properly.

Can you help me?
Thanks
 

PaddyMac

New Member
What user is OBS running as when it's started by cron? If it's running as a different user than the one Pulseaudio or Pipewire (assuming that's what you're using) is running as, that could explain why it's not detecting audio properly.
 

Reikidude

New Member
Thank you for replying, The user is my default user that is in a wheel group.

I can manage Pulseaudio settings from Ubuntu settings or via CLI with 'alsamixer' command.


I've tried also to execute cron job from root user, but in that case video didn't work (should I use root user ?)
 

drelli

New Member
Same issue has been driving me mad all afternoon on Xubuntu 21.10 - from CLI everything is great but no sound when launched from a bash script triggered by crontab as it's launching with Desktop Audio stuck on "Device not connected or not available" instead of "Default"
 

drelli

New Member
*Apparently I was almost there, defining XDG_RUNTIME_DIR first fixed my issue after reviewing these threads:
XDG_RUNTIME_DIR=/run/user/user_id /usr/bin/obs --startrecording

 

Reikidude

New Member
Thank you it worked.

Code:
Crontab -e


MM HH * * * export DISPLAY=:1 && XDG_RUNTIME_DIR=/run/user/{USER_ID} obs --startrecording
 
Top