How to Watch and Record Live TV with a Raspberry Pi

This procedure explains how to turn a Raspberry Pi into a DVR, or “digital video recorder”. A DVR is a box that sits under your television, allowing you to watch digital television and record it to a hard disk. TV and recordings can also be “streamed” to other devices on your network, such as phones, tablets and PCs.

Procedure last updated 8th Jan 2022 for OSMC 19 / Kodi “Matrix” / Pi 4.

Commercial examples of DVRs are available from manufacturers like Humax and Panasonic, providing access to free digital TV services, which in the UK are called Freeview and Freesat. Other brand names are used in other countries, but the underlying technology is the same. By following the article, you will be able to view, record and stream free digital TV. (You won’t be able to watch encrypted services, like those broadcast by Sky and BT).

Why turn a Pi into a DVR? You might be just curious about the possibilities. You might be looking to move from a paid-for service (eg. BT or Sky) to a free one. You might want to replace older equipment or just get access to more modern services, such as HDTV (high definition TV). I was looking to replace my old Topfield DVR, and the procedure below worked for me.

Evolutionary Approach

Follow the first part of this article to get a basic working setup, giving the ability to watch and record Live TV. You can leave it at that, or build on the solution as explained in later sections. They describe how to add storage, add a proper remote control, stabilize the Pi with a swap area and a proper power supply, and stream TV and and recordings to any device on your network, such as a phone, tablet, PC or other TVs. Separate articles explain how to add TV Channel Logos, tweak the GUI to your liking and even automatically skip TV commercial breaks.


Three pieces of software will be used. OSMC provides the GUI that works on your television, allowing you to switch TV channels, watch recordings, check the programme guide and so on. Meanwhile, TVHeadend works in the background, receiving TV signals from the tuner, decoding and recording them where necessary.

The third item is called TVHeadend HTSP Client Add-on. It allows OSMC and TVHeadend to work together. More accurately, it enables OSMC to control TVHeadend. All three packages run on the Raspberry Pi.

Note: OSMC is really a “shrink wrapped” version of Kodi, the well known media software, pre-configured and available as a Pi image. Conveniently, we can download and burn it straight to an SD card. I have found OSMC to be very stable and well supported. It also has a very active community support, as do Kodi and TVHeadend.

Required Hardware

The procedure below assumes you have the following hardware.

  • a Pi, model 2 or 3, connected to a TV (or display). Preferably these are located where you watch TV: in your lounge, living room, den (in the USA), or wherever. The Pi should also be connected to your home network via an Ethernet cable. A wireless connection will work too, and will probably suffice for testing. If you decide to afterwards keep the Pi acting as your TV solution, I would strongly recommend a wired connection. The Pi 1 and Pi 4 are not currently recommended, for reasons explained at the end of this article.
  • A spare micro SD card. To go into the Raspberry Pi. 8 GB or larger is recommended, class 10.
  • A keyboard attached to the Pi, wired or wireless.
  • A TV tuner. If you don’t happen to have one lying around, some money will have to be spent, I’m afraid. I successfully used a Hauppauge WinTV dualHD. It is a little expensive in the UK (£69). Being a dual model, it will allow you to watch one TV channel while recording another. The single model would probably work too, but I haven’t tested it.
  • A separate PC, to perform configuration tasks.

For the record, I used a Pi 2 connected to my TV in the lounge via an HDMI cable, and a wireless keyboard. The PC I used was a laptop running Linux but Windows is also fine.


Download OSMC

This part of the procedure is carried out on your PC. Go to the OSMC download page. Click on the “Disk images” button. A list of image files will appear. Scroll down to the section entitled “Raspberry Pi 2 / 3 / 3+” and click on the most recent image you see there. Download and save the file, which is about 230 MB in size. At the time of writing (19th Nov 2019), the latest file was called “2019.10-1”, so I downloaded that one, but yours will likely be more recent.

Burn OSMC to an SD Card

Put an unused micro SD cared into your PC. Unzip the downloaded image file and “burn” it to the SD card using your favourite burning software. Note: all data currently on the SD card will be destroyed.

If you are using Linux, it can be done on the command line as below. My downloaded file is called “OSMC_TGT_rbp2_20191107.img.gz”. Yours will have a slightly different name. /dev/sdb is the device corresponding to my SD card. Again, your SD card might have a different name, eg. /dev/sdc or /dev/sdd. Note: it is very important that you get the device name correct here, otherwise you could accidentally overwrite your PCs operating system. Be absolutely clear before proceeding that you have typed the correct device name.

$ gunzip OSMC_TGT_rbp2_20191107.img.gz
$ sudo dd if=OSMC_TGT_rbp2_20191107.img of=/dev/sdb bs=1M

Burning the card should take a minute or so. When it completes, pop the SD card out of the PC.

Configure OSMC

For this part of the procedure, you should be sitting in front of your Pi and TV. Start with your Pi connected to a screen and keyboard and powered off. Insert the SD card into the Pi and power it on. The Pi should boot and you will then see a blue screen announcing “OSMC” and below that a message saying “Formatting device”, then “Installing files”. Wait about 5 or 10minutes. The Pi might reboot. A screen saying “videos”, “music” and some other stuff will appear for a few moments. Then that will change and you should be left with a screen saying “Welcome” and some language choices.

  • Choose your language here. Use the Pi keyboard to scroll to your preferred language and press [Return] to select it. On the “Confirm” screen that appears, select “Yes“.
  • In a similar way, choose your timezone. I am in the UK, so I select “Europe” followed by “London”.
  • You will now be asked to “Give your device a name”. Scroll down to “Accept” and press [Return] to accept the default system name of “osmc“.
  • The following screen asks about SSH. Accept the default, which is to have SSH enabled, by scrolling down to “Accept” and pressing [Return].
  • Press [Return] (“Continue”) to accept the boring license agreement.
  • The next screen asks you to choose between “The OSMC Skin” and “Estuary”. This is a choice between two “skins”, and an example of each is displayed on the lower portion of the screen. Select “Estuary” and press [Return]. NB. this setting can easily be changed later.
  • Finally, you will be asked “Would you like to receive the news letter?”. For now, select “No thanks” and press [Return].

An announcement screen appears. Read the announcement then select “Exit”. After a moment, the OSMC home screen appears and a moment later, the skin changes and we are left with the classic version of the OSMC home screen, shown by the word “KODI” at the top left.

Check for Latest OSMC Updates

You might expect now to be running the latest version of OSMC but this isn’t necessarily the case. Proceed as follows to download the latest updates.

On the OSMC home screen, use your keyboard to move down the menu on the left. Scroll right down to the bottom item, which is “My OSMC” and select that. The “My OSMC” screen appears, which looks like a circle of 7 icons. Your currently running version of OSMC is shows at the bottom of the screen. (In my case it was “December 2021, 2021.12-1”).

Select the cloud icon on the right and press [Return] to move into the Update section.

Highlight the “Manual Controls” button on the left. Then, on the right, “Scan for updates now“. The “My OSMC” screen will reappear and messages at the top right of the screen will confirm progress as updates are downloaded and applied.

If, instead, a message appears saying “No updates were available”, well, then no updates were available, and you can move straight to the paragraph entitled “Change the OSMC skin”, below.

Apply Latest OSMC Updates

If updates are available, they will be applied. A dialogue might be shown, saying “OSMC Update Available”, and asking if you would like to exit and install the updates now. Choose “Yes“. The system will exit to Linux to install updates, giving further messages about installing packages. Finally, you will see the OSMC home screen again, signified by the word “Kodi” at the top left.

If you want to check the update, scroll down to and select “My OSMC” again. The new version number is shown at the bottom left of the screen. In my case, the version number was updated to “November 2019 2019.11-1”.

Press the [Escape] key on your keyboard to move back to the Home screen.

Change the OSMC skin. Annoyingly, the update might have caused OSMC to change back to its default, or “OSMC” skin. We want to use the “classic” skin instead. Scroll down the left hand menu and choose “Settings”. Then, again on the left, “Interface”. Now on the right, select “Skin”. A list of 3 skins is shown, one of them being called “Estuary“. Select the Estuary skin and press [Return], and then choose “Yes” (within a few seconds) to confirm the change. OSMC reverts to its “Classic” appearance.

Congratulations! That Completes the installation of OSMC. Move back to the home screen by pressing [Backspace] 2 or 3 times.

Install TVHeadend

Using the left hand menu, scroll down to “My OSMC” again and select it. In the My OSMC screen, choose the shopping trolley symbol at the top left to enter the OSMC App Store. Highlight “TVHeadend Server” (it will probably be the last item in the list) and press [Return].

An information page will appear, telling you about TVHeadend server and the version number. Select “Install“, at the bottom left of the screen. Then “Apply” on the left hand side. TVHeadend is installed, progress being confirmed by messages at the top right of your screen. Click “OK” in the “Operations successfully completed” dialogue, when it appears.

Configure TVHeadend

In this step, TVHeadend will be configured. This part of the procedure should be carried out from your PC, in a browser. Meanwhile, ensure that your tuner device is connected to the Pi.

Open your favourite browser and surf to the address http://<ip address of pi>:9981. For example, my Pi’s IP address is, so I go to

Login with the user osmc, password osmc.

TVHeadend Configuration Wizard

You should see the TVHeadend web interface. The configuration wizard is already running, appearing as a window entitled “Welcome – Tvheadend – Your TV streaming server and video recorder”. Execute the wizard as follows.

  1. Enter your preferred language twice on the first page. Once under “Web Interface” and again under “EPG Language (priority order)”, “Language 1”. I am in the UK, so I chose “English (GB)” for both.
  2. Click “Save & Next“. The first page will actually re-appear. Click “Save & Next” again to move to the second page.
  3. On the second page, about access, accept the defaults and just click “Save & Next“.
  4. The third page is called “Network Settings“. It shows a series of “Networks”. The first, called “Network 1”, refers to IPTV and can be ignored. The others each refer to one of your connected tuners. If you are using a single tuner, you might see one or two additional networks, one for each of the tuner’s capabilities. For a dual tuner, you might see 2 networks or 4.
  5. Note, the word “network” here is just an abstraction, used by TVHeadend to refer to a tuner or collection of tuners that do the same thing, and pick up TV in the same way. You will see your tuner’s name, greyed out, and a drop down. By selecting an item from the drop-down, you add that tuner to the named “network“, or group of tuners.
  6. I am using a dual DVB-T tuner, which contains 2 DVB-T tuners (for terrestrial TV) and an additional 2 “DVB-C” for cable TV, which I will be ignoring. I select the drop-down beside each “DVB-T” tuner, and add both to the network “DVB-T Network”. I am really just telling TVHeadend to use both tuners to do the same thing, ie.pick up broadcast (DVB-T) television. Do likewise for each of your tuners. If you are using a single tuner, you only have one to do. Choose “DVB-T Network”. (If, on the other hand, you are using cable TV and a cable tuner, choose “DVB-C Network”). Then click Save & Next.
  7. The next page is called “Assign predefined networks to muxes“. Here we allocate the network group (or tuner group) just defined to a local TV transmitter. From the drop down, select your nearest TV transmitter. (The UK ones are all near the bottom of the list). See this page for more. I selected my nearest transmitter, which was “uk-sandyheath”. Click Save & Next“.
  8. A frequency scan will be performed. The system will pick up TV and radio channels being transmitted. Wait for the scan to complete (scan status 100%). Then click Save & next.
  9. The next page is called “Service Mapping“. A “Service” here just means a TV or radio channel. In digital TV parlance they are called “services”. Select all three check boxes and make sure they are ticked: “Map all services”, “Create provider tags” and “Create network tags”. Then choose “Save and Next“.
  10. The next page says “You are now finished”. Click the “Finish” button to complete the Wizard. You might have to click it twice.

Test TVHeadend

Watch Some TV !

After completing the configuration of TVHeadend, you should now be looking at a list of channels. The list includes TV shows that are on now, and those scheduled in the future. At the top left is a drop-down that says “All”. Change it to “Now”. The list changes to just show TV programs now being broadcast.

Choose a channel to watch and click the “info” icon at the extreme left. An information page appears showing details of the current TV show. Click the “Play Programme” button. A player window appears and after a few seconds, you should be watching that channel.

When you have seen enough, close the viewer window.

Record Some TV

Repeat the procedure for watching TV. But instead of clicking the “Play Programme” button”, click “Record Programme” instead. A “record” icon will appear under the “Details” column in the GUI. Wait a minute or so. Click the “information” icon again (extreme left) and click “Stop recording“. To see your minute of recorded TV, select the “Digital Video Recorder” tab and under that, the “Finished Recordings tab”. There you can see the recording. Play it by clicking the “Play” button on the left.

Excellent. TVHeadend is working. We will just alter a couple of settings before moving on.

Miscellaneous TVHeadend Settings

Make the following configuration changes using the TVHeadend web interface.

Show all settings. Select the Configuration tab -> General tab -> Base tab. Change the “User Interface level” to “Expert“. Click the “Save” key (just under the Base tab). All settings in the interface are now available.

Enable time shifting. Select the Configuration tab -> Recording tab -> Timeshift tab. Under “Basic Settings”, click the “Enabled” box. Click the “Save” key (at the top left). This enables the pausing and rewinding of live TV. NB. the system will buffer live TV to a temporary area on the internal SD.

Remove Unwanted Channels. Prevent unwanted channels from appearing the in programme guide (EPG) later on. Select the Configuration tab -> Channel / EPG tab -> Channels tab. At the very bottom right, change the “Per page” setting to “All”, so that all channels are displayed. Now, in the second column, called “Enabled“, uncheck the box for every unwanted channel – eg. direct sales channels, Adult, all of the “+1″s . When you are finished, click the Save button at the top left.

Configure EPG Grabbers. An “EPG Grabber” is a part of TVHeadend that obtains programme schedule information, which you will see later displayed in OSMC. To make sure that complete data is collected, enable the correct grabbers. Select Configuration tab -> Channel/EPG tab -> EPG Grabber Modules tab. A list of about 13 “grabber modules” appears on the left. Probably there are two already enabled by default, called “EIT: DVB Grabber” and “PSIP: ATSC Grabber”. Leave those. If you are in the UK, highlight the one called “Over-the-air: UK: Freeview“. Enable it by clicking the “Enabled” check box on the right, followed by the Save button at the top left.

Note: if you can not see the EPG Grabbers as described above, you might not be viewing in “expert mode”. In this case, make sure you have set the view mode to “expert” as described under the section “Show all settings“, located just a few paragraphs above.

If you are not in the UK, you should enable a different grabber as appropriate. I haven’t tested this procedure outside the UK so I am not sure which one will work for you. Also if you are using a satellite receiver rather then terrestrial, enable the appropriate satellite grabber instead.

TVHeadend Installed

Congratulations! That concludes the installation of TVHeadend.

Configure TVHeadend HTSP Client Add-on

For this part, go back to the Pi keyboard and TV. There is one more thing to do to complete the setup. That is to configure and enable an OSMC “add-on” called TVHeadend HTSP Client. It acts like a piece of glue between TVHeadend and OSMC, allowing us to carry out all TV functions from OSMC.

In OSMC, make sure you are looking at the Home screen, shown by the word “KODI” at the top left. You can get there by pressing the [Backspace] key on your keyboard a number of times.

On the left-hand menu, choose “Add-ons” then on the right, “My add-ons“. A list of add-on categories appears. One of them is “PVR clients“. Choose it. Scroll down the long list that appears, select “Tvheadend HTSP Client” and press [Return]. The client page appears. Configure it as follows.

First, select the “Configure” button. Under “Connection Settings”, leave the defaults unchanged, except for “Username” and “Password”. Set these both to “osmc“, which is the name and password we chose when setting up TVHeadend. The add-on will interact with TVHeadend using these credentials. Select the OK button on the right to return to the main page for the add-on.

Enable TVHeadend HTSP Client Add-on

At the bottom is an “enable” button. Select it and press [Return] to enable the add-on. Note: when the add-on is enabled, the button legend changes to say “Disable”. Confusing enough to fool me first time around, but there it is.

Press [Backspace] on your keyboard a number of times until you reach the OSMC home screen, indicated by the word “KODI” at the top right.


In OSMC, press the “e” key on your keyboard. An EPG should appear (electronic programme guide) showing current and scheduled TV shows for the first 8 channels you are receiving. Use the down arrow to scroll down the list of all channels. Press [Return] to start watching a channel. An information screen will appear. Choose the “Switch” button at the bottom to start watching.

When you have seen enough of that channel, bring up the EPG by pressing “e” again and choose another channel. Or just press “x” to stop watching altogether and return to the OSMC home page. Or press “k” to bring up the recordings page – you should see the short recording(s) made above, while testing TVHeadend. Press [Return] to view a recording. To delete it instead, press “c” to bring up the context menu and choose “Delete

The context menu also works in the EPG, allowing you to schedule programme recordings and more. For a full list of key functions in OSMC, see the Kodi keys page. Happy viewing!

End of basic procedure.

End of Basic Procedure

