Raspberry Pi Freeview PVR and TV streamer

I’ve had a cheap USB SDR stick sitting in my Amazon basket for… about 2 years. I finally got round to buying the thing.

What is an SDR? It’s a Software Defined Radio – a radio tuner that allows you to listen to analogue broadcasts over a wide range of frequencies and – with the right software – watch and record digital TV. As soon as I got my chunky blue stick – a NooElec R820T2 – I plugged in its little antenna and installed the gqrx radio receiving software on my MacBook. Having grown up in a ham radio-filled household, this was quite nostalgic tuning different bands looking for stuff. The USB stick uses a common chipset and works as a normal FM radio tuner with RDS, but pretty soon I had stumbled upon Heathrow Approach and could listen to radio chat from the cabins of planes flying over my house and later I found some OB frequencies used by ITN (nicely idented) and I assume the BBC (at least I think that’s why I was hearing Radio 2 on some VERY strange frequencies!). You can do all sorts of other clever stuff with SDRs like receiving weather maps and plotting aeroplane and boats on maps. VERY annoyingly I can’t find any Mac software for decoding DAB radio, though you can do this on Windows and Linux machines.

gqrx is available in an experimental version for the Raspberry Pi but I haven’t got it working very well yet – it seems much noisier than it did on the Mac (possibly because I’m in a different room), I had to run it using a -r command line switch to get round a bug where the waveform didn’t show and RDS doesn’t seem to work. Nonetheless on the left here you can see me listening to planes on the Heathrow approach frequency. The ‘waterfall’ is useful for spotting sporadic transmissions on adjacent frequencies.

What I did get working was a Freeview TV tuner and server on the Raspberry Pi. I can now watch live TV & radio off air on my Pi (admittedly not full screen) – and possibly even more usefully, the Pi will stream TV to other devices on my home network, so I can watch live TV in a browser or using VLC on my laptop anywhere in the house.

I even managed to schedule a recording on my MacBook which was recorded as a .ts (transmission stream) file on the Pi – this is the format used by PVRs and can be played in VLC (and converted to a more compact, portable format using other apps too.)

How did I get this working? Glad you asked me that. I finished at about 1am and I didn’t take notes. It involved a lot of fiddling in a studio-managerly fashion. Here’s roughly what I did…

First I installed tvheadend on a RaspberryPi 3. I used this guide – but I had to change quite a lot when it came to configuring it as they set up a satellite TV receiver and I am just using Freeview. For example, I chose DVB-T as my network type:

Tvheadend comes pre-populated with a list of digital TV networks all over the world – luckily I live close enough to Crystal Palace to be able to receive Freeview with a damp piece of string for an aerial (as my late dad G3NXU would say). I suspect if you live further from a transmitter you may find the supplied telescopic antenna pretty useless.

I didn’t have to add any muxes manually as they did in the guide I followed, but I did have to go back to the TV adaptor page and re-enable it before it started scanning muxes and allowed me to then add channels.

Once I’d added the channels I was a bit stuck. I knew tvheadend is a server so on my MacBook I pointed a web browser at the IP address of the Pi on my home network using http://IPADDRESSOFPI:9981/playlist/channels - and straight away BBC1 started playing on the MacBook!

I subsequently found you can view the EPG by browsing to http://localhost:9981/ on the Pi, schedule recordings, and even watch live TV in a browser window.

I found it more useful to use VLC, however. On the Pi just install and use VLC to open a network stream and use http://localhost:9981/playlist/channels as the URL – on another machine on your LAN use http://IPADDRESSOFPI:9981/playlist/channels.

VLC allows you to de-interlace video (improves the appearance of movement), switch audio soundtracks (for example to hear audio description) and turn subtitles on and off. On the Pi itself it couldn’t render video full screen at the same time as decoding and streaming, but clients on the LAN like my MacBook could. The largest I got the picture to play reliably on the Pi was a bit bigger than quarter size, but smaller than half size. (These cheap USB SDR sticks don’t decode HDTV by the way).

I think the NooElec stick provides a great deal of fun for £15 – £20 – there may be better ones you can buy now however. It’s also VERY chunky and blocks all but 1 USB port on the Pi3! I love the idea that such a cheap device opens up a world of radio and data reception, giving me access to TV channels that can’t easily be streamed online as well as schedule recordings and play live TV on laptops and mobile devices anywhere in the house. It could also bring TV and radio to situations without internet access. And there must be some exciting possibilitiesfor all that EPG data – a bot that tweets automatically when a certain program is about to start?

As I type this on the same Raspberry Pi I am listening to BBC 6music off Freeview on the same device – not how the processor is being thrashed… ;)

This entry was posted in BBC, computers, radio, Raspberry Pi, Raspbian, TV and tagged , , , , , , , , . Bookmark the permalink.

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>