Integrating OTA and Pay TV Services Using Tvheadend

Tvheadend is a TV streaming server and recorder for Linux, FreeBSD and Android supporting DVB-S, DVB-S2, DVB-C, DVB-T, ATSC, ISDB-T, IPTV, SAT>IP and HDHomeRun as input sources. https://tvheadend.org/
USA based readers will most likely read that intro paragraph from the Tvheadend website and wonder exactly what Tvheadend does and what most of those acronyms mean.  In a nutshell, Tvheadend is open source software that acts as a dvr and live streaming server for Kodi and other media center applications.  Many of the acronyms refer to broadcast standards that are not used in the US,
In other countries (particularly European countries), video services are provided by satellite (-S), cable (-C) or terrestrial (-T) methods to receivers that distribute content based on open standards.  In the USA, cable and (for the most part) satellite providers require proprietary hardware to receive and display the video signals.  Consumers must rent that hardware from the service provider, one box for every television.  This generates millions of dollars for content providers, but severely limits the viewing experience for consumers.  A few years ago, the FCC was considering a proposal requiring cable companies to allow third party set-top-box  (STB) receivers.  But the new FCC Chairman, Ajit Pai, killed the proposal within a few weeks of his appointment as Chairman of the FCC.  Yes, this is the same Ajit Pai who is pushing for repeal of Net Neutrality within the US.

One option that has been available to US consumers who did not want to accept the standard viewing experience, has been to use a streaming device and media center software such as Kodi https://kodi.tv/ .  It's worthwhile to note here that Kodi has taken some heat recently by the uniformed who claim that Kodi is software used for pirating video from content providers.  This is simply not true.  Kodi is used to stream video from various sources to a television for viewing.  These sources can include your DVD collection, home movies, and other legal content that you own.  The problem is, some shady organizations have made illegal content available through the use of Kodi add-on software.  This software is not a part of Kodi and the shady organizations are not associated in any way with the Kodi developers.

Wait a minute, if the cable and television companies force you to use their receivers, how can Tvheadend and Kodi help?  Actually, there are a couple of methods for using these applications to provide live (and recorded) television content.

Many US consumers have tired of the ever-escalating monthly cable bill.  They are cancelling video delivery services and relying on an antenna paired with a streaming service such as Netflix or Hulu.  The antenna provides access to the major networks (ABC, CBS, Fox, NBC, and PBS) for many consumers while Netflix and Hulu provide movie and (delayed and archived) broadcast content.  Unfortunately, the USA's Internet providers are essentially oligopolies that are using their pricing power to escalate the cost of Internet service at whatever rate is required to offset the loss of revenue stemming from decreasing demand for their video delivery services.  That makes terrestrial content received by antenna (for free!) very appealing.

SiliconDust https://www.silicondust.com/ makes a line of terrestrial tuners called HDHomeRun that receive over-the-air (OTA) broadcasts and distribute them to Tvheadend, Kodi or other software over a home network.  SiliconDust also makes the HDHomeRun Prime which tunes cable channels (using a cable card rented from the provider) and distributes the content using a home network.  But the Prime is hindered by the fact that cable companies prevent distribution of some/many cable channels using DRM techniques.  SiliconDust's OTA products don't suffer from these limitations and the company is known for high quality products and excellent support.  There are a number of applications that can be used to stream and record broadcasts with HDHomeRun OTA tuners, but the combination of Tvheadend and Kodi provide provides more features and a better viewing experience than other solutions in my experience.

There's still an issue with ESPN and all of those other 'cable only' channels.  How can we view those without the annoying ads and terrible interfaces found on the average cable STB?  Until recently, the best hope was to use a device made by Hauppauge http://www.hauppauge.com/ called the HD-PVR.  It could digitize a high definition analog signal from your cable or satellite receiver and send that data to a PC over a USB 2.0 connection.  The digitized data could be recorded or streamed over a network using the proper software running on the attached PC.  Unfortunately, Tvheadend does not directly support the HD-PVR and the applications that do support it each have their own limitations or issues.  Additionally, many set-top-boxes are now eliminating analog component video out closing the so-called analog hole that content providers hated because it provided a way to record DRM protected video.

The most promising replacement for the HD-PVR as a set-top-box recorder is a device called an IPTV encoder or HDMI encoder.  These devices are marketed by various companies under different model names, but they appear to be strikingly similar.  A typical representation is the TBS2603  https://www.tbsdtv.com/products/tbs2603-hd-hdmi-video-encoder.html .  These devices take in the HDMI signal from an STB and produce streaming video in any of a number of formats (eg rtsp, http, rtp).  Once the video is converted to a standard streaming format, tvheadend can record it or stream it live to Kodi and other media center front ends.

The last piece of this puzzle is telling the STB to change to the proper channel when recording or viewing so that the HDMI encoder will stream the correct content.  Tvheadend does not support any type of external channel changing methods, but an elegant open source application available on github called node-ffmpeg-mpegts-proxy solves that problem.  https://github.com/Jalle19/node-ffmpeg-mpegts-proxy was originally written to convert streaming video formats not handled directly by Tvheadend into streaming http.  It performs that task nicely, but also provides a 'pre-streaming' hook that can be used to change the STB channel using an IR blaster or any other available external method.  This proxy is quite efficient, so CPU impact is very small; the video and audio streams are essentially just repackaged and sent back out on the network.  Performance is so good that I don't mind using the proxy even if a format conversion is not required.  I also believe the proxy could be used to allow streaming an HD-PVR output to Tvheadend, but more investigation is needed to verify that functionality.
Update:  An HD-PVR will indeed work.  Instructions are included in the installation information.

In order to make any DVR or streaming system user friendly, an electronic program guide (EPG) is required.  You want to be able to browse channel listing to see what's on now for viewing or later for recording.  Fortunately, we have access to an excellent service that can provide this information.  Schedules Direct http://www.schedulesdirect.org/ is a dependable and inexpensive service (currently $25/year) that provides full program listing and guide data for most OTA, satellite, and cable services.  When used with the open source xmltv http://wiki.xmltv.org , Schedules Direct will allow Tvheadend and Kodi to display EPG info in a user friendly format.

Update:  Thanks to Tvheadend forum user SeanM for pointing out that there is also a free source of EPG data available for the US and Canada through zap2it.com and zap2xml.

If you are a US based consumer with a bit of technical expertise, the tools discussed in this article can be used to build a media center for viewing live and recorded video with a customizable interface that is a pleasure to use.  You may not be able to completely escape the set-top-box, you can take back the viewing experience.  In the next article, we'll cover the details of installing and configuring the components.

Comments

Popular posts from this blog

Integrating OTA and Pay TV Services Using Tvheadend: Part 2 Installation

Integrating OTA and Pay TV Services Using Tvheadend: Part 5 EPG Configuration