What is Icecast?It's your very own little internet radio stream.
For the PiFi Mini I didn't initially think of adding Icecast because the music is being played locally out of the attached speakers so it didn't make much sense to stream the output as well. However I've just started working on the next PiFi variation which will be an always on music server. The core features will still be present but this one will reside in the stereo cabinet, it will sacrifice wifi but gain a hard drive and digital output. This will eventually become my home audio server and itunes source library, more about that another time.
Installing Icecast2READ BEFORE CONTINUING:
The following assumes you've already followed my PiFi-Mini Tutorial Part 1 or you've installed mpd already on your own.
Either connect to your PiFi via ssh or connect it to a display along with a usb keyboard.
Ok let's get started, first we'll update our packages, then we'll install icecast2.
As it installs you'll be asked to configure icecast2.
When it asks you for the hostname just stick with the default of "localhost"
Next it'll ask you to specify passwords for source, admin, and relay. Enter whatever you want but make note of what you enter (fyi these are written to /etc/icecast2/icecast.xml).
Next we need to go back and edit our mpd.conf file, find the audio outputs section (remember ctrl+w in nano is search) and paste this in below your existing audio_output. Make sure to change the password to whatever you entered for Icecast Source earlier. Then save and exit the file (ctrl+x, press y, hit enter).
Restart mpd and icecast2
Check if the new audio output is enabled.
You should see something like this:
Output 1 (PiFi Mini Analog Output) is enabled
Output 2 (PiFi MPD Stream) is disabled
Enable output 2 (or if you have more whichever one icecast2 is)
Make sure mpd is playing something then browse to your PiFi's ip address on the network.
http://pifi_ip_address:8000 or you can try http://pifi-mini.local:8000
*Remember the .local address doesn't seem to work on Android and possibly other devices or configurations, if it doesn't work for you use the direct ip address method.
You should be presented with an Icecast2 Status page
Click on the M3U link, on a smartphone it should start playing it, on a computer it should open your default music program that's tied to m3u files and then start playing.
One thing to note is that this stream will not be in sync with the output of the pi's headphone or hdmi jack.
Also beware that icecast2 takes up a bunch of cpu time (~60%) so I suggest you only enable the icecast2 output stream when you plan to use it.
Credit where credit is due, I followed these instructions when setting mine up so thanks Steffan Muller for posting them.