Why choose Kodi?
Why fork out for an expensive set-top box when you can build your own for significantly less? Thanks to the powerful open-source Kodi media centre software, you can access both locally stored personal media on demand, plus watch a wide range of internet streaming services, including catch-up TV.
The success of Kodi – formerly known as XBMC – has led to the development of Kodi-flavoured distributions (distros).
If you’re looking for a full-blown Ubuntu-based distro with Kodi sitting on top then Kodibuntu will appeal.
Kodibuntu is overkill for most people’s needs, which is where OpenELEC comes in. This is an embedded OS built around Kodi, optimised for less powerful setups and designed to be as simple to run and administer as possible.
There’s an underlying OS you can access via SSH, but for the most part, you can restrict yourself exclusively to the Kodi environment.
Four official builds are currently available: ‘generic’ covers 32-bit and 64-bit Intel, Nvidia and AMD graphic setups; two Raspberry Pi flavours: one for the Raspberry Pi 2, and the other for everything else, including the new Raspberry Pi Zero; and one final build is for Freescale iMX6 ARM devices.
There are further unofficial builds for jailbroken Apple TV mark 1 boxes as well as AMLogic-based hardware.
Choose your hardware
The cheapest way to build a Kodi-based OpenELEC streaming box from scratch is to base it around the Raspberry Pi Zero. There’s one slight complication caused by the fact it only has one USB port, so you’ll need a powered hub to support both keyboard and Wi-Fi adaptor during the initial setup phase.
Expect to pay between £30 and £40 ($42-$60, AU$58-AU$75) for all the kit you need from the likes of The PiHut or Pimoroni. You’ll need a Pi Zero (obviously), case, power adaptor, Wi-Fi adaptor, microSD card, powered USB hub and accessories.
If you’re willing to spend a little more, than the Raspberry Pi Model B+ costs £19.20 or the quad-core Pi 2 Model B costs £28, not including power and Wi-Fi adaptors, micro SD card and case. Both come with Ethernet port for wired networking, plus four USB ports and full-size HDMI port – choose the Raspberry Pi 2 (or the newer Raspberry Pi 3) if you plan to run a media server.
You’ll need a keyboard for the initial configuration of OpenELEC, but once those steps are complete, you’ll be able to control OpenELEC remotely via your web browser or using a free mobile app. You’ll also need somewhere to store your media.
If you only have a small (sub-50GB collection), then splash out for a 64GB microSD card and store it locally; otherwise attach a USB hard drive or even store your media on a NAS drive and connect over the network. Note the latter option will slow things down considerably, and you may experience buffering, particularly if connected via Wi-Fi.
Download the latest version of the Kodi-based OpenELEC 6.0.1. The files are compressed in TAR or GZ format, so you’ll first need to extract them. The simplest way to do this is using your Linux distro’s GUI – in Ubuntu, eg, copy the file to your hard drive, then right-click it and choose ‘Extract Here’.
Build, install and configure
Now connect your micro SD card to your PC using a suitable card reader and use the $ dmesg | tail command or Disks utility to identify its mountpoint.
Once done, type the following commands – which assume your drive is sdc and that your image file is in the Downloads folder.
$ umount /dev/sdc1
$ cd Downloads
$ sudo dd if=OpenELEC-RPi.arm-6.0.1.img of=/dev/sdc bs=4M
You’ll want to use sudo dd if=OpenELEC-RPi2.arm-6.0.1.img of=/dev/sdc bs=4M if installing OpenELEC on the Raspberry Pi 2. Wait while the image is written to your micro SD card – this may take a while, and there’s no progress bar, so be patient (time for a cup of tea, perhaps?).
Once complete, unmount your drive and then eject it. Insert the micro SD card into the Pi, connect it up to monitor and keyboard and switch it on. You should immediately see a green light flash, and the screen come on.
The OpenELEC splash screen will appear, at which point it’ll tell you it’s resizing the card – it’s basically creating a data partition on which you can store media locally if you wish. After a second reboot, you’ll eventually find yourself presented with an initial setup wizard for Kodi itself.
If you’ve not got a mouse plugged in, use Tab or the cursor keys to navigate between options, and Enter to select them. Start by reviewing the hostname – OpenELEC – and changing it if you’re going to run a media server and the name isn’t obvious enough already.
Next, connect to your Wi-Fi network by selecting it from the list and entering your passphrase. You can then add support for remote SSH access as well as Samba.
Switch on SSH and you have access to the underlying Linux installation via the Terminal (use ssh firstname.lastname@example.org substituting 192.168.x.y with your OpenELEC device’s IP address. The password is ‘openelec’).
The main purpose for doing this is to configure OpenELEC without having to dive into System > OpenELEC. Start by typing ls-all and hitting Enter – you’ll see the core folders are hidden by default.
Basic commands are supported – such as ifconfig for checking your network settings, and top to see current CPU and memory usage. There’s not an awful lot you can do here – the idea is to give you access to useful tools only.
Network settings in OpenELEC are controlled by the connman daemon, eg –to change these, navigate to storage/.cache/conman where you’ll find a lengthy folder name beginning wifi_.
Enter this folder using cd wifi* and then type nano settings to gain access. If you’d like to set a static IP address from here, change the following lines:
Then add the following three lines beneath IPv6.privacy=disabled:
Replace 192.168.x.y with your chosen IP address, and 192.168.x.z with your router’s IP address (get this using the ifconfig ). Save your changes and reboot.
You can now control Kodi remotely if you wish via your web browser: type 192.168.x.y:80 into your browser (substituting 192.168.x.y with your Pi’s IP address). Switch to the Remote tab and you’ll find a handy point-and-click on-screen remote to use – what isn’t so obvious is that your keyboard now controls Kodi too, as if it were plugged into your Raspberry Pi directly.
You’ll also see tabs for movies, TV Shows and music – once you’ve populated your media libraries you’ll be able to browse and set up content to play from here. This approach relies on your PC or laptop being in line of sight of your TV – if that’s not practical, press your tablet or phone into service as a remote control instead.
Search the Google Play store for Kore (Android) or the App Store for Official Kodi Remote (iOS) and you’ll find both apps will easily find your Raspberry Pi and let you control it via a remote-like interface.
By default, OpenELEC uses DHCP to connect to your local network – if your Raspberry Pi’s local IP address changes, it can be hard to track it down in your web browser for remote configuration.
Change this by choosing System > OpenELEC > Connections, selecting your connection and hitting Enter. Choose ‘Edit’ from the list and pick IPv4 to assign a static IP address you’ll be able to use to always access Kodi in future.
You can simply stick with the currently assigned address, or pick another. Make sure you select ‘Save’ to enable the change.
Set up libraries in Kodi
The first thing to do is add your media to your library. Kodi supports a wide range of containers and formats, so you should have no problem unless you’ve gone for a particularly obscure format.
Check the box (see Add Content to your Library, below) for advice on naming and organising your media so that allows Kodi to recognise it and display extra information about TV shows and movies. This uses the help of special ‘scrapers’: tools that extract metadata from online databases such as movie titles, TV episode synopses and artwork to pair them with your media files for identification.
Where should you store this local content for Kodi to get at it? If your micro SD card is large enough – we’d suggest 64GB or greater – then you can store a fair amount of video and music on there. You can transfer files across the local network – open File Manager and opt to browse your network.
Your Kodi/OpenELEC device should show up – double-click the file sharing entry and you’ll see folders for Music, Pictures, TV Shows and Videos – simply copy your files here to add them to your library. Once done, browse to Video or Music and the media files should already be present and accounted for, although at this point in time they’ve not been assigned a scraper to help you identify them yet.
It can be slow copying files across in the network – you can transfer files directly to the card when it’s mounted in a card reader on your PC, but you’ll need to access File Manager as root to do so – in Ubuntu, eg, typing $ gksudo nautilus and hitting Enter will give you the access you need.
A simpler option – if you have a spare USB port on your Raspberry Pi – is to store your media on an external thumb or hard drive. Just plug the drive into your Raspberry Pi, browse to Videos or Music and choose the ‘Add…’ option. Click ‘Browse’ and select the top-level folder containing the type of media you’re adding – TV, movies or music.
If you’ve plugged in a USB device, you’ll find it under root/media, while NAS drives are typically found under ‘Windows Network (SMB)’. Once selected, click ‘OK’. The Set Content dialogue box will pop up – use the up and down arrow buttons to select the type of media you’re cataloguing and verify the selected scraper is the one you want to use.
Check the content scanning options – the defaults should be fine for most people – and click ‘Settings’ to review advanced options (you may want to switch certification country to the UK for movies, eg). Click ‘OK’ twice and choose ‘Yes’ when prompted to update the library.
Once done, you’ll find a new entry – Library – has been added to the media menu on the main screen. This gives you access to your content with filters such as genres, title or year to help navigate larger collections. Now repeat for the other types of media you have.
If you want to include multiple folder locations within single libraries, you’ll need to browse to the Files view, then right-click the library name (or select it and press c on the keyboard) to bring up a context menu. Select ‘Edit Source’ to add more locations, and ‘Change Content’ to change the media type and scraper if necessary.
The smartest thing to do with any digital media library is host it on a media server, which allows you to easily access it from other devices on your network and – in some cases – over the wider internet. Kodi has UPnP media server capabilities that work brilliantly with other instances of Kodi on your network as well as making your media accessible from other compatible clients.
Media servers can be quite demanding, so we don’t recommend using a Pi Zero or Raspberry Pi Model B+. Instead, set it up on your most powerful PC (or Raspberry Pi 2 or Raspberry Pi 3) and use OpenELEC to connect to it as a client.
As media servers go, Kodi’s is rather basic. If you want an attractive, flexible server then maybe check out Emby.
Pair this with the Emby for Kodi add-on and you can access your Emby-hosted media without having to add it to your Kodi library. A similar add-on exists for users of Plex Media Server too, PleXBMC, providing you with an attractive front-end.
If you want access to other UPnP servers via Kodi without any bells and whistles, then browse to System > Settings > Services > UpnP/DLNA and select ‘Allow remote control via UPnP’. You can also set up Kodi as a media server from here: select ‘Share my libraries’ and it should be visible to any UPnP client on your network, although you may have to reboot.
Performance is obviously going to be an issue on lower-powered devices, such as the Raspberry Pi, and while the Raspberry Pi 2 is pretty responsive out of the box, you may find the Raspberry Pi Zero struggles at times. It pays, therefore, to try and optimise your settings to give your Raspberry Pi as much resources as it needs to run smoothly.
Start by disabling unneeded services – look under both System > OpenELEC > Services (Samba isn’t needed if you’re not sharing files to and from Kodi, eg) and System > Settings > Services (AirPlay isn’t usually required).
Incidentally, while you’re in System > Settings, click ‘Settings level: Standard’ to select first Advanced > Expert to reveal more settings.
One bottleneck for Raspberry Pi devices is dealing with large libraries – give it a helping hand by first going to Settings > Music > File lists and disabling tag reading. Also go into Settings > Video > Library and disable ‘Download actor thumbnails’.
You can also disable ‘Extract thumbnails and video information’ under File Lists, but you’ll lose a lot of eye candy and the thumbnail caching for future use.
The default Confluence skin is pretty nippy, although if you suffer from stutter when browsing the home screen, consider disabling the showing of recently added videos and albums: select Settings > Appearance, then click Settings in the right-hand pane under Skin. Switch to ‘Home Window Options’ and de-select both ‘Show recently added…’ options.
Speaking of Confluence, if you don’t like the default skin, then try Amber – it’s beautiful to look at, but easy on system resources. You do lose access to the OpenELEC settings when it’s running, but you can always switch back to Confluence temporarily or use SSH for tweaks, if necessary.
Add content to your library
Kodi works best with your locally stored digital media, but for it to recognise your TV shows from your music collection you need to name your media correctly and organise them into the right folders too.
Kodi supports the same naming convention as its rival services Embyand Plex – use the following table to help you:
Need to rename files in a hurry? Then Filebot is your new best friend.
Add catch-up TV to your Kodi streaming stick
1. Add BBC iPlayer
Browse to Videos > Add-ons. Select ‘Get more…’, then scroll through the list and find ‘iPlayer WWW’. Select this and choose ‘Install’. Once installed you’ll be able to access it through Videos > Add-ons for access to both live and catchup streams.
Configure subtitles and other preferences via System > Settings > Add-ons > iPlayer WWW.
2. Get ITV Player
Navigate to System > File Manager. Select ‘Add Source’ followed by ‘<None>’, enter http://www.xunitytalk.me/xfinity and select ‘Done’ followed by ‘OK’.
Hit Esc then choose System > Settings > Add-ons > Install from ZIP file. Select xfinity from the list of locations, select ‘XunityTalk_Repository.zip’, hit Enter and wait for it to be installed.
3. Finish installation
Now select ‘Install from repository’ followed by .XunityTalk Repository > Video add-ons, scroll down and select ITV. Choose Install and it should quickly download, install and enable itself.
Go to Videos > Add-ons to access live streams of six ITV channels, plus access the past 30 days of programmes through ITV Player – a big improvement on the standard seven days offered on most platforms.
4. UKTV Play
Follow the instructions for ITV Player to add http://srp.nu as a source, then add the main repository via SuperRePo > isengard > repositories > superepo. Next, choose Install from repository > SuperRepo > Add-on repository > SuperRepo Category Video.
Finally, add UKTV Play from inside the SuperRepo Category Video repo to gain access to content from UKTV Play’s free-to-air channels.
- Enjoyed this article? Expand your knowledge of Linux, get more from your code, and discover the latest open source developments inside Linux Format. Read our sampler today and take advantage of the offer inside.