As of OpenElec version 5.0.X Kodi it appears .mp3 playback with Squeezelite is now broken due to missing libraries required for mp3 playback. I can still play .flac .wma and .m4a audio files OK however. There is a thread here on the OpenElec forum where they are discussing this issue and possible work a-rounds. As yet I have not fixed mp3 playback on my own system and am still looking in to it.
I seem to have mp3 playback working again, you can see how I did this here. Basically you need to update SqueezeLite to a later version it seems. I have updated the article below with the new download links and information!
I have re-tested the SqueezeLite player playback with the following types of audio files and I was able to play them all OK.
.mp3 .wma .flac .m4a (AAC) .ogg
END OF UPDATE
Its taken me along time to work out how to do this and I finally have it setup and working today! So I thought I would write about it here on my blog, so I don’t forget how I did it.
Basically I wanted to run SqueezeLite as a background service on OpenElec and for SqueezeLite and XBMC to use / share the same HDMI audio output device. Not too much to ask for you would think and this is a ten minute setup in Windows however in Linux its taken me much longer to figure it all out.
Note: I have only tested this on OpenElec Frodo V12.2 and not on Gotham, as I haven’t upgraded to Gotham yet. If you try this and it works on Gotham please let me know. (See the update at the end of this post).
Some background, my HTPC is connected to my Denon AVR amplifier via the HDMI cable. I have a 5.1 speaker setup on the AVR in my living room. SqueezeLite if you don’t know is a Squeezebox software emulator, like SqueezeSlave and SqueezePlay etc. SqueezeLite is still being actively developed and is the one you should be using. The reason I wanted SqueezeLite to run as a background service on the OpenElec HTPC, was because I also have a Squeezebox in my kitchen connected to a pair of stereo speakers mounted above my kitchen cabinets. And I wanted to be able to play the same music in the living room in sync with the kitchen room. As the Logitech Media Server software supports playing zones in sync this is ideal.
1. Download SqueezeLite
EDIT: There is a new download page for SqueezeLite for Linux which is here. I wasn’t totally sure which one to download for my Intel based HTPC so I picked this one “squeezelite-1.8-ubuntu-lts-x86_64”
2. Install SqueezeLite
The download contained just one file called squeezelite-x86-64 with no file extension, being a Linux newbie at first I had no idea what to then do with this file? You need to create a new directory on your OpenELec PC and copy the squeezelite-x86-64 file in to that new directory. I used this path: /storage/.xbmc/userdata/squeezelite
EDIT: The file downloaded from the new download page was called squeezelite-1.8-ubuntu-lts-x86_64.tar.gz I extracted this file on my Windows 7 workstation using Winrar, I then ended up with two files one called License.txt and one called just squeezelite with no file extension. You need to create a new directory on your OpenELec PC and copy the squeezelite file in to that new directory. I used this path: /storage/.xbmc/userdata/squeezelite
I used FileZilla FTP client to connect to my OpenElec PC and copied the squeezelite-x86-64 squeezelite file in to my new /storage/.xbmc/userdata/squeezelite folder, or you can just use Windows Explorer and enter \\IPADDRESSOFOPENELECPC to access the Samba shares.
Next you need to access the Terminal in OpenElec, to do this I use Putty for Windows on my laptop and can then connect to Terminal on my OpenElec PC. You need to select the SSH connection on port 22, enter the IP address of your OpenElec PC and use the default username: root and the default password is: openelec
We need to be able to access terminal in order to make the squeezelite-x86-64 squeezelite file executable. The terminal window looks like this.
Now navigate to the new squeezelite folder we created, enter the command shown below and press enter
The screen should then look like this one
Now we need to use this command: chmod +x squeezelite to make that file executable. So go ahead and enter that command and then press enter
3. Picking the correct Audio Output Device
OK now we need to think about which audio output device we would like SqueezeLite to run on? As I already stated due to my setup I wanted SqueezeLite to run on the HDMI port. However you may want it to run on the 3.5 analogue port or the digital SP/DIF port? depending on your setup and requirements.
Whilst still in Terminal we can list all the audio output devices on the system, to do this use the aplay –l command
I am using an Intel DH67CF Mini ITX media mother board in my HTPC and in the screen shot above you can see what audio output devices I have listed.
** In fact you might be better running this command instead: /storage/.xbmc/userdata/squeezelite/squeezelite –l
SqueezeLite then lists the audio output devices it finds on the system as shown in the screen shot below. If you cannot read it, click here for a larger image.
The device from the above list that I need to use is this one: hdmi:CARD=PCH,DEV=1 keep that in mind for later on…
4. Review the max sample rate
Now that we know which audio output device we want to use with SqueezeLite, we need to know what is the maximum sample rate? Connect back up to Terminal using Putty and issue this command:
/storage/.xbmc/userdata/squeezelite/squeezelite -d output=debug
Click here for a larger screen shot of the debug output
There is a line that says: output_init_common:394 supported rates: and lists the rates, find the largest number in that list? Mine was 384000
Press Ctrl+C to exit this command
5. Construct the SqueezeLite run command
Ok armed with all of the above information we can now start to construct our command to run SqueezeLite. This is the command I used:
/storage/.xbmc/userdata/squeezelite/squeezelite -o hdmi:CARD=PCH,DEV=1 -m 00:00:00:00:00:fe -r 384000
-o specifies the audio output device I want to use, in my case it was: hdmi:CARD=PCH,DEV=1
-m specifies the mac address the SqueezeLite player will use, I believe it can be the real mac address of the NIC on the PC or you can just make one up as I did, as long as each SqueezeLite instance you have running on your LAN has an individual mac address you should be OK.
-r specifies the maximum sample rate and also importantly enables audio output device to be off when squeezelite is started
One you have constructed your SqueezeLite command, you can test it by running the command in Terminal. Does it work? Do you have a new Squeezebox showing up in the LMS webpage? and can you play / hear an album when selecting that Squeezebox?
Tip: You can rename the new SqueezeLite player to a name of your choice like “XBMC01 – Living Room” in the LMS webpage – settings – player tab – player name
This is the LMS (Logitech Media Server) webpage
Here in the drop down list you can see my new SqueezeLite player aka “XBMC01 – Living Room”
6. Autostart SqueezeLite on boot up
OK so our command to run SqueezeLite is working we now need to be able to start SqueezeLite every time you turn on your OpenElec HTPC. To do this I used the OpenElec autostart.sh config file. If you haven’t got one already you need to follow this Wiki page here to create one.
EDIT: The OpenElec autostart.sh wiki page contents have changed, it use to tell you how to go about creating your autostart.sh file and now it does not. So this is how to do it:
Using Putty terminal in to your OpenElec PC.
Type these commands one at a time:
chmod +x autostart.sh
You will then see a screen like this one:
In the autostart.sh config file add in the below code to automatically start your SqueezeLite player. Obviously change the SqueezeLite command to the one that you constructed suitable for your system.
# Start SqueezeLite on the HDMI audio output device
(sleep 20; \
exec /storage/.xbmc/userdata/squeezelite/squeezelite -o hdmi:CARD=PCH,DEV=1 -m 00:00:00:00:00:fe -r 384000
You can copy the code text above, then in putty just right click your mouse and the code will appear and then look like this:
Now press Ctrl + X on the keyboard to save and exit the nano editor. Select Y to save and then press Enter when you see: File Name To Write: Autostart.sh
You will then be taken back to the normal terminal command prompt. Now type “reboot” without the quotes and press Enter on your keyboard to reboot your OpenElec PC.
The SqueezeLite instance should now be auto started each time you boot up your OpenElec PC.
Restoring sound back to XBMC
In this setup where XBMC and SqueezeLite share the same audio output device, you need to turn off the SqueezeLite player once you have finished using it, so XBMC will get its sound back. To do this just use the soft ON / OFF button on the LMS webpage or in your Squeezebox mobile remote control app etc.
Once the SqueezeLite has been soft powered off, the audio will return to XBMC.
I’ve been wanting to do this since I switched to XBMC and Linux over a year ago and have tried now and again to get it working without much luck. However eventually I was able to piece everything together from various forum posts and figure out how to get it working.
The other Squeezebox in my Kitchen is actually SqueezeLite running on my Windows Home Server, so I don’t actually have any hardware Squeezeboxes. I know syncing software Squeezeboxes is never as good as with hardware Squeezeboxes, however my experience of syncing these two rooms together using SqueezeLite has been very good so far, much better than when I was using SqueezeSlave in the past with Windows MCE.
Now I need to setup SqueezeLite on the OpenElec PC’s in our bedroom and in the kids bedrooms.
I’ve tried this on OpenElec 4.0.4 Gotham now, it works OK but I felt the need to change a setting which was in the XBMC Settings – System – Audio – Keep Audio Device Alive – OFF
Changing this setting to off then allows the SqueezeLite player to use the audio device quicker when you start playing an album in LMS. However on my HTPC connected to my AVR turning this setting off did seem to then have some side affects on the navigational sounds you hear in XBMC when moving around the UI.
When you have finished playing your album in LMS and when you soft power off the SqueezeLite player it can take a little while for the audio to then be restored back to XBMC.
In Frodo it all seems to work a bit better and a bit faster, it still works well in Gotham, if you are aware of these slight niggles.
Until I figure out how to simultaneously at the same time allow XBMC and SqueezeLite to share the same HDMI audio device this is as good as its going to get.