Yesterday Raspberry Pi released the new Raspberry Pi TV HAT, a DVB-T2 Digital TV receiver add on for the Raspberry Pi.

We created a step-by-step user guide to help you set up the HAT and create a Tvheadend server for streaming Digital TV to devices on your network.

Today we're going to show you how to combine that Tvheadend server with your Raspberry Pi Plex server to allow you to access your Digital TV streams via Plex! This means you can access all your local media AND the Digital TV streams from your TV HAT in one place - within Plex!

The best part? You can run everything on a single Raspberry Pi - the TV HAT, the Tvheadend server and the Plex server. You can even watch your Plex streams on the same Raspberry Pi as well (we'd advise the latest Raspberry Pi 3B+ for this)

Assumptions and Prerequisites

Before we start, we're assuming that you have the following:

A Raspberry Pi Plex server

A Raspberry Pi with a TV HAT attached, with a Tvheadend server installed on Raspbian Stretch (on the same Raspberry Pi as the Plex server). Don't worry, you can follow our Raspbian/Kodi step-by-step guide here!

A basic understanding of Plex and Tvheadend

Your Plex server doesn't have to be on a Raspberry Pi, however that's the scenario for this guide.

You also don't have to put your Plex Server and Tvheadend server on the same Raspberry Pi.

Instructions

Tvheadend configuration

The first thing we need to do is make some changes in the Raspberry Pi Tvheadend server so that it can talk to your Plex server.

Open your Tvheadend server by navigating to the following URL as per our user guide instructions:

http://raspberrypi.local:9981

Navigate to Configuration > Users > Passwords and click the 'Add' button:

In the dialogue box, enter a username and password (make a note of these) and click 'Apply'.

The Plex server will be the 'user' and this is part of how we give Digital TV stream access to Plex:

Next, navigate to Configuration > Users > Access Entries and click on the 'Add' button:

In the dialogue box, within the 'Basic Settings' section, do the following:

Enter a username (we're using the same as the password username above)

Tick the 'Web interface' box

Set 'Streaming' to Basic

Set 'Video recorder' to Basic

Click 'Apply'

Plex plugin installation

We now install a plugin in Plex which allows our Tvheadend server to talk to our Plex server. This plugin is called LiveTVH.bundle.

Navigate to the Plex plug-ins directory by typing the following command and pressing enter:

cd /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Plug-ins/

Next, we clone the plug-in's GitHub library using the following command, followed by enter:

sudo git clone https://github.com/taligentx/LiveTVH.bundle

To check that the plug-in has arrived, use the following command to list the contents of the directory:

ls

We should see 'LiveTVH.bundle' as per the screenshot below:

Now we restart our Plex server with the following command, again followed by enter:

sudo service plexmediaserver restart

Wait around 15 seconds, then launch your Plex server in a browser (refresh your browser if you already had Plex open).

Plex plugin configuration

We need to add some information into the Plex plug-in we just installed, so that it can receive Digital TV streams from the Tvheadend server.

In Plex, navigate to the Plugins section. You should see the LiveTVH plugin icon:

Hover over the icon until a yellow settings gear icon appears. Click on the gear:

In the plugin settings box, add the following:

In the address port field, enter your Tvheadend server's IP address in the format http:// IPADDRESS :9981

:9981 In the username field, enter the username you set up earlier in Tvheadend

In the password field, enter the password you set up earlier in Tvheadend

Click Save

Using Plex with Tvheadend Digital TV Streams

We're now ready to start watching our TV HAT Digital TV streams through Plex!

Navigate to the Plex plugins section and click on the LiveTVH icon. You should see a list of channels and the current playing programme:

You can change this to poster view by clicking the box/menu icon in the top-right corner.

We quite like the poster view: (Note: Plex scrapers try their best with live TV, but sometimes there just isn't a cover image available)

Once you've found a programme you want to watch, hover over the item/poster and click the small orange icon (this may be slightly different for other Plex devices).

Here's a screenshot from the Plex browser player we're using:

That's it - enjoy!

Important Notes

Please remember that this isn't an official method of using the TV HAT and Tvheadend with Plex. That's because...there is no official method!

As a result, we can't guarantee how well or for how long this will work. That aside, it's working great for us at the time of writing.

Plex does not officially support the Raspberry Pi TV HAT, hence why we're using plugins to achieve Digital TV streams in Plex.

You may find that HD Digital TV streams streaming through Plex either don't work at all or don't work well. Every individual setup will have different channels, signal strengths and LAN speeds.

You may need to configure Tvheadend 'channel tags' to enable some streams to play in Plex due to the different codecs and resolutions broadcasted. You can read more about that in the plugin GitHub repository notes section. We didn't experience any issues with the channels we tested.

Plex does not provide options to flag a stream as interlaced - you may experience artefacts on Plex clients that do not support deinterlacing.

Links & further reading

Raspberry Pi TV HAT

Raspberry Pi TV HAT Guide

LiveTVH.bundle GitHub Plugin

Plex

Tvheadend