you will need MPV and Pipewire for this to work.
this has 44khz -> 48khz conversion by default since linux these days defaults to 48khz
I wrote this with the assistance of chatgpt 4o to try and get a nice easy way to pull some royalty free stream music into OBS
it defaults to a famous lofi study beats stream, but it also saves settings when changed.
starting it creates pipewire devices and starts up the stream
changing url will kill mpv and restart it, audio devices will stay instantiated
stopping it is curtains for everything, if you do this mid stream you will lose the audio devices and then the real fun starts.
the potential is here for "Youtube BGM stream as a system service", something about this is amusing.
Pipewire is p awesome, so's MPV. ffmpeg is an audio hobo in this realm, I tried, I could not get it to work.