How to build LocalTV Part 2: TV Signals

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.

How to build LocalTV Part 1: Legal

This is the first of a multi part series where we detail the steps we took to make LocalTV+ a reality. The hope is that others in other parts of the country can emulate this process to make their own “LocalTV+” that serves their own community. People often ask if we will expand and the answer is always no. Beyond the legality of it, we will not expand because this service is run by three guys with day jobs who volunteer their time. Since it picks up actual TV signals there is a need for someone to be physically be present in each market to setup and maintain the antenna and encoder hardware.

This first post will deal with the legality of the service. This post is not legal advice and I am not a lawyer. This is simply what we did. However I would stress that this is likely the most important step for anyone looking to start a similar service.

LocalTV+ exists because US copyright law explicitly mentions how secondary transmissions can be legal. Specifically it says:

(a)Certain Secondary Transmissions Exempted.—The secondary transmission of a performance or display of a work embodied in a primary transmission is not an infringement of copyright if—

(5)the secondary transmission is not made by a cable system but is made by a governmental body, or other nonprofit organization, without any purpose of direct or indirect commercial advantage, and without charge to the recipients of the secondary transmission other than assessments necessary to defray the actual and reasonable costs of maintaining and operating the secondary transmission service.

To do this we created a non profit, Mass Local TV Inc which runs LocalTV+, owns its physical assets, bank accounts, application source code etc. In addition, we decided that our non profit would be a 501(c)(3) non profit where donations are tax exempt. In Massachusetts, we also had to file paperwork with the state to allow us to legally fundraise in the state. We used a service called BryteBridge to actual handle and file all of our legal paper work. Unlike many other things we did, this is a step where we have not gone with the most inexpensive option. Technically this is not necessary. You could follow any number of guides on line to do this yourself. This is just what we chose to do.

We made some additional decisions, you may note that the law above actually does allow charging for the service “to defray the actual and reasonable costs of maintaining and operating the secondary transmission service” . We made a decision to try to offer this as a free, donation funded service. This would allow us to avoid one of the traps that Locast fell into. They charged $5 a month and generated millions of dollars in revenue. On a similar note we are careful to have no ads or privacy invading metrics in the app. We also provide an unmodified signal. What you see is what we picked up on the antenna. There are no interruptions or preroll ads on the stream.

We use a service called Givebutter to handle our online donations. This isn’t technically necessary and many people have actually donated via check. We use this service because it’s easy, cheap ($1 or so when we withdraw) and takes care of the security aspect of dealing with credit card transactions. It allows us to focus on the technology.

For the iOS and tvOS AppStores as a non profit, Apple waives our $99/yr developer fee. It comes with certain restrictions with respect to in app purchases but it is a restriction we are willing to accept right now to keep costs down.

Part 2 onwards we will discuss how we use open source code, in expensive hardware and modern technology to reduce costs.