Use Raspberry Pi to stream to any device with SqueezePlug

28th May 2013 | 16:10

Use Raspberry Pi to stream to any device with SqueezePlug

Remote control your Pi to play and stream music and video files

Outside of education, the most popular use of a Raspberry Pi is to play multimedia. For starters, you can use it as a nifty little HTPC with the XBMC media centre. In this tutorial, we'll transform the Raspberry Pi into the ultimate media streaming box.

The puny little Raspberry Pi packs enough punch to stream multimedia content all over your house, and to any device. So you can hide it behind your Hi-Fi speakers, along with a USB drive, and control music playback via your Android phone. Or, you can use it to stream high definition video from a NAS to a tablet. Best of all, you can also use it to stream music from your Android phone to the Hi-Fi speakers, à la AirPlay.

Many of us already have a similar setup, perhaps using a NAS and a dedicated low-power machine in the living room. These living room machines have to be small, so they don't clutter up your living space; silent, so there's no noisy fan to spoil your movies; and cheap, because you've wasted all your money on a big plasma telly. The Raspberry Pi is all three.

Usually to set up such an environment you'd need an assortment of server software and ninja-level command-line skills. But thanks to the SqueezePlug project, which does all the grunt work, you can be up and running in a matter of minutes. Let's get started.

Download SqueezePlug

Step 1

Begin by downloading the latest version of the SqueezePlug image for the Raspberry Pi.

Once downloaded, you can check its consistency by verifying its MD5 checksum on Windows with the WinMD5Free tool. The image is distributed in a ZIP file, so you'll have to extract it before transferring it to the SD card.

Note that since the extracted image is almost 4GB, you'll need an SD card that's at least 8GB. The developer also recommends a Class 6 or higher card. The class number represents the speed of the card - the higher the value, the faster the card.

To write the SqueezePlug image file in Windows, grab USB Image Tool. You don't have to install the tool, just download the ZIP file and extract its contents. Now right-click on the USB Image Tool.exe file and select Run as Administrator in the context menu. The app will list your card in the left pane.

Make sure the tool is in Device mode by selecting it from the pull-down menu in the top-left. To write the image to the card, click the Restore button and navigate to SqueezePlug's .img file. The process may take some time, depending on the speed of the card.

If you are using Linux, you can use the venerable dd command to write the SqueezePlug image to the SD card. Most distros will automatically mount the card when you connect it. You can find where the card is connected using the mount command. Assuming your card is mounted at /dev/sdc1, unmount the card before writing the image:

$ sudo umount /dev/sdc1
$ sudo dd bs=4M if=SqueezePlug_HF_602.img of=/dev/sdc

Accessing SqueezePlug using the first method is straightforward. If you are using the second method, you'll need an SSH client to access SqueezePlug. All Linux distros ship with the ssh utility to create an SSH session. On Windows, you'll need a client, such as PuTTY.

Stream media

Step 2

Power up the RPi, wait for a minute and go to your router's administration page to find out the IP address it has assigned to the machine. If you are using PuTTY, launch the app and enter this address in theHost Name field. On Linux, fire up a terminal and enter sudo ssh root@ assuming that's the IP address assigned to the RPi.

Log in to SqueezePlug's root user with the password nosoup4u. SqueezePlug will check for any available updates. Once it's done, it'll ask whether you'd like to expand your filesystem to take over the SD card. Although you can skip this for the moment, it's highly recommended you do it before you install additional servers. It's an automated two-step process, and all it requires from you is permission to restart the RPi.

Install the server and player

Step 3

You probably have your music and videos on an external USB drive. Although the RPi does have USB ports, it's advisable you connect any USB devices via a powered USB hub to avoid putting strain on the RPi's power supply.

But don't connect the USB device until prompted. To point SqueezePlug to your media library, launch its configuration panel by typing setup at the prompt and select the Media_Handling option. All media servers in SqueezePlug are configured to access files under the /mnt directory, which is where it will mount your media library. You'll now be shown a list of locations where your files reside.

Select the USB option and then choose any of the two mount points listed, such as /mnt/hd1 or /mnt/hd2. You'll now be prompted to connect the USB device. SqueezePlug will then show details about the last connected device, such as its device ID and filesystem. When you're satisfied that this is the device you have just plugged in, SqueezePlug will mount the device under the mount point you specified earlier.

You can now head back to the terminal and type mount to verify that the library has been mounted. You can also cd into the mount point and browse its contents with the ls command, which should display all your media files. If you reboot or shut down the RPi, make sure the USB device is plugged in before you power it up again.

Although LMS is primarily designed for streaming to Logitech's Squeezebox range of audio players, the server can stream to other software media players as well. The server also has plugins, using which you can stream podcasts and live radio from stations such as Absolute Radio UK and BBC.

