Home > Audio/Video, General > Configuring Raspberry Pi as a HTPC/Music Source

Configuring Raspberry Pi as a HTPC/Music Source

This post is a continuation from by previous post My Audio Video Setup. This post describes how to configure Raspberry Pi (A credit card sized ARM based board/miniPC) for HTPC and music usage.

Disclaimer: Whatever info I have put here is based on numerous webpages/forums which I referred  for setting it up. So all the credits go to them(www.forum.xbmc.org, http://www.audiohobby.com http://www.lifehacker.com, http://www.raspberrypi.org, http://www.xbian.org etc are the major sites which helped me).

As a prelude, would like to say that I am extremely happy to have bought raspberry pi and I dont regret it as for my purpose its more than enough. Quoting from the user vertigo in the xbmc forums one of the post which clearly explains the pros and cons of it, than me trying to rephrase it

I see a lot of people have trouble assessing whether or not a Rasberry Pi is a viable platform to run XBMC on. Let me try to help and summarize what it can and cant do.

Contrary to what you sometimes read, the Pi can indeed decode 1080p30 high-profile (ie, bluray) stutter free. It will even do 3D. But there are some caveats you should be aware off:

– if your media uses VC1 or Mpeg2 as opposed to h.264, divx, etc, then you need to purchase a license to enable hardware accelerated decoding of these codecs. Prices are €1.45 and €2.89 respectively. http://www.raspberrypi.com/license-keys/

– the Pi is not always fast enough to decode DTS or Dolby Digital 5.1 (AC3) to stereo on the fly, but it has no problems passing through these codecs over HDMI to a DTS or AC3 decoder/receiver. If you have an HDMI receiver (or TV) that allows these audio codecs, you will be fine (the work is done by the AVR decoder). If you dont have that hardware, there isnt too much point in using a DTS track, so if possible, you should select a stereo or AAC track instead. Most DTS/AC3 media will have such an audio track. If your source only has DTS audio, and you dont have a DTS capable receiver, you may have a problem.

*update: I actually tested this with my own library. I dont have straight bluray rips, so the highest bitrate I saw was short bursts around ~30Mbps (h264 1080p23.9 + DTS), and my Pi had no problem playing it while decoding the DTS signal, at least when playing it back from a local drive. While playing the same file over the LAN, the Pi did stutter during the high bitrate peaks. One might think its a bandwith issue (100Mbit), but the Pi can serve the same files to my x86 machines, and they wont stutter. In short: it appears to be a problem when playing big files with DTS over the LAN. Local files from a USB drive seem to be fine, though it may not do full rips with DTS decoding, it may not work with some video formats, its widely reported the Pi struggles decoding DTS, but Ive not been able to reproduce this with local files. YMMV.

If you read somewhere that Pi will stutter playing back 1080p, its almost certainly because the user was unaware of one of the above restrictions. It has given the Pi a reputation it doesnt deserve IMHO. When used properly, 1080p playback is utterly smooth, and I would even say it looks better than on my x86 machine.

One more little known feature of the Pi that deserves highlighting, is its built-in HDMI CEC capability. Unlike any x86 videocard Im aware off, the Pi can send and receive HDMI CEC commands. This allow you to use the remote of another HDMI CEC compliant machine, like TV or AVR to control XBMC. On x86 you can achieve the same only buy purchasing a Pulse-Eight adapter kit. HDMI CEC is also known as Easylink, Vierra Link, BRAVIA Sync, Anynet+, etc.

That said, there are a few other aspects of the Pi that may steer you away from it:

– The Pi has no SPDIF out.
If you can not use HDMI audio, the only other option is analog stereo. As an alternative, you can buy a HDMI splitter that splits audio and video and gives you HDMI video and SPDIF audio (example: http://www.amazon.com/ViewHD-Premium-Aud…o+toslink) , but such a device will cost about the same as the Pi and be about as big. The combination is still rather cheap and small, but no longer as impressively so as the Pi alone.

– The Pi currently has no support for HD audio (TrueHD and DTS-HD/MA), even in passthrough. This is a software issue that might be resolved in the future, but for now, playing a DTS-HD stream will result in a DTS signal on your AVR, and playing TrueHD will probably yield nothing or noise.

– While its GPU and videodecode capabilities are respectable, the CPU of the Pi is slow.
There is no way to sugarcoat it. The CPU is an ARM11 based design, which puts it roughly in the performance ballpark of the iPhone 3G (not 3GS) or HTC Legend. In PC terms, roughly a Pentium 2 – 300 Mhz for those of you old enough to remember. This CPU is considerably slower than the better known ARM Cortex A8 cores found in Samsung Galaxy S1 or iPhone 3GS, and far slower than all the cheap Cortex A9 based android devices you can buy today. Oh and incomparable to even the slowest celeron on the market. You do notice this slowness. Not while playing video, but while using the XBMC GUI, its not quite as buttery smooth and responsive as x86 media centers. If you use simple skins like confluence or Quartz, IMO its completely acceptable, and far from frustrating; but dont expect miracles. If in doubt, I would advice you to watch some video’s on youtube and see if it lives up to your expectations. Here is one I just uploaded myself:

(note that the white screen corruption is mostly solved now)

– The network interface is 100T.
Even using USB to Ethernet adapters, you will still be limited to 100T. It wont do gigabit ethernet.

– It uses Linux
Yeah, it does, but that doesnt mean you have to know anything about Linux. Think of your (smart) tv or AV receiver; it probably runs on Linux too, but its not like you need to use a command line interface or edit text files in VI to use it Smile. Same with openelec. It turns your Pi (or x86 box for that matter), in to a real consumer appliance and almost completely hides the fact there is an OS underneath XBMC. But for those that do know Linux, there is still SSH thank God Smile

– Its not much good as a general purpose PC
XBMC linux distro’s are stripped down to the bone. You wont even find a browser. If you intend to use your HTPC for other tasks besides XBMC, like internet, social media, gaming, etc, you want to look elsewhere. Sure, you can dualboot openelec with some more general purpose linux distro for the Pi, but if you can figure that out and think thats an acceptable solution, then you are far more of a geek than me, and not likely to be reading anything in this post you didnt know already.

– The hardware is old, almost obsolete, why not buy a much faster android device?
In the near future, and for XBMC users, the Pi will almost certainly be obsoleted by far more capable hardware (typically designed for Android). Some of them already hardly cost more than the Pi today, while giving you goodies like dual core A9 chips and more adequate IO. Thing is, the Pi is (probably) fast enough, while having the advantage of being very popular among 1+ milion geeks for almost a year now, and as a result, it has a pretty mature software stack. Android devices arent there yet. Im sure they will eventually, so if the time comes to switch to Xios or some other Android device, at least know that thanks to its GPIO interface there are a million other uses for your Pi. Like serving as the brains of a home made pinball machine, a quadcopter, coffee machine, or whatever else you can come up with Smile.

If none of the above issues are show stoppers for you, the Pi will offer you a ridiculously small, cheap ($35-$50 if you count codecs, case, etc) , power efficient (~3,5W!) and surprisingly capable media center.

Original Thread link is http://forum.xbmc.org/showthread.php?tid=152339&highlight=raspberry+pi

Some people always ask, why do you want raspberry Pi/XBMC if you have a smart TV which can do most of the things. The quick answer to that is XbMC on raspberry pi can do much more things than a smartTV, some of which are

  • Scraper: XBMC has some built-in scrapers which can automatically search the contents of the media and autodownload information related to it from popula sites like IMDB etc. What it means if you select a movie, it will say a brief plot of the movie, its IMDB rating etc.
  • Subtitle download: Downloading subtitles for a movie is very easy in XBMC using the subtitle add on.
  • Automated torrent downloads: Using XBMC add-ons like couchpottato, sickbeard,headphones and transmission torrent client you can automate the process of movie/TVshows/Music downloads. [This is one of the biggest advantage]. In couchpotatto  you can mention what movies are you looking for and the quality of the movie file (HD,DVDRip,Blueray rip etc], couchpotatto will look into popular torrentsites/NZB sites for the movie of your choice and automatically download the movie using the transmission bittorrent client, the movie.

So much said about the Pi and XBMC. Now lets move to the OS which I want to load in the Pi. Following were the options for me

  • Xbian : Based on Raspbian and have a good support community. Currently in Beta.
  • OpenElec: Already successful in other platforms (x86) and gives an appliance feel to the XBMC.
  • Raspbmc: One of the first distro’s that came up when Pi was out. Only disadvantage is its not that stable compared to the others and only one single developer behind this,

I choose Xbian primarily based on the reviews as it was slightly faster than other distro’s.


  • Raspberry Pi
  • SD Card (I used a 16GB Class-10 Transcend Card)
  • USB DAC (Optional, you can use the onboard sound if you are ok with the sound quality)
  • An HDMI TV which supports HDMI CEC (Braviasync, LG Simplink, VierraConnect etc)
  • A laptop/Desktop PC with a SD Card reader
  • An android phone/tablet/ipad/iphone
  • External hard disk which has all the movies/music.
  • LAN Connectivity to Pi through a wireless router/any other means.

Installing Xbian

Since already the Xbian installation wiki is there I dont think I have to explain it here. Refer the below link for the Xbian Installation wiki.

  1. Installing Xbian
  2. Configuring Xbian

XBMC User guide

If you are new to xbmc refer the XBMC quick start Wiki.

Adding Media to the Xbian

Connect the External USB hard disk to one of the free USB ports in the Pi. Note that if you are having a hard disk of 1 TB/more capacity its recommended to connect it via  a powered USB hub as raspberry pi wont be able to give enough power to bring up the harddisk.

Notes: At the time of this writing, Xbian latest version was 1.1 beta and that somehow dont automatically show the USB hardisk in the XBMC menu. You have to go and manually add the folder from /media/. Hopefully this will be fixed in subsequent versions. For adding the folder in the XBMC (Refer http://wiki.xbmc.org/index.php?title=Quick_Start_Guide#Adding_videos_to_the_library )

Now enjoy the movie collection.

Custom Remote key mapping for LG TVs

Even though the HDMI CEC great for basic navigation and playback functionality, I noticed that there was no remote button for the right click/Conterxt menu in USB. This is a higly required one if you want to play lot of videos at once by adding it to play list or if you want to do some scrapper functionality(More of scrapper functionality can be found in the quick start guide). Xbmc uses a file called remote.xml which stores the keybindings for remotes and forunately I was able to get a keymap.xml file created for LG tv’s in one of the forums (I think its stmlabs forum). So thought of sharing the XML file here so that people having LG HDMI TV can make use of that. Currently as per the keymap file, the context menu is assigned to the fastforward button in the LG remote.Download the remote.xml and keep it in the folder ‘/home/xbian/.xbmc/userdata/keymaps/’

Get the remote.xml from this link

Some Commonly required shortcurts

To get XBMC ContextMenu Press the FastForward button when in Menu’s

To get the OSD (On screen Display) Press the FastForward button when playing a movie

To Fastforward  Video, Press the right Arrow Key (this will skip slowly)

To FastForward a video but want to skip more portions then Press the UP Arrow key.

Installing Couchpotato/Sickbeard/headphones Add-ons for Xbian

Before starting with the installation, I will briefly touchup what these tools will do

Courtesy: http://forum.xbmc.org/showthread.php?tid=120406

  • Sickbeard (For TV shows): This is a web application that automatically downloads your favourite/wanted TV shows as soon as it is available on torrent sites. As soon as a Show is aired, Sickbeard searches the torrent search sites and downloads the episodes which matches your desired video quality.
  • Couchpotato (For Movies):  This is almost the exact same type of service as Sickbeard, but this works with Movies. You put movies in your Wanted list and Couchpotato checks for releases in your desired quality and with the meta data, subs, trailers and so on, that you have asked for.
  • Headphones (For Music): This is yet another web application, but this one takes care of Music Artists and Albums. You scan your library or add new artists, and Headphones keeps a lookout for new albums of your favorite artists.
  • Transmission:  Its a light weight bit-torrent client.

There are two ways for installing

  1. Follow the steps in http://www.xbian.org/2013/01/a-one-in-all-download-package/
  2. Do it manually (Courtesy: http://forum.xbian.org/thread-196.html)

Manual Installation

SSH to the pi and issue the following commands

sudo apt-get update
sudo apt-get install xbian-package-transmission
sudo apt-get install xbian-package-headphones
sudo apt-get install xbian-package-couchpotato
sudo apt-get install xbian-package-sickbeard

Once the installation is done, Managing it is easy. Open a web browser on your laptop/tablet/minipc and enter the below

Transmission: http://x.x.x.x:9091/
SABnzbd: http://x.x.x.x:9092/
Headphones: http://x.x.x.x:9093/
Sickbeard: http://x.x.x.x:9094/
Couchpotato: http://x.x.x.x:9095/

where x.x.x.x is the xbian IP.
Default username and password is xbian and raspberry respectively.

Setting up the same Pi which has Xbian as a Music player

The same Pi can be used as a audio source/music player by installing the following packages.

  • Music Player Daemon (MPD) : This is a small program which acts as a music player server and can be controlled via a client
  • Music Player Client (MPC) : MPC is a music player client which can connect to a MPD server and allow users to play,skip, add playlist etc. MPC can be installed on the Xbian itself, but then you need a ssh access to the Xbian shell and control via CLI which is difficult. So for that we use the below tool.
  • MpDroid: Its a Music Player client for android/iphone/ipad/tablets. It has a good GUI and can be controlled from the phone or tablet. I personally use a 1st generation Nexus 7 for the same.

P.S: You may ask why I cant use XBMC itself for playing back audio. There are three reasons for that

  1. XBMC on Raspberry Pi as of now doesn’t support audio engine, so from XBMC you can’t direct the audio output to a external USB DAC.
  2. Due to the point 1 only option left is to play the audio through HDMI, but for that to happen my TV has to be turned on when ever I want to listen to audio.

Another alternative option is to use the analogue audio out in the Pi for both Audio and video. But that’s not a good quality one(Still I think its ok kind of thing for most of the people). But if you are specific to sound quality then MPD is the way to go.

Installing MPD on Xbian/Pi

Before installing MPD we need to install alsa-base and alsa-utils package. Issue the below command to install them

xbian$ sudo apt-get install alsa-base alsa-utils

Since already a great blog is there for the MPD installation and configuring it for a USB DAC. Please refer the audiohobby blog. Here is the link.

Note: In the audiohobby.com link, it hasn’t mentioned how to get which is the DAC device which we are having. It assumes its hw:0,0 . This can vary if you have the DAC connected to a USB hub. So below command will help you find that

xbian:~$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: Device [Schiit USB Audio Device], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0

So in My case also its hw0:0. What we need look is device and the subdevice numbers.

Now the remaining things are

  • Install the MPDROID on the android phone/tablet/iphone/ipad (This I hope most of the people knows)
  • Configure the MPDROID to connect to the Xbian IP
    Go to settings in MPDRoid–>Connection Settings->Add the server IP. Put the Port number as default.
  • Start Playing and enjoy

Controlling MPD using USB MCE remote

One of the problems with my above setup was that, you always need a tablet/smart phone/PC to play, pause or stop songs, which I felt is not good. So I decided to connect my unused Windows MCE (Media center Edition) remote to my PI to control the music play back.

Now you may ask why you need an MCE remote for the same when pi supports CEC, the reason is HDMI CEC works only when the TV is on and for music playback i dont want to turn on the TV, So I used the old MCE remote. I got the steps from the below sites and the credits goes to the owners of that thread/site

Xbian thread

XBMC Forum Thread

For Xbian I have summarized the steps below

“get rid of Lirc. Remove it from the default services.
install ir-keytables (apt-get install ir-keytables)
copy the appropriate keytable to /etc/rc_keytables
modify the keytable as you need – it creates keyboard events, so you can tailor your remote to the keys expected by xbmc.
add the command “ir-keytable -c -w /etc/rc_keytables/<your keytable>

And that’s it. It is simple, it survives reboots. It doe NOT require changing the lirc keyboard.xml”

Tips ‘N’ Tricks for Customizing Xbian

Note: All the below tweaks are collected from xbian forums and the credit goes to the original poster.

Changing the Xbian Boot Logo: 

The steps to change splash logo are very simple and require no system edit / changes (simply no hacking).

1) Logo and supplemental graphics is under /usr/bin/splash.images as jpg files
2) change logo.jpg, start splash you will see result immediately
3) if ok, just run “sudo xbian-update-initramfs”

Workaround:  check /boot/initramfs.gz.old, if is still in tact. rename it to /boot/initramfs.gz and try to boot.

Miscellaneous performance tweaks

– disable “Show RSS news feeds” in Settings>Appearance>Skin
– disable “Download actor thumbnails when adding to library” in Settings>Videos>Library
– disable “Extract thumbnail and video information” in Settings>Videos>File lists


File: /etc/mysql/my.cnf
– use the ip adres instead of server name
– disable “use dns lookup” in mysql settings

Categories: Audio/Video, General
  1. October 1, 2014 at 1:10 AM

    Everything is very open with a really clear explanation of the challenges.
    It was really informative. Your site is very helpful.
    Thanks for sharing!

  2. March 25, 2015 at 8:51 PM

    After I initially commented I seem to have clicked the -Notify me when new
    comments are added- checkbox and from now on whenever a comment is added
    I get four emails with the same comment. Is there a way you are
    able to remove me from that service? Appreciate it!

  3. June 28, 2015 at 11:24 AM

    I do agree with all of the concepts you have introduced on your post.
    They are very convincing and can certainly work. Still, the posts are too brief for beginners.
    May just you please prolong them a bit from next time?
    Thank you for the post.

  4. July 21, 2015 at 11:23 AM

    I pay a quick visit everyday some web pages and information sites to read content, but this blog
    gives quality based articles.

  1. June 29, 2015 at 5:28 AM

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: