DIY Entertainment

How to Record and Stream Live TV With Raspberry Pi

Ben Stockton 27-02-2019

Watching live TV seems old school in the Netflix era, but you can’t always find every show or movie you want on a streaming service. The alternative is paying out for cable or satellite TV, and who wants to do that?


Thankfully, if you’re in a country with terrestrial TV broadcasting, you can cut the cord and record live TV to a network DVR with Tvheadend instead, running on a Raspberry Pi. Here’s how you do it.

What Is Tvheadend?

Tvheadend is a streaming server for live TV broadcasts. It can handle streaming and recording over-the-air terrestrial DVB-T/T2 broadcast TV, like Freeview in the UK. It can also handle other forms of TV streaming, including cable (DVB-C), satellite (DVB-S and DVB-S2), ATSC, and IPTV.

This guide will focus on using Tvheadend with a DVB-T/T2 tuner for over-the-air terrestrial TV, but many of the instructions for setting up Tvheadend will remain the same if you prefer to use Tvheadend to record TV from other input sources.

What You’ll Need

To set up a Tvheadend DVR, you’ll need the following:

  • Raspberry Pi 2, 3, or 3B+ with Case
  • MicroSD card with Raspbian installed
  • A high-quality power supply (5V @ 2.5A)
  • A USB DVB-T/T2 tuner for OTA TV reception or a Raspberry Pi TV HAT
  • A DVB-T/T2 antenna
  • Another PC, for SSH connections, with an SSH client installed

The Raspberry Pi Foundation released a Pi TV HAT which uses the Raspberry Pi’s GPIO pins Everything You Need to Know About Raspberry Pi GPIO Pins The Raspberry Pi is a fantastic little computer, but what do the GPIO (General Purpose Input/Output) pins do exactly? In short, they open up a whole world of DIY electronic tinkering and invention. Read More to become a DVB-T2 receiver. If you don’t have one of these, you can use a typical USB DVB-T/T2 tuner instead.


Step 1: Preparing Your Raspberry Pi

You’ll need to install an operating system onto your Raspberry Pi first; this guide will assume you’ve flashed the latest version of Raspbian Lite onto a microSD card and your Pi has internet connectivity. It’s also a good idea to run the usual commands on first boot to update your Pi and change the default password:

sudo apt update
sudo apt upgrade

If you haven’t already, after you’ve flashed your microSD card, add a file named ssh without a file extension to your boot partition. This will enable you to connect via SSH. You’ll have to check your Pi’s IP address, which you can do using a network monitoring app 6 Great Android Networking Apps to Monitor, Ping, and More Your Android phone can act a powerful network management device with these six apps for diagnosing, monitoring, and more. Read More on your smartphone.

Once your Pi boots, plug your DVB-T/T2 tuner into your Pi (or attach to the GPIO pins, if you’re using the HAT) and connect via SSH. Confirm that your USB tuner is working:


Assuming that it is, check that the firmware for your tuner exists and loads:

dmesg | tail | grep dvb

If the command returns nothing (or there are no errors), your DVB-T/T2 tuner should be ready. If the command returns log snippets that suggest your firmware can’t load, or the firmware files you need are missing, you’ll need to download them.

A Git repository from the developers of OpenELEC, a Linux media center distro, contains a large number of firmware files for various tuner chipsets. To install these onto your Pi, run the following commands on your terminal and reboot:

sudo apt install git
git clone
cd dvb-firmware
sudo reboot

Step 2: Installing Tvheadend

To install Tvheadend and any additional packages, type:

sudo apt install tvheadend

Type Y and hit enter to agree to installation. As it begins, you’ll need to provide a username for Tvheadend for administrative access once it’s installed. Type a suitable username in, then hit enter.


You’ll need to provide a password, so type one in and hit enter. A final menu provides information on what to do once Tvheadend has installed to access the web interface on port 9981; just hit enter to continue installation.

Step 3: Configuring Tvheadend

With installation complete, open a web browser and go to http://YourIPAddress:9981 replacing “YourIPAddress” for the IP Address of your Pi. Use the username and password you created during installation to gain access.

Tvheadend Web Initial Setup

Select languages for both the web interface and the EPG (electronic program guide, for TV listings) and click Save & Next.


At the next menu, unless you plan on allowing access to Tvheadend outside of your internal network, and assuming your IP address is in the range, type under Allowed Network. You can also provide additional usernames and passwords for a standard administration and standard user account; fill in the username and password sections, as required, and then click Save & Next.

The next stage configures your tuner. Tvheadend should already detect your DVB-T/T2 tuner; for my configuration, this was listed under Network 2. Select the network type as DVB-T Network. Again, click Save & Next to proceed.

To get your tuner to scan for the right channels, the next menu has you choose”pre-defined muxes” which are lists of appropriate frequencies to scan. Search the list for one that corresponds with your country and area. As I live in the UK, I used this search tool from the BBC to locate the transmitter closest to my location.

Once you’ve selected one, hit Save & Next to continue.

Tvheadend Web Config Channel Scanning

This will start a scan for channels operating on the frequencies from your chosen transmitter. Let it run through until the progress reaches 100%, then click Save & Next.

The next menu will have options to map these services to channel names that can be understood by media players. Check the checkboxes for Map all services, Create provider tags and Create network tags before hitting Save & Next.

Once you’ve done that, your Tvheadend installation should be complete, with channels matched to services being broadcast in your area. Just click Finish to close the configuration pop up.

Step 4: Stream or Record TV

With Tvheadend installed and configured, you can now get to the fun part—watching or recording TV. You can use Tvheadend to stream to media players like Kodi How to Use Kodi: The Complete Setup Guide Our beginner's guide shows how to install the Kodi software, how to navigate through the initial setup, and how to load add-ons. Read More , to your phone or tablet using apps like Tvhclient, to your PC using VLC, or through Tvheadend’s web portal itself.

If you want to quickly load your channels into VLC to test, type the following into your web browser to download a playlist for streaming, replacing the username, password and IP address with your own:


To record TV through the web portal, search for content under the Electronic Program Guide and click the first icon (with an “i” symbol) to show information about it.

Tvheadend Web Recording Pop Up

To record a show, select Record program. Select Record series if you want to record episodes of a TV series automatically.

Record and Stream Live TV to Your Entire Home

Thanks to Tvheadend, you can do away with costly TV and streaming packages. Using a Raspberry Pi, you can stream media content, whether it’s live or pre-recorded, to all of the devices in your home, cutting the cord for good.

With your network DVR ready, it’s time to take your media ambitions further, so consider building yourself a media center PC How to Build a Great Media Center PC Looking for a media center? read all about the different hardware components, best places to buy them, software candidates and media extenders, in this ultimate guide! Read More to stream your favorite TV shows and movies in style (and without the buffering). You can even build an Android TV box with your Raspberry Pi How to Build an Android TV Box With a Raspberry Pi Want to cut the cord and save money on TV? Build your own Android TV box! Here's how to install Android TV on a Raspberry Pi. Read More to enjoy the benefits of popular Android-based streaming apps.

Related topics: Cord Cutting, DIY Project Tutorials, DVB, DVR, Raspberry Pi.

Affiliate Disclosure: By buying the products we recommend, you help keep the site alive. Read more.

Whatsapp Pinterest

Leave a Reply

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

  1. Larry
    August 29, 2019 at 10:16 pm

    "The next stage configures your tuner. Tvheadend should already detect your DVB-T/T2 tuner"

    I have an atsc usb tuner, is this likely to detect and configure this automatically? Windows 10 wasnt able to..

  2. David
    May 29, 2019 at 3:07 am

    Oh geeze... I had no idea what you just said. I am not a tech savvy person so I need your expertise. I have a Tivo Roamio Plus with a lifetime subscription and I watch live TV and record TV shows with my Tivo. I really like using Tivo. It's very simple. Recently my roommate told me I might be able to get a Raspberry Pi, connect it to my modem/router and "perhaps" use it to watch my Tivo shows without commercials for the rest of my life? Is this possible? If possible, please let me know what steps I need to take to do so.

  3. Will
    February 27, 2019 at 5:10 pm

    Is there any way to do this via the internet?
    I have a place with terrible DVB-T reception. could I place the receiver at one place and stream tvheadend via the internet to the other place?

    I'm thinking of something along the lines of a VPN tunnel to connect the two.