The main procedure ends here. If you have followed it, you should now be able to watch and record live TV. The following sections describe a series of improvements which, though optional, will enhance your viewing experience.

Enhancement 1. Obtain SSH Access

After completing this section, you will be able to log into your Pi from another PC. Command line access is needed for some of the improvements below. It is also useful for checking logs and troubleshooting, especially as you learn more about the system.

From Windows, use an SSH client such as Putty. From Linux, use ssh. The IP address of my Pi is, so I use this command from my PC to log into the Pi:

$ ssh -l osmc Generating locales (this might take a while)…    en_GB.UTF-8… done  Generation complete.

Enhancement 2. Enlarge OSMC Fonts

For information on enlarging fonts, please see the newly written separate article (Jan 24th 2020).

Enhancement 3. Add Storage

You should now have the Pi set up as a basic working DVR. You can watch and record TV. Any recordings you make are written to the directory /home/osmc. This is the default. It isn’t the best place to store your data, however, because it is on the Pi’s internal SD card. The card doesn’t have much capacity and is likely to fill up after a few hours of TV have been recorded. Proceed as follows to add another disk.

A 2 TB external USB disk can be bought for £50 or so. That would give enough capacity to store 2000 hours of television (a bit less for HD TV recordings). You might even have a spare disk lying around. To use it to store TV recordings, attach it to the Pi via a powered USB hub. (It might work without the hub. On the other hand, it might not – it might not even spin, and it might starve the other components of power).

An alternative it to use a thumb drive/memory stick. It will not need a powered hub, but the capacity will be smaller. For this procedure, I am using a 128 GB memory stick. Really, I would recommend something bigger, but this will demonstrate the process.

Format the Drive

Attach your chosen drive to the Pi, or to a Linux PC if you are using one (I will use the Pi, here). Then, go back your PC and log into the Pi over SSH. Your disk will be identified by a device name, such as sda1, sdb1 or sdc1. My USB stick appeared as /dev/sda1.

If the drive mounts automatically (probable), unmount it:

osmc@osmc:~$ sudo umount /dev/sda1

Be aware that the formatting will destroy all data currently on the drive. Note: If you would prefer not to format, perhaps because you want to preserve some other data already on the drive, then don’t format it. Just skip to the next section, “Configure Recording Path”. Things should still work, but it depends on the existing setup of your drive, and troubleshooting that is beyond the scope of this article.

Create a new XFS file system with the following commands, replacing “/dev/sda1” with the correct device name for your drive. The second line creates a new file system and the third labels it “disk1”.

osmc@osmc:~$ sudo apt-get install -y xfsprogs
osmc@osmc:~$ sudo mkfs -t xfs -f /dev/sda1
osmc@osmc:~$ sudo xfs_admin -L disk1 /dev/sda1

Remove the drive from the Pi, wait a few seconds, then insert it again. It should automatically mount and appear as “/media/disk1”. Check it with df:

osmc@osmc:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
...other output removed...
/dev/sda1 30655860 63568 30592292 1% /media/disk1

Configure Recording Path

It is necessary to configure the system to use the new drive for TV recordings. First, create a directory on the drive:

osmc@osmc:~$ mkdir /media/disk1/Recordings

