squeezelite not working anymore as background process with LE 10

  • Hey,

    On Libreelec 9.2 I used to start squeezelite (Logitech Media Server Client) via autostart.sh.

    Now on Libreelec 10 (I did a clean install, no update) on my Raspberry Pi 4 it is not working anymore.

    I have the following in my autostart.sh:

    (sleep 10

    ~/downloads/squeezelite/squeezelite -n Wohnzimmer -a 80:4::1: -C 1 default:CARD=vc4hdmi0

    )&

    When I start squeezelite via SSH and the command ~/downloads/squeezelite/squeezelite -n Wohnzimmer -a 80:4::1: -C 1 default:CARD=vc4hdmi0

    it works fine.

    With (...)& like in the autostart.sh to run squeezelite in background i manually tried the following command:

    (~/downloads/squeezelite/squeezelite -n Wohnzimmer -a 80:4::1: -C 1 default:CARD=vc4hdmi0)&

    This gives me the error below:

    [11:25:28.862998] test_open:281 playback open error: Device or resource busy

    [11:25:28.863237] output_init_common:401 unable to open output device: default:CARD=vc4hdmi0

    So the background command (...)& does not seem to work like before anymore with LE 10.

    Has anyone an idea what I should change to get it working again?


    Thanks a lot

  • This gives me the error below:

    [11:25:28.862998] test_open:281 playback open error: Device or resource busy

    [11:25:28.863237] output_init_common:401 unable to open output device: default:CARD=vc4hdmi0

    This error is expected - kodi is already using the HDMI audio device.

    You have to decide who should get access to HDMI audio output, either kodi or squeezelite, shared access from multiple programs is not supported (you could configure pulseaudio to allow shared access that but that'll be a bit tricky).

    so long,

    Hias

  • Thanks for your quick response Hias.

    Ok, the HDMI audio device is blocked. That is also what the error says. But I still have these 2 questions:

    Why does squeezelite gets acces to HDMI output and works fine when I start it manually without (...)&. Is it just because of the reason that is not a background process? If yes, why did squeezelite worked as a background process with libreelec 9.2. There I had squeezelite running and also Kodi audio at the same time over HDMI. Worked perfectly without configuring pulse audio. Just the normal HDMI output was used.

  • My guess is manual starting worked by coincidence - kodi closes the audio device after 1 minute of inactivity, so if you started squeezelite after that it will succeed (but ofc then kodi will fail when it next tries to use the device).

    On LE9.2 hdmi audio output was under firmware control and could mix kodi's audio output and alsa audio output (both ended up in VC4 firmware).

    Now hdmi audio output is under Linux control and the audio device doesn't support mixing multiple streams - you have to use pulseaudio do to that.

    so long,

    Hias

  • (sleep 10

    ~/downloads/squeezelite/squeezelite -n Wohnzimmer -a 80:4::1: -C 1 default:CARD=vc4hdmi0

    )&

    You need a longer sleep. Try 45s which works for me. You may need some trial and error to get the optimal time.

    Also, you need to turn off "Keep audio device alive" in Settings/System/Audio. Actually, Kodi does not turn it off right away. The audio device keeps on for about 10sec.

    The idea is to start squeezelite after Kodi releases the audio device, or squeezelite won't start. During Kodi start up, DO NOT touch remote or mouse. That will keep audio device alive longer.

    I see you use "-C 1". That's kinda short for me. I use "-C 10", same idea as Kodi releasing audio device.

  • I've got this working well on a RPi4 running LE11 nightly.

    /storage/.config/autostart.sh reads as

    Bash
    #!/bin/bash
    squeezelite -C 10 &

    Then to get audio output from squeezelite wait 5-10s after playing audio from kodi then turn on the squeezelite device.

    To get audio output back to kodi turn off the squeezelite device and wait 5-10s.

    You do need to follow that routine of turning the squeezelite device on/off in your main squeezebox remote/control page, but once that is sorted it all works remarkably well. Potentially better than when I was running the now unmaintained Squeezebox plugin.

  • Using my setup in #5, you don't even need to turn on/off your squeezelite. It turns on automatically when you start playing music. And after 10sec of squeezelite idle, Kodi's sound is back.

    My autostart.sh

    Code
    (
    sleep 45s
    squeezelite -a 65536:4::1:1 -b 20000:30000 -r 352800 -R v:1A:1:32:95.4:104.6:50 -n 'Kodi-Squeezelite' -C 10
    )&