To install the server, head to the Server_and_Player section in SqueezePlug's administration console, and then select the Server option. This will bring up a list of all the media streaming servers supported by SqueezePlug. When you select the first server on the list (LMS), you'll be given the option to either Install or Uninstall the server. When you choose to install the server, you'll be shown its licence.

Step 4

The LMS installation script that ships with SqueezePlug will install a tested version of the server (v7.7.2 in our case). If you want to install a particular version, you can enter the complete URL to the .deb file of that version in the space provided. But most users should just press Enter to install the default version.

The script will now automatically download and install LMS. When it's done, it'll show a message pointing you to the server's web administration interface. By default, this admin interface runs at port 9000. So if your RPi's address is, then the LMS web administration panel is at

Now launch a browser on any computer in your network and navigate to LMS's admin console. On first login, you'll be taken through a wizard. You can skip the first step if you don't have a account.

The next step is to point LMS to your music folder, which is where you have mounted the USB, such as /mnt/hd1. Similarly, the next step is to point to a playlist folder, which can again be the mount point of the USB drive.

Finally, after reviewing your settings, click the Finish button. You'll now be taken to LMS's main interface, which might take some time to load as it scans your music library.

The two-pane LMS admin interface is pretty straightforward to navigate. In the left pane, you can browse through your library, which LMS has already sorted into categories such as Artists, Genres and Years, based on the metadata of the files. When you hover over a track or an album, you get options to play the track, or to add it to the current playlist, which is displayed on the right pane.

At the bottom of this pane, you get a button to create a playlist of your own, with all the tracks in the current playlist. The good thing about LMS is that it lets you create playlists that can have local media as well as internet radio and podcasts.

At the bottom of the interface, you have the Settings button, which will help you customise LMS by enabling or disabling plugins, adding additional media libraries, changing the theme of the web interface and more. At this moment, the LMS streaming server is all set up to stream music. But unless you have a Logitech SqueezeBox Wi-Fi player, like Boom or Touch, this setup doesn't have players to stream music to.

However, LMS can stream to software players as well. So we'll install one on SqueezePlug. This will allow us to play music on speakers attached to the RPi, either via the audio-in, HDMI, or USB.

Like with streaming servers, SqueezePlug has a bunch of players, as well, that will play music streams from LMS. We'll use the SqueezeSlave player, which is a headless player for playing LMS streams. But first we need to plug in the speakers and make sure they can play audio.

Connect your speakers to the RPi and head to SqueezePlug's admin interface. Now go to Server_ and_Player > Player > AudioSettings. Here, you'll see options to select the audio device your speakers are connected to and play test sounds through them. Head to Select_Sound_Output, and select the Auto option to let SqueezePlug figure out whether you've connected your speakers to the audio-out or HDMI port.

Back at the AudioSettings screen, play test sounds using the Test_ Sound_1 and Test_Sound_2 options to make sure SqueezePlug can pass sound to the connected speakers. Now return to the Player menu and select the SqueezeSlave option to install the player. Besides the option to install, you'll also get options to update and uninstall the player.

Step 5

Like with LMS, the SqueezeSlave player will be downloaded from the internet and installed automatically. It will detect the LMS server running on the network and confirm by displaying its IP address. It will also let you select the sound card to which you've connected the speakers. So if you've connected to the audio-out on the RPi, select the RPI_ internal option.

After the player has been installed, head to LMS's web interface. In the top right-corner, you'll notice a pull-down list. This lists all the players LMS can stream to. It'll now list the Squeezeslave player as well. Now, when you play a track it'll stream to the speakers attached to the RPi. But accessing the LMS web interface whenever you wish to change tracks is tedious.

Instead, grab an Android phone or tablet, head to the Google Play Store and download an app, such as Logitech Squeezebox Controller or Squeezer, to control the streaming server. The app will automatically detect and connect to the streaming server and give you full control over playback. That's it!

Your audio streaming server is all set up. You can now close the SSH session or disconnect the monitor from the RPi and tuck it behind the Hi-Fi speakers, along with the USB drive. Whenever you wish to play music, just grab your phone, fire up the remote control app, browse your music collection and hit Play.

Stream more widely

Step 6

As you might have noticed when installing LMS, SqueezePlug has a bunch of other streaming servers as well, such as MiniDLNA and Media Tomb. Media Tomb is a UPnP (Universal Plug and Play) media server, that can stream content to UPnP-compatible devices, including desktop players like VLC, Android handsets, and even the PlayStation 3.

MiniDLNA is a lightweight alternative to MediaTomb, but doesn't have a web interface and must be configured by editing a text file, which is why we'll stick with Media Tomb.