In a browser, surf to the TVHeadend interface page again (http://<ip address of your pi>/9981). Select the “Configuration” tab -> Recording tab -> Digital Video Recorder Profiles tab. On the right you should see a field called “Recording system path:” (under “Recording file options”). Change it from the default, which is /home/osmc, to “/media/disk1/Recordings“. Then click the “Save” button, at the top left just under the tabs.

Test the Disk

As a test, start a TV recording, either from the TVHeadend web interface or from OSMC. You should see the file being written to the new disk, under /media/disk1/Recordings. You might also see the access light on the disk flashing. Here is the new file, seen on SSH, showing a recording of BBC News:

osmc@osmc:~$ ls -l /media/disk1/Recordings
-rw-rw-r-- 1 osmc video 403066924 Nov 22 18:20 BBC News.ts

TVHeadend will now write recorded programs to the new disk, instead if its internal SD card. Any recordings remaining on the SD card (such as the tests made earlier in this procedure) will continue to exist there and be managed by the system until you choose to view and/or delete them.

It might be considered a good idea to move existing recordings from the SD card to the external disk. I would not recommend this. The software keeps a database of recordings, which would be put out of sync if the files were moved. Just delete them instead.

Enhancement 4. Add a Swap Area

In testing, I have found that the Pi will, very occasionally, run out of memory. The problem appears to be caused by a bug in TVHeadend (a “memory leak“). If it happens, you might find that programmed recordings were never made. Future releases of TVHeadend are likely to fix the issue. But for now, we will avoid it by creating a swap area.

The effect of the new swap area will be to increase the virtual memory capacity of the Pi. In normal circumstances it won’t be used and it won’t affect performance. But it will prevent the above bug from showing up and ruining things. Proceed as follows.

Log into the Pi over SSH. Create a swap file. Note this command will take about 3 minutes to complete (on a Pi 2). Stop watching TV on the Pi first, and stop any running recordings, otherwise it will take much longer:

osmc@osmc:~$ sudo dd if=/dev/zero of=/swapfile1 bs=1M count=1024

Configure the swap file:

osmc@osmc:~$ sudo chmod 0600 /swapfile1
osmc@osmc:~$ sudo mkswap /swapfile1
Setting up swapspace version 1, size = 1024 MiB (1073737728 bytes)   no label, UUID=db8dd543-1781-4647-b4b2-32016d565171 osmc@osmc:~$ sudo chmod 0600 /swapfile1

Activate the swap:

osmc@osmc:~$ echo "/swapfile1 none swap sw 0 0" | sudo tee -a /etc/fstab > /dev/null
osmc@osmc:~$ sudo swapon -a

Finally, the swapon -s command will confirm the presence of the new swap area:

osmc@osmc:~$ swapon -s
 Filename           Type            Size    Used    Priority
 /swapfile1         file            1048572 0       -2

That completes the swap configuration.

Enhancement 5. Add a Remote Control

OSMC can be operated fine with a keyboard. All functions are accessible. You can watch TV and TV recordings and control everything with different key presses, detailed in the guide referenced above. Many people find it more relaxing to use conventional remote control handset (as they are called in the USA, a “zapper” or “clicker”).

Flirc USB

There are many ways to add a remote control to OSMC. The method below is perhaps the easiest, simplest and most effective. It requires the purchase of a “Flirc USB“, a small device available on Amazon for about £20 at the time of writing (Nov 2019). A spare remote control handset is also needed. Most of us have old remotes sitting in a drawer. Well, find your favourite one, check the batteries and give it a dust, because it is going into battle.

Alternatively, you might already be using a universal remote, such as those made by Harmony/Logitech or “One for All“. If it has a spare function, you can use it with the Flirc. Just program the keys in the same way as is described below.

The Flirc attaches to the Pi over USB. It picks up infra-red (IR) signals from your remote control and converts them into key presses, which are passed into the Pi. The Pi reacts in the same way it would if you pressed the equivalent key on an attached keyboard.

Personally, I decided to use the remote control from disused Western Digital media player. The handset is well made and has large keys, which are well spaced. I recommend avoiding controls that have wobbly keys, or keys that are too close together (like with some old DVD players).

Install the Flirc

Unbox the Flirc and put it into a spare USB port on your PC (don’t attach it to the Pi yet). Download the Flirc software, which is available for Windows, Mac and Linux. install it following the instructions for your platform.

Configure the Flirc

Run the Flirc application. If you are running it for the first time, it might offer to upgrade the firmware. Let it do that.

Select the “Controllers” menu and choose “kodi“. A diagram appears showing Kodi applicable keys. Configure, in turn, all the keys you are interested in using on the remote. For example, the key to bring up the EPG: click your mouse on the “EPG” key. A message appears asking you to press the button you want to use to display the EPG. Press the desired button on the remote (while poining it at the Flirc device). A message confirms that button has been programmed.

Go through every key you want to use. To undo a mistake, click “erase” in the Flirc window, then click the button that the wrong meaning was accidentally assigned to. It will be de-programmed (erased). I would recommend setting all the number buttons, volume, mute, play, stop, C (context menu). Under the “Controllers” menu again, select “full keyboard”. Configure more buttons, eg. one for the “k” key, which in OSMC displays the list of recordings.

When you have finished, before removing the Flirc device, choose File -> Save configuration. Save into a file with the suffix “fcfg”. For example, I was using a remote made by Western Digital. I saved the configuration into a file called “wd_remote.fcfg”.

Remove the Flirc from your PC and plug it into the Pi. Press some buttons on the remote to check it out. They should all work as programmed.

Modifying the Flirc Configuration

After checking the control, you will likely want to change or add some buttons. Proceed as follows.

  • Put the Flirc back into your PC
  • Run the Flirc software
  • Select File -> Clear configuration, to wipe all button definitions from the Flirc.
  • Select File -> Load configuration. Choose to load the file saved in the previous section.
  • Make your changes.
  • Select File -> Save configuration. Save to the same file again, overwriting it.

I found that following the above procedure every time avoids confusing situations with seemingly mixed up configurations.

Using different file names, different configurations can be maintained for different remotes. Useful if you are experimenting with several models of remote to see which one is the best, for example. I was testing remotes from LG and Western Digital, saving the configurations into files called “lg_remote.fcfg” and “wd_remote.fcfg”.

Enhancement 6. Use a Proper Power Supply

To make your Pi TV setup function well and reliably, it is necessary to use a power supply of sufficient capacity. With several USB devices attached (TV tuner, USB disk, Flirc, wireless keyboard transmitter), the Pi will consume more current and power than if it were operating standalone. Power adapters sold with some Pi models cannot supply enough enough energy to run all of these peripherals.

If your power adapter isn’t up to the job, the Pi and its USB devices will receive a voltage somewhat lower than the required 5.0 Volts. If this is happening:

  • the Pi’s red LED will flash intermittently instead of being constantly on.
  • A small “lightning bolt” icon might appear at the top right of the OSMC screen.
  • under volt” messages might be seen in the system logs, the output of journalctl, and dmesg.

Any of the above would indicate that a better power supply is needed. In testing, I encountered under-voltage when using the standard Pi 2 power adapter (rated 10 W), and I wasn’t even using a spinning disk. If you want the Pi to function reliably, there are two choices:

  1. Obtain a powered USB Hub. The Hub comes with its own power lead. Plug your TV tuner and disk into the powered hub instead of directly into the Pi. The power draw on the Pi (and its adapter) is thereby reduced, and voltages are maintained to all components. In testing, I found that a powered hub enabled all components to work properly, without any under-voltage, including an external spinning disk. In fact without a hub, the disk did not spin at all.
  2. Obtain a better power supply. If you are not using a spinning disk, and keeping your TV recordings on a memory stick instead, then a powerful adapter will suffice. Leave your peripherals plugged straight into the Pi, and power the Pi with an adapter capable of delivering 15 W or more.

I opted for a version of (2), avoiding under-voltage by employing a 15 W power adapter (actually the adapter that comes as standard with the Pi 4). One small addition: To make the USB-C adapter lead connect to the micro-USB power input on the Pi 2, I used a suitable adapter, this one in fact. It worked fine with a memory stick, but still wouldn’t spin-up a proper disk.

Power Supply Summary: If you want to use a spinning disk for storage, get a USB hub. If you are using a memory stick instead, a powerful adapter will suffice.

Some Power Consumption Tests

In the course of using the Pi as a TV system, it will be necessary to leave the Pi switched on all the time. It has to be left on so that TV recordings can be made at any time of day. That being the case, it is interesting to note the power consumption, from the point of view of both the environment and your electricity bills.

Using a Wattmeter, I obtained the following readings.

Power consumed by the Pi 2 and all components (no spinning disk, no USB hub, memory stick for storage): 6 W. It doesn’t matter what the Pi is doing. It takes around 6W whether you are watching TV, recording 2 channels, whatever. Except that, if completely dormant (no viewing or recording), consumption drops to about 5.5 W. Note that there is no “standby” mode with the Pi. It is on all the time.

Power consumed by the Pi 2 and all components (with external spinning 1TB disk & USB Hub): Around 12 W when fully active, viewing TV and recording 2 channels. 11 W when idle (disk spun down, not watching TV. Note there is only 1 W of difference between a spinning and still disk. The USB hub I used for testing was about 15 years old I suspect not as efficient as a new one would be. For example the hub takes 2.3 W even with no devices attached to it, rising to 5.1 W when you add the disk (which is spinning). The disk itself therefore consumes 2.8 W.

Power Consumption Summary: The Pi TV solution is highly economical & environmentally friendly when compared to other solutions. For example, my Topfield DVR takes 7.5 W on standby (it must be on standby to make timed recordings), 17 W if I am watching TV and 25 W when it is recording. Other hard disk DVRs such as the Humax models, are likely to be similar. The Pi TV solution is rather less economical if used with a spinning disk, at least with my old USB Hub.

Miscellaneous Notes

Why does the above procedure not use a Pi Zero, a Pi 1 or even the latest model of Pi, the Pi 4?

  • Well, the Pi Zero (W) and the Pi 1 will likely be much to slow. They just don’t have the CPU grunt or memory to cope. Although they are still great units and suitable for many less demanding roles, they just aren’t powerful enough to run TVHeadend and OSMC at the same time, and can’t properly function as a media centre.
  • Regarding the Pi 4, it isn’t yet supported by the OSMC project, although it soon will be according to the OSMC blog. After extensive testing with a Pi 4 and manually installed Kodi/TVHeadend, I found it not to be stable enough and has issues with picture quality. The Pi 4 is a powerful beast. It makes the Kodi GUI run almost too fast and, as I’ve written here, you should be able to shift recordings off it at at gigabit saturating speeds. The Pi 4/OSMC is the future. But like that old beer advert says, “it isn’t ready yet”. When the Pi 4 is supported by OSMC this article will be updated.
  • The Pi 3 is fine. However, if you are trying the procedure on a Pi 3A, this will likely not be suitable. The 3A has only half a GB of memory, unlike other models that have a full GB. It will probably work, but be a little slow (I haven’t tested it). If you go ahead, please be sure to add the swap area as described in the section entitled “Enhancement 4”. Also, please come back and leave a comment explaining how successful the Pi 3A was.


32 thoughts on “How to Watch and Record Live TV with a Raspberry Pi

  1. Hi,

    I’ve got an issue with Tvheadend where it fails to record. I click the icon on the far left and select ‘Record programme’ and then get the red circle with the exclamation mark. However nothing appears in any of:

    -Upcoming/Current recordings
    -Finished or Failed.

    Version of Tvheadend is 4.2.8 and I have ssh access to my OSMC on a Rasp Pi 3 B+.

    When I double click on the red circle icon again there is no option to ‘Stop Recording’.

    Which logs should I look at?

    • Hi Roxolanna

      I understand you have followed the procedure and encountered a problem under the section entitled “Record Some TV”. When you click “Record Programme”, you should see a red circle, but not an exclamation mark. The exclamation mark is probably there ti indicate an error.

      Check that TVHeadend, which runs as “osmc” user, has permissions to write into the area used to store recordings. At the point in the procedure indicated, this will be /home/osmc/Recordings. Just log into your Pi as osmc user and try to create a file under there.

      If you are storing recordings elsewhere, perhaps because you have added storage, just login to the Pi as osmc, go to that area and try to create a file.

      To answer your question about logs, they are at /home/osmc/.hts/tvheadend/dvr/logs. The most recent file in that directory should contain information about your (attempted) recording.

      After clicking

  2. Hi Jim,

    Thanks for the reply. Ultimately this has been resolved by installing OSMC as you suggested NOT by using Noobs which also includes OSMC. I followed all the other steps in your article and it now works a treat. My fault for thinking the Noobs version of OSMC was the way to go.

    I have a SSD drive attached to my Pi and OSMC and Tvheadend both record to that no problem.

    Will be looking forward to testing a Pi 4 in the future.

    Until then…thanks again!


  3. Pingback: Install Freeview Channel Logos for OSMC/Kodi | Unix etc.

  4. Pingback: How to Install Comskip on a Raspberry Pi | Unix etc.

  5. Pingback: How to Enlarge Kodi Fonts | Unix etc.

  6. Great tutorial! I have a similar setup.
    A headless Pi4 1GB, running Raspbian lite as a backend server (installed tvheadend from pi’s repository).
    2 Haupauge 292e tuners (same as yours but single) attached to a usb hub, feeding tv signal into the pi.
    For storing recorded programs, an external 2TB 2.5 inch hdd plugged into and powered by the pi4’s usb 3.0 port.
    For watching live tv and playback recordings, several other pi4’s, laptops, phones running libreelec mediacentre or kodi.

    It’s been fine so far. There are continuity errors here and there, but those are likely down to reception issues, and have lead me to use SD more than HD freeview channels.

    Thanks for highlighting the memory leak bug, and the swapfile workaround. I wonder if the more ram of 2GB and 4GB models of pi4 will encounter this problem or not.

    The 2GB ram model of pi 4 has dropped in price to 35£/$ so I would personally recommend making a pvr with that. It can pass more current through it’s USB ports, so it can power a 2.5 inch hdd/ssd. As I added a couple of tuners on top, I opted for a self-powered hub for those.
    Pi 4 also has better performance so faster channel changes, and the USB 3.0 ports allow more volume and faster throughput of recorded programs, if several clients are using it.
    Of course, using a pi4 to stream tv would mean leaving the excellent osmc… but libreelec has been great (as tvheadend client, i’ve not tested it as server) .

    Thanks again for your post. It’s gonna help lots of people

    • Hi snowballearth. Interesting. You say the Pi4 is changes channel quickly. How long does the slowest channel change take? My setup takes up to 4 seconds. I thought this was down to the tuner itself having to re-tune, rather then the Pi.

      • Sorry, my bad. Channel changes may not be faster.
        Since upgrading the backend tv server from pi 3 to pi 4 i haven’t noticed much change in channel change speed.

        Overrall frontend Kodi experience is slightly snappier on a pi4, but dunno if that makes it a worthwhile upgrade as a htpc.

        • No probs. Yes, I found the Pi4 made the UI much faster. But with tuners connected, there were persistent issues with picture quality. It isn’t officially supported by OSMC but soon will be, according to their blog.

          I used a Pi4 as a remote Kodi client (ie. no tuner connected), and in this role it worked extremely well for viewing TV and recordings, even over the Internet.


  7. Pingback: Install Docker on Raspberry Pi | Unix etc.

  8. Hi,

    firstly thank you very much for what I have found to be the best guide for the whole procedure so far anywhere on the net 🙂

    I have been running OSMC on a pi3 ModelB+ with a Pi TVHat which works very well

    However under your configuration, when it comes to EPG grabbers, I’m struggling with the HD TV channels getting information. Further to that problem, in your EPG config section, where it says: “Select Configuration tab -> Channel/EPG tab -> EPG Grabber Modules tab. A list of about 13 “grabber modules” appears on the left.” – I don’t have that tab showing.
    My TVheadend version is showing as 4.2.8 which I understand to be latest stable version? I checked for updates through OSMC also.
    I just wondered if you could shed some light on this?

    (As a workaround I have temporarily told TVheadend to use the non-HD version of the channel for the EPG information, but it would be nice to fix this properly)

    Thanks again, Lozzy

    • Hi Lawrence,
      Thanks, glad to hear you’re finding the procedure useful. In TVHeadend 4.2.8, you can’t see the “EPG Grabber Modules” tab under Configuration tab -> Channel/EPG tab.

      I’m running 4.2.8 too, and the “EPG Grabber Modules” tab appears exactly as described. Perhaps the user interface view is not set to “Expert”? Did you remember to set it as per the procedure ? (3 paragraphs above, “Show all Settings).


  9. Hi, Thank you for a well written comprehensive piece. I am reading this as a refresher as I used a Pi with Kodi connected to a Panasonic TV some years ago and wish to do it again. I never used a Pi keyboard or remote as the HDMI-CEC link using the TV Remote worked perfectly.

    • Cheers Russel. I might have tried the same, except that my TV is quite old and doesn’t have a CEC function.


  10. Great source of setup information which I hope to soon be able to use.

    However, I live in France so some of your comments may not apply to me?? Further to my setup, it is OSMC/KODI latest update on Pi3B. KODI is populated with ripped content from our music CD’s and a few video DVD’s currently stored on an external250 GB SSD. We have a satellite dish which is connected to our Canal+ decoder for “normal” TV watching. We do not have an external TV antenna. We have good internet service (5GB/40GB).

    Let’s start with the USB hardware tuner, how can I know/tell if it will work in France with either the dish, the internet and/or an antenna? Is it possible to split the coax line/signal coming to the Canal+ decoder for use with a USB tuner?

    I believe your document was mostly considering receiving content via an antenna? Will we be able to get TNT content here via an antenna?

    Finally, can content be gotten from our Internet connection? Is that practical?

    Thanks in advance for your thoughts….RDK

    • Hi Rob. I’m not familiar with French TV services and can’t advise what Tuner will work there, unfortunately. You will have to do your own research on that. The tuner mentioned in the article picks up satellite as well as DVB-T and DVB-T2, but I don’t know if it would work in France.

      I don’t know if it is possible to split your coax, not being a satellite TV user. I know you can split terrestrial TV coax, but you are also halving the signal strength so sometimes an amplifier is needed.

      I don’t know what “TNT content” means, so can’t advise on that.

      Regarding Internet content, OSMC/Kodi is very flexible and you can receive Netflix, for example, by adding a plugin (I do). It is also possible to play video files from around your network and direct from the internet with (for example) the Yatse add-on, which allows you to “cast” videos from your phone or tablet to the TV (eg Youtube, BBC iPlayer, Vimeo etc).


  11. Jim,
    Great write-up. OSMC is still not available for Pi4 and no TV HAT for Pi4 has appeared. In the UK the commercial recorders are hampered by DRM legal requirements and encrypt HD recordings. This is a very big win for Pi/TVHeadend enthusiasts since you can build up a video library without worrying that your precious PVR dies before you have chance to watch it all – I’d certainly edit that fact into the original piece. If my own Humax (which runs the community software) dies, I’m probably going for the quad HDHomerun network tuner (but not it’s EPG service). Cheers

    • Cheers Martin. OSMC was made available for the Pi4 a few weeks ago , according to the OSMC Blog. You can install it on a Pi4, but there isn’t a published Pi4 distribution yet, somewhat confusingly.

      The article above is for free channels only, like Freeview. I wasn’t aware of the DRM issue with UK commercial PVRs. I guess that is for non-free services – wouldn’t the same restrictions apply to the Pi/OSMC ?

      The HD Homerun looks nice with it’s four tuners, albeit yet another bit of kit to depend on/maintain. Hauppauge have just brought out a quad USB tuner too, but for the USA only, so far. Hopefully they will bring out a UK version and I can add it to the article.


  12. Hi Jim,
    Great write-up, a good read. I’ve been using a couple of Pi3B+ devices, one of which sports an OSMC Tuner for a year or so. Target is FreeView from the Crystal Palace & Sandy Heath transmitters, I’m at the fringe of coverage for both. System generally works very well. The tuning and EPG are something that I come back to periodically, particularly after re-shuffle of the channels. I echo Lawrence’s comments re the lack of EPG grabber selection. I am using the same version of TVheadend as yourself and Expert view. Can’t paste a snip, but what I see are drop-down menus for General Configuration, Internal grabber & Over-the-air grabbers. No list of grabber modules.
    I have also found the issue where the content of the HD channels does not get populated in the EPG.
    Just interested in your thoughts?

    • Hi Mark

      Thank you. I’m on the Sandy Heath transmitter, perhaps 25 miles from it, and the system works well.

      Regarding grabber modules, I am not sure what to advise. On my configuration, the tabs appear just as described. I select “Configuration” tab, then in the row of tabs underneath, “Channel/EPG tab” and then, in the third row of tabs, the “EPG Grabber Modules tab”. A list of 13 “grabber modules” then appears on the left, containing two “external” grabbers and 11 “over the air”. I’m not sure why it appears differently for you.

      About HD channels not being populated in the EPG, I haven’t experienced that, and presume it is linked to the issue with configuring grabbers. Hope you get it sorted.


  13. Thanks for the response Jim.
    EPG Graber Modules issue sorted. It was hiding in plain sight! I suspect that I was looking at the similarly named “EPG Grabber Channels” or “EPG Grabber” and just blind to “EPG Grabber Modules”. Full selection available and “Over-the-air. UK: Freeview” now selected. Thanks.
    I’ll post back if I find an answer to the EPG for HD channels. It will be interesting to see if the above change helps?

  14. EPG for HD channels is now populating correctly. Seems to be the answer to a number of peoples’ problems that I have seen posted on various Forums. Thanks for the lead.

  15. Hi Jim
    Good write up, I’m getting there slowly. I had the same problem as others with the EPG Grabber section not being visible. Eventually after much wailing and gnashing of teeth I discovered that I had to go into the Configuration/User tab, select the user omsc and click edit. In the edit box go to the Expert Setting section and change the User interface level to Expert and save
    I could then see the EPG Grabber Modules tab.
    Any Idea’s on customing the order the channels display in, I like to recreate my channel order from my Toppy

    • Hi Jimi. Nice to meet a fellow Toppy user again. We haven’t spoken in a while. Anyway, your view mode should have been set to “expert” if you followed the paragraph entitled “Show all settings”, 3 or 4 paragraphs above the stuff about EPG Grabbers. To stop other people having the same trouble, I’ve added a new note in the article (just after the EPG grabber bit).

      About the channel order, I don’t think it can be customized. The choice seems to be between channel number, channel name (ie alphabetical) or “last played”. To access these, scroll left in the EPG until you get into the options section (a “slider” that comes in from the left).

      I tend to use channel number. The “last viewed” order is too confusing, and alphabetical order isn’t satisfactory either, although it does group similar channels together, like BBC1 and BBC1 HD. I also select to use channel numbers from the back end ie. the original channel numbers from TVHeadend. That last option is configured somewhere else, probably in settings for the TVHeadend HTSP Client Add-on


      • Thanks for replying, it has indeed it’s been a while, I followed your reports on with interest, I already had a Pi 3b setup a remote interface for my main Toppy,
        I got given 3 Pi’s (3b’s) and have gradually acquired all the other bits and pieces to progress this project. Covid+lockdown hastened my retirement so I now have plenty time to play.
        I thought I had followed the “Show all setting” paragraph but must have gone astray somewhere, no matter, got there in the end, all the playing about has taught me a lot about TvHeadend.
        I’m also using channel number from backend for sorting, couldn’t find any option for a custom sort order, although there is an option in the backend to customise the channel number, which according to the help section is only used for channel sorting in the GUI. I’ll probably clone my sdcard and give it try. Do you know if there’s any way to customise the Kodi interface ? I’d like to remove or hide some of the tabs in the TV display ie just have one tab with tv channels (no radio, sd or hd) ?
        Just about to move on the enhancements. Looking at using a Sky remote with a Flirc for remote control and a usb hdd for storage.

        • Hi Jimi,

          Yes, I wonder how many other Toppy users and contributors have found the Pi to be a suitable upgrade path. From the forums, it seems they have gone a variety of ways, eg. Humax. It takes a bit of time, this OSMC stuff. In you case, COVID/retirement provided it. In my case it was a work break due to ill health (now recovered and working again).

          Anyway, regarding the Kodi interface, I would also like to remove those “tabs” in the EPG, but there is no way to do it I know of. This kind of thing isn’t part of Kodi as such. It is part of the “skin”. Changing the skin is something I cover in the enhancements (making fonts bigger), but not customizing tabs.

          Sky remote with a Flirc sounds good. Regarding storage, an external HDD would work well, though you will need to power it with an external supply or powered USB hub. I opted for a 512GB SD card in the end. Bit expensive but its nice th have something silent that reacts immediately.


  16. Regarding changing the user interface level, I’ve found out how I went wrong. If you go to Configuration tab -> General tab -> Base tab. there are two places you can change the level, I was using the drop down menu (view level) on the right of the toolbar to change it to expert and saving, that doesn’t work, it looks like it changes but as soon as you change tabs it goes back to basic. It needs to be changed on the left under the Server heading.

  17. Pingback: Install Freeview Channel Logos for OSMC/Kodi | Unix etc.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.