This is part 2 in our multi part series about how LocalTV+ is made. If you haven’t seen it, part 1 covers the way the non profit is set up.
Today, we will talk about how we acquire TV signals and prepare them for retransmission. This will talk a lot about the way we get signals in Boston as well as details of the American digital TV standard, ATSC .
ATSC
ATSC is the American broadcast TV standard. It replaced the older analog NTSC standard with the digital when the transition completed in 2009. At the moment there is a movement to ATSC3 also called NextgenTV. We do not use ATSC3 because it is DRM encrypted with Google’s Widevine DRM and there is no hardware other than a handful Android tv boxes that can receive ATSC3.
First thing to note is ATSC is a very old standard going back to the original release in 1990. As a result the requirements decode the video stream are very very low. The video is encoded in MPEG2. By modern standards the videos this produces are very big and very inefficiently encoded. Thankfully it also means nearly anything modern can handle it with ease.
Acquiring the signal
We use a single Televes 14883 antenna mounted on the roof of a building in Brookline, MA. It is high enough up and and has a clear line of sight to most of the TV broadcast towers which are in Needham, MA. This is a very good antenna and it also picks up some very weak channels like MeTV Toons and several Providence stations. This antenna has a 5g/LTE filter built in. This matters in Boston because if you do not have it, certain channels like Fox (WFXT) receives a lot of interference due to its proximity on the spectrum. If you own an antenna and regularly get interference on your channels adding a cheap filter like this may change your life.
Computer hardware
Above I mention how the video standard is very old. We use an old Dell desktop computer from 2012 running Ubuntu Linux I had lying around to power this entire service. It is more than capable for this task. To actually receive the ATSC1 signal on the PC we need specialized (but very cheap) hardware. These are TV tuners. We use a combination of multi tuner cards and USB tuners we acquired on eBay. ATSC1 tuners aren’t really made much anymore but eBay is full of them. We have a few WinTV 950Q single usb tuners that go for $15-$20. We also have WinTV HVR 2250 PCIE cards that have two tuners and go for $30-$40. Since we would quickly run out of PCIE slots and USB ports doing this one at a time, we also have a TBS 6704 quad tuner card . How many tuners you need really depends on how many channels you want to offer. Many channels are broadcast along with other channels and can be picked up by a single tuner. An example of this would be WHDH and WLVI in Boston. But usually it’s a safe bet that HD channels like CBS, ABC, FOX, NBC will all need a tuner each. Along with them you get sub channels like MeTV which are in SD. If you look at the rabbit ears report you can see in Boston, MeTV comes with ABC. So this would only require a single tuner to get both.
Now that we have the antenna, filter and tuner all hooked up to a computer we need some software to actually read the TV signals. For this we use an open source software called TVheadend. It will scan for channels and publish a url with MPEG2 streams for all of your channels. In addition it will pick up the TV guide data that the stations publish along with the TV signal. TV headend publishes a REST API with JSON. It is also worth noting that you can likely use a multi tuner device like Tablo, HDhomerun to get the TV signal and have it publish it as an MPEG2 stream but I am not familiar with how it works or if it exposes as much directly as tvheadend does.
Now what?
Once you have this setup you can access your local TV stations video and guide data as if it were any other REST API on the internet. The TvHeadend data structures and APIs are actually the same data structures used in LocalTV+. We do not directly expose our TVheadend service but expose certain end points via an otherwise unremarkable Java application. You could totally build an app around tvheadend however I note above that it publishes the ATSC MPEG2 video stream directly. These files are very big, predating the internet and are not suitable for publishing on the internet. Part 3 of this guide will cover how we encode our videos for distribution on the internet.