To install Media Tomb, log in to SqueezePlug and head to its setup screen. Then navigate to Server_and_Player > Server > Media_Tomb. You'll get the familiar options to install and uninstall the server. Selecting the Install option will fetch the server from the internet; and just like LMS, you'll get a confirmation address that'll display the IP address of its administration screen (which runs at port 49152), along with the default username and password to log in.

Before you can serve files via Media Tomb, you need to point it to your media library. Head to its web interface and log in with the default login credentials. In the left column, select Filesystem and navigate to the directory containing the media you want to share (/mnt/hd1 in our case). Your media files will be shown on the right.

Click the + sign to the right of the media file or directory. This will share the directory using the default settings. The sign next to it will also share the file/ directory, but will give you additional options such as to automatically scan the library after a fixed interval. You can view your shared media by selecting Database in the left column.

Launch MediaTomb and VLC

Step 7

After installing Media Tomb and adding media to it, you are essentially done. Any UPnP-compatible media player on any device on the same network as the Media Tomb server will now automatically discover the server.

Unfortunately, the state of UPnP media players on Linux is pretty disappointing. The default media players on Gnome and KDE can't stream from UPnP media servers. KDE's Amarok music player does have a plugin that allows it to see UPnP media servers, but it sometimes can't tune in to our UPnP server.

The one desktop media player that has no trouble streaming from Media Tomb is VLC. Best of all, it's cross-platform so you can use it to access your media library from Windows, Mac OS X, Linux and other operating systems.

To play a Media Tomb stream, launch VLC and bring up the Playlist view, either with the Ctrl+L key combination or by going to View > Playlist. In the left pane, expand Local Network and click on Universal Plug 'n' Play. This will bring up a list of media servers VLC has discovered in your network.

The server titled MediaTomb is the one that you've just set up on the RPi. You can expand it and browse your media library. When you find the file you want to play, double-click on it. After a few seconds, VLC will start streaming it to your local computer.

Step 8

Similarly, if you want to play UPnP streams on an Android phone or tablet, you'll find several apps in the Google Play store that'll do the trick for you. We recommend the BubbleUPnP app. The full version cost £3.04 at the time of writing, and has an ad-supported free version with usable restrictions.

Remember, however, that BubbleUPnP will not play any media. For that, it relies on an external media player such as MX Player, MoboPlayer or DicePlayer. So make sure you have one installed on your phone/tablet.

When you launch BubbleUPnP for the first time, it'll ask you to set up internet streaming to stream media to any device over the internet. You can skip this for now because it isn't necessary for streaming content on the local network.

When BubbleUPnP is running, switch to the Devices tab, which will list renderers and libraries. Here, make sure the library points to MediaTomb, which is our streaming server. Then switch to the Library tab, which will list our media library organised automatically in folders such as Albums, Recently Played, etc. Tap an audio or video file to play it via the external media player.

Now wouldn't it be really cool if you could stream music from your mobile phone or tablet and play it on the Hi-Fi speakers connected to the RPi? If you've been following the tutorial step by step, you already have everything set up. All you need is a UPnP player on the SqueezePlug, such as SqueezeSlave, which we installed in step 5, and the BubbleUPnP app on the Android handset to stream the music.

If you have this software in place, just fire up BubbleUPnP and go to the Devices tab. Here, change the renderers to Squeezeslave and the libraries to Local Media Server. Now, switch to Library tab and pick an audio track from your phone you'd like to stream, and it'll start playing on the speakers attached to the RPi, just like AirPlay! Shairport streaming.

Talking of AirPlay, if you have an iOS device, you can in fact stream to the RPi speakers just like you would to an AirPlay speaker. But for this you need to install one additional piece of software on the SqueezePlug, called ShairPort, which can receive and play AirPlay streams.

To install ShairPort, log in to SqueezePlug's Setup menu and go to Server_and_Player > Player > ShairPort. Again, like all things SqueezePlug, the software will be automatically downloaded and installed. All you'll be prompted for is a name to identify the ShairPort player to the iOS device (the default is AirPi).

Once it's installed, grab an iOS device, launch any music app and tap the AirPlay button. You will see the name you specified for the ShairPort device. Tap that, and the music will stream to the remote speakers!

If you've followed the tutorial, you'll have an awesome streaming setup that not only streams your media all over the house and to any device, but can also play music from any Android and Apple device. And you've accomplished all this with open source software at a fraction of the cost of a similar setup using proprietary Sonos or AirPlay hardware. Now that's some serious bragging rights, right there!

tutorial streaming Raspberry Pi media streamers home networking features TRBC TRBCFeature
Share this Article

Apps you might like:

Most Popular

Edition: UK
TopView classic version