How to use Raspberry Pi to make a media centre

Once you've set it up, it's time to add content to your HTPC. You can configure a bunch of media sources in Kodi, from where it can pull content. These media sources can be local media on the card, removable USB drives plugged into the Pi and even various file shares on the local network.

To define a media source, enter any of the Videos, Music or Pictures entries on the screen, and click Add Sources. Use the dialog box that pops up to browse to a source that contains some media. Adding media on the card or plugged-in USB drives is pretty simple and straightforward.

But if you wish to pull in content from another computer on the local network, you have to define the network shares first. Kodi supports several file-sharing protocols, including all the popular ones such as Samba, NFS, AFP, FTP and more.

To view media on a shared Samba drive, head to System > OpenELEC > Services, and toggle the Enable Samba option.

If the source requires authentication, toggle the Use Samba Password Authentication option and enter the username and password. When you've added a source, you can tell Kodi about the type of content it houses. In return, Kodi allows you to choose a scraper – a special plugin that fetches metadata about a media file from the internet.

How to use Raspberry Pi to make a media centre

Your HTPC includes a small web server that enables you to control Kodi from a skinnable web interface.

If you've set up multiple OpenELEC HTPCs on the same network, they can also share libraries between them, using the UPnP protocol. On the HTPC that houses the content you wish to share with the other HTPC, head to Settings > Services > UPnP and toggle the 'Share Video and Music Libraries Through UPnP' option.

Now jump over to the other HTPC where you wish to view the content, and add a source (as described earlier). When you browse for a media source, select the 'UPnP Devices' option from the list of sources, which then displays the other HTPC that houses the content.

Remote playback control

Your HTPC will now enable you to watch content either on locally connected drives or on any other computer or HTPC on the network, and even from your DVR. To further enhance the experience, you can enable the web interface to remotely control playback.

Kodi includes a web server which allows you to control the player via a web browser. To enable it, head to Settings > Services > Webserver and toggle the 'Allow Control of Kodi Via HTTP' option. You can optionally lock access behind a password.

Once enabled, fire up a web browser on any computer on the network and navigate to the IP address of the HTPC to control playback. Kodi also produces official remote control apps for Android and iOS devices, and, shockingly enough, you can find several third-party ones for the Windows Phone as well.

Before you can use them, head to Settings > Services > Remote Control, and toggle the 'Allow Program on Other Systems to Control Kodi' option. Now head to your device's app store and grab a remote control app. The official app is called Kore on the Google Play Store.

Optimise playback

Although the Raspberry Pi 2 packs quite a punch, there are some tweaks you can do in OpenELEC that result in smoother playback.

For starters, you can turn down the video playback resolution to 720p, especially if your HTPC isn't connected to a Full HDTV. Head to Settings > System > Video Output, and change the Resolution option to 720p.

Another trick is to replace the default skin, which was designed for desktop computers, to a lightweight skin, such as Aeon Nox, which makes navigating the menus snappier. To change the skin, head to Settings > Skins. Also make sure that hardware acceleration is turned on.

Go to System > Video > Acceleration and check that the Decoding Method is set to 'Hardware' and not 'Software'. While you're here, also reduce the GUI updates when playing video to 5fps.

Another playback-related tweak involves matching the refresh rate of the screen to the video being watched, which results in smoother playback. You can enable it by going to Settings > System > Video > Playback, then toggle the 'Adjust Display Refresh Rate' to 'Match Video'.

Another way to smooth out playback is to use audio passthrough for encoded audio, such as Dolby. To enable the option, navigate to Settings > System > Audio Output and toggle the 'Enable Passthrough' option. Finally, if you are on a slow internet connection, you can cut down on the bandwidth usage by heading to Settings > Video > Library and disabling the 'Download Actor Thumbnails' option.

Back up your video library

Seeing as you've spent a considerable amount of time setting up your HTPC, it would be a shame to lose it all because of a corrupted card. To prevent this happening, you can back up all your customisations and information about your library.

Kodi includes a backup utility, but we'll use an add-on that enables us to back up files to a custom location, including Dropbox. Head to Programs > Get More and install the Backup add-on. Once installed, launch it from under Program > Backup.

The program asks you to select one of two modes – 'Backup' or 'Restore'. When you select 'Backup', it throws an error because we haven't configured it yet.

Click 'OK' to bring up the Settings window. If you wish to back up to Dropbox, use the Remote Path Type pull-down menu to select the 'Dropbox' option, and enter the authentication details for your Dropbox account.

Otherwise, click 'Browse Remote Path' and select the location where you wish to store the backup files. Optionally, select the 'Compress Archive' option to reduce the size of the backed-up files.

Then switch over to the File Selection tab and customise the list of files you want to back up. Finally, switch over to the Scheduling tab and enable the scheduler to back up automatically, as per your defined schedule.

Once you've set it up, create an initial backup copy by launching the Backup program. This time when you hit the 'Backup' button, the program saves the marked files to the specified destination.

To restore the files, simply launch the program and click the 'Restore' button. The program shows you a list of all the backups inside the configured backup location.

Mayank Sharma

With almost two decades of writing and reporting on Linux, Mayank Sharma would like everyone to think he’s TechRadar Pro’s expert on the topic. Of course, he’s just as interested in other computing topics, particularly cybersecurity, cloud, containers, and coding.