manuals:hardware:dvb-gnu-linux

Watching TV over the air on GNU/Linux

The Dutch public broadcasting authority allows us to stream public TV channels from their web site. However, those streams have some downsides: they're often laggy and low-bandwidth, but the biggest problem is that they require people to install either Widevine, Flash or Silverlight, all of which are pretty horrible security risks. (Yes, there are ways around this with youtube-dl and mpv, but they may break on any occasion.)



To watch those channels without having to install malware, the first thing that came to mind was DVB-T, which transmits the public TV channels as free-to-air streams. One problem: DVB-T reception requires a TV. It would be nice to watch those streams on displays already there: computer monitors connected to Debian machines.

Enter the Realtek RTL2832. The GNU/Linux support of TV tuners is generally very decent, so you shouldn't worry too much about incompatibility. Firmware blobs, however, are often needed. But the RTL2832 does not require any blobs. All you need is a little antenna near a window and you're set.



Watching DVB streams doesn't require a lot of special software: merely VLC and the dvb-apps package.

sudo apt install dvb-apps vlc vlc-plugin-zvbi

Scan for channels:

scan /usr/share/dvb/dvb-t/nl-All -o zap -x 0 | tee channels.conf

This creates a channel list in the working directory. (Needless to say, the nl-All file should only be used if you live in the Netherlands. Channge it accordingly.)

On some GNU/Linux distributions, you may encounter a message like “ERROR: cannot parse'[CHANNEL]”. In that case, you have to use the legacy channel lists:

scan /usr/share/dvb/dvb-legacy/dvb-t/nl-All -o zap -x 0 | tee channels.conf

If you have an RTL2832 on a recent kernel, scanning might fail or not return anything if you have the rtl2832_sdr module loaded. So unload it first:

sudo rmmod rtl2832_sdr

The output of a correct channels.conf file looks something like this:

NPO1:474000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_1_2:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:7011:7012:1101
NPO2:474000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_1_2:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:7021:7022:1102
NPO3:474000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_1_2:FEC_1_2:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_4:HIERARCHY_NONE:7031:7032:1103


Once you have a list, you can simply drag the channels.conf file into a VLC window, which automatically converts it to a playlist. Press Ctrl + Y and save it as ~/Videos/TV.xspf (or whatever), and all you have to do is click the playlist and switch channels with the Previous / Next buttons.

If you're looking for a fancier GUI solution, you might want to check out MeTV. It can scan for channels on its own, but you can also import your channels.conf file. MeTV offers EPG viewing and MPEG stream recording (including timers).