Integrating OTA and Pay TV Services Using Tvheadend: Part 4 HDMI Encoder Configuration


In previous articles, we've discussed why Tvheadend provides a better viewing experience.  We've installed Tvheadend along with the necessary support tools, and stepped through configuring Tvheadend for use with an HDHomeRun.  In this article, we'll configure Tvheadend for use with a set-top-box (STB) and an HDMI encoder.

My testing has been done with an ADB 3800 cable box and a TBS2603 HDMI encoder.  Typical for cable boxes in this area of the world, the only way to control the cable box is through the IR receiver.  The TBS2603 is identical to many other single channel HDMI to IPTV encoders available on Amazon and eBay, it can configured through its web interface to output a received HDMI signal as h.264 streaming http, rtsp, or rtmp.  In my system, I've configured for http and tested the stream using VLC.

If you haven't already installed xmltv, node-ffmpeg-mpegts-proxy, and worked through the instructions in part 2, you'll need to complete those steps first.

The initial configuration of Tvheadend was covered in part 3, but is repeated here for those that skipped HDHomeRun configuration.  If you've already worked through those steps, you can skip ahead to 'Creating an Automatic IPTV Network'.

Before we dig in, let's cover some terminology.  Borrowing from the Tvheadend documentation:
  • A network is the software definition of your carrier network. Broadly, it lays out what sort of network it is (such as ATSC-T or IPTV) and how it gets scanned.
  • Networks then have muxes. These include the carrier frequencies that exist on the over-the-air channels that are used to transmit multiple digital signals.  These signals are multiplexed together, hence the name mux.
  • Muxes then carry services. These are the individual streams of data. For IPTV streams, a mux typically carries a single service. For ATSC-T streams, a mux typically carries multiple services.
  • And finally, services are mapped to channels such as PBS or Discovery.
More info: https://tvheadend.readthedocs.io/en/latest/before_you_begin/

Assuming Tvheadend and the support components were installed as described in the previous article. the configuration interface is available from a web browser at http://IPADDRESS:9981.  If Tvheadend was installed on a machine with a desktop environment, you can use http://localhost:9981 as the configuration URL in a browser on the local machine.

When you first access the Tvheadend web interface, you'll be be greeted with the first screen of the configuration wizard.


Select your language and click 'Save & Next'.  Tvheadend will restart and you'll see the same question.  Click 'Save & Next' again and you'll see the next screen.


Leave Allowed network blank to allow access from all networks.  Enter Admin credentials and User credentials. Click 'Save & Next'.

The setup wizard is great for initial configuration, especially if you have a fairly simple setup with, for example, a single HDHomeRun.  We're going to walk through a more complicated setup and also want to demonstrate the full Tvheadend configuration interface, so on each of the remaining wizard screens simple click 'Save & Next' without entering any information.


The final screen of the wizard will display.  Once you click 'Finish', your credentials are saved and you are left in the Tvheadend web interface.


Notice the tabs across the top, one for each of the major functionality categories.  As you click on those tabs, additional tabs appear in the header below the primary tabs and status/configuration information is shown in the main content area.


This is the what you'll see when you click on the top-row configuration tab (Configuration-General-Base).  Most of these settings are fine at their default values, but go ahead and choose Expert in the User interface level drop-down and then click save just below the tabs.  This will make sure you can see all of the options on each configuration page.  While you're at it, you might want to click on the two small up arrows in the lower right status bar area.  This will show the Tvheadend log which displays useful status information and possible problems as we proceed with configuration.

Creating an Automatic IPTV Network

Make sure node-ffmpeg-mpegts-proxy is running as described in part 2.  If you haven't already, execute this command in a terminal as user hts (make sure that the channels2.json name matches the name you used for your STB sources file):
nodejs /home/hts/tvh/node-ffmpeg-mpegts-proxy/node-ffmpeg-mpegts-proxy.js -l 127.0.0.1 -p 9128 -s /home/hts/tvh/channels2.json

Access the Tvheadend web interface at http://SERVERIPADDRESS:9981.  Choose Configuration-DVB Inputs-Networks and click Add.



Choose IPTV Automatic Network.

There are two possible methods for adding the services associated with an automatic IPTV network.  In method 1, you allow Tvheadend to scan the muxes listed in your playlist and create the services.  This is a reasonable thing to do if your playlist is only a few items.  However, if your playlist contains hundred of mux definitions, the scan will take hours as each mux is tuned and verified.  The second method involves telling Tvheadend to simply assume there is a single service associated with each mux and add those services without scanning.  I'll step through both methods below, but in my experience, the 'no scan' method is faster and more reliable for anything more than a few muxes.

Method 1: Scan muxes



Name the network whatever you like and enter the url of the .m3u file created from your STB Schedules Direct xmltv file using xmltv2m3u.  Set Maximum # input streams to 1.  You can set a starting channel number if you'd like channel numbers to start at, for instance, 1000.  The Re-fetch playlist field can be set to a long time period since our playlist is static.  !!!Does EIT time offset need to be set?  Click Create.

Tvheadend will scan all of the muxes specified in your playlist.  The process can take a long time, especially if you have hundreds of channels.  You can click on the two small arrows in the low right to open the log pane and check on progress.

Method 2: Don't scan muxes



Name the network whatever you like and enter the url of the .m3u file created from your STB Schedules Direct xmltv file using xmltv2m3u.  Set Maximum # input streams to 1.  You can set a starting channel number if you'd like channel numbers to start at, for instance, 1000.  The Re-fetch playlist field can be set to a long time period since our playlist is static.  Turn off Scan after creation and set the Network service ID to 1.  !!!Does EIT time offset need to be set?  Click Create.

Continue after either method

Choose Configuration-DVB Inputs-Muxes.



You should see a list of muxes named according to to the .m3u file you specified and the channel number - channel name obtained from your Schedules Direct lineup.

Choose Configuration-DVB Inputs-Services.



You should see a list of all of the services that correspond with the channels specified in your playlist.

Note if you used 'scan mux' method:
If services are missing, Tvheadend was not able to scan the muxes correctly.  Check Configuration-DVB Inputs-Muxes to see if the scan status is FAIL.  Also, check the log window for 'scan no data, failed' messages.  If you have failures, check your STB and HDMI encoder using VLC to stream from the encoders's URL, then the proxy URL.  Once you can stream to VLC, you can either delete the Automatic IPTV network and try again, or re-scan individual muxes by editing them in Configuration-DVB Inputs-Muxes and setting Scan status to pending.

In Configuration-DVB Inputs-Services, click on the Map services drop-down and select Map all services.



If you have already configured an HDHomeRun or other services, you might want to un-check those in the Services drop-down.  Creating tags may be helpful later.  Click Map services to map all selected services to a corresponding channel.



You'll be shown the status page indicating how many services were mapped.

Go back to Configuration-DVB Inputs-Services



Your services should now be listed with matching Channel names.  Success!

Tvheadend can now stream and record all of the channels from your cable or satellite set-top-box.You can schedule a recording in Digital Video Recorder-Upcoming / Current Recordings.  Kodi can be used to stream live channels once the Tvheadend PVR add-on is installed and configured.  We're getting close to having a really nice streaming media solution, but we still need to add program guide information to complete the package.  We'll tackle that task in the next article.

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

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