I got fed up with OBS always having the wrong /dev/videoX paths every time I start it. Not OBS's fault, but Linux's fault for never knowing where its webcams are connected.
So I wrote this small script to update the OBS scene configuration for me automatically.
It relies on your camera sources being named the same as your cameras (as reported by v4l2-ctl --list-devices
)
so it knows what device to map each scene to.
For example, if you have a camera named BRIO 4K Stream Edition
you should also name the source in OBS
as BRIO 4K Stream Edition
for it to match between them.
This does not modify the live file, instead it reads from a backup ".tpl" copy of the file. That way if there is a hiccup while generating the live file it won't trash the whole setup. But any changes you make to your scene will not be saved unless you then copy the "live" scene file back to the template version.