Sunday, 3 September 2017

Raspberry Pi DVR - Streaming TV over the LAN

In our house we have a TV in an area where we don't have an aerial socket.  We hardly ever watch live TV any more anyway as we have an Amazon Firestick -  so it's not been that much of a problem.

Occasionally, however, we want to watch something that's live and no all the channels have 'Watch Live' as an option on their app. (Channel 4, I'm looking at you!)

So, last week I was reading the Pi Hit's blog and saw a short note about a DVR project that can stream live TV over the local LAN.   Just what we needed.

The note linked to another blog by Giles Booth who is a Raspberry Pi-certified Educator.

In his blog he described using a cheap USB TV adaptor, and some software called "TVHeadEnd" to build the streaming device.

I already had a USB TV tuner that I bought years ago from a small computer shop in Bude, Cornwall when I was on holiday there, so I thought I'd put all the pieces together and give it a try.

Following the instructions by Giles' blog, I used a guide on yet another blog to install TVHeadEnd on the Pi 3, although that blog says how to use it for Satellite TV.

So, once it's installed, I reverted back to Giles' blog, which said how to set it for Freeview.

A few minutes of fiddling around and it was working!

The EPG loaded pretty quickly and I could select programmes to watch - although by default it just downloads an m3u file. I initially tried this on my mac, and m3u playlists automatically open in iTunes which really didn't handle it well at all and in fact appeared to crash the Pi to the point I needed to hard reboot it.

Switching to my Windows laptop, which has VLC installed, and the result was a lot better as you can see from the screenshot below

Not bad so far! Homer Simpson even looks slightly impressed. 

So that's the main streaming part done, now for stuff that can play the stream.  Obviously there's the PC VLC method that I've already tried, but I want it on the Amazon Firestick so we can watch it on TV.

Initial results at finding a Firestick compatible player resulted in either dead ends or extremely irritating site-loading hacks to get an app installed, so instead I had a look to see if I can find an Android app to play it so I can just use screen mirroring from my phone.

This resulted initially loading VLC and pasting in the direct URL of the stream, which worked fine but involved major faff of going to the EPG on the PC, finding the stream, downloading the playlist file, opening it in notepad, sending the stream URL to the phone, pasting it in to VLC and pressing load..  Far too much effort to make it usable.

Then I found TVHClient - a specific Android TVHeadEnd client app - and that worked brilliantly

Icons! Gotta love an icon! 

And that's the current state of the project - working but not 100% ideal.  The Pi crashes if you open the admin interface on more than one browser, and occasionally TVHClient can't connect unless you restart it, but it's not bad for a couple of hours work.

No comments:

Post a Comment

Concatenating CSVs the easy way

I was recently asked how to 'merge' a few CSV files into one, and if there was a script or tool that could do that. Lets say you h...