Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides

Added by M Anderson over 3 years ago

TVHeadEnd Configuration Instructions

Ubuntu 10.04.4 Server
Silicon Dust HDHomeRun Tuner
North American Guide Listings
XBMC 12 (Frodo) as a Front End

Note: This is a Work in Progress. If I have time, I may add more to this, but this should be enough for most U.S. based users to get TVHeadEnd fully functional. Note that you CANNOT use Ubuntu 12.04 until someone tells me how to re-compile the Linux Kernel with the DVB Headers. You'll have to use 10.04.4.


. Install Ubuntu 10.04.4 Server. Use all default options, except select to install the SSH Server for remote access to the console.

. Install HDHomeRun Drivers:

sudo apt-get install hdhomerun-config hdhomerun-config-gui

Note: These are the drivers provided by Silicon Dust to allow use of the HDHomeRun on Linux.

. Install HDHomeRun Add-Ons

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:tfylliv/dvbhdhomerun
sudo apt-get update
sudo apt-get install dvbhdhomerun-dkms dvbhdhomerun-utils

Note: These are add-ons developed by others to allow HdHomeRun to work with TVHeadEnd. They do not work with newer versions of Linux, and do not work with Ubuntu 12.04.3. Apparently, newer versions of Ubunut have Kernels that do not include DVB Headers, and so the Kernel must be recompiled with them, or something. If anyone knows how to do that, please post here!

Some guides have indicated that you need to configure /etc/dvbhdhomerun, but I left it alone and it worked. Here are the instructions from another guide:

hdhomerun_config discover

Make a note of your Device ID.

sudo nano /etc/dvbhdhomerun

You'll see something like this:
[1210E3DC-0]
tuner_type=ATSC
use_full_name=true

Make sure that the information in brackets "[]" matches your device ID. If you are using an off-air antenna, verify that tuner_type is ATSC. Include one entry for each tuner on your network.

To restart the drivers:

sudo service dvbhdhomerun-utils restart

. Install TV HeadEnd:

sudo apt-add-repository http://apt.tvheadend.org/stable

sudo apt-get update

sudo apt-get install tvheadend

(Note that currently the repo does not work for Ubuntu 10.04.4, so do this instead):

sudo nano /etc/apt/sources.list

Add to the end of the file:

deb http://apt.tvheadend.org/stable lucid main

Ctrl-X, Y, ENTER to save and exit.

sudo apt-get update

sudo apt-get install tvheadend

Answer all prompts "Yes".

During the install, you will be prompted for a admin username and password. Remember this, as you'll need it to login to the web interface and to configure XBMC to connect.

Note: TVHeadEnd is the program that records TV. It runs as user: hts

It stores its config files in /home/hts/.hts/tvheadend

If you later want to change the username/password, use this command:

sudo dpkg-reconfigure tvheadend

. Download mc2xml

Visit web-site (mc2xml.hosterbox.net) and locate download link for Linux

cd /home/hts
sudo mkdir mc2xml
sudo cd mc2xml
sudo wget http:(Download Link obtained above)
sudo mv index* mc2xml
sudo chmod +x mc2xml
sudo ./mc2xml -c us -g 90024

You'll be prompted to select a lineup and then the program will download the channels to xmltv.xml in the same folder.

Note: This is a third party program that will download Program Guide listings to an XML File. Replace 90024 with your ZIP Code. Change 90024 to your zip/postal code. If you're in Canada, change -c from us to ca.

The download link changes frequently, so always go to the web-site to get the latest link immediately before you download. If you use an old link, you'll be downloading a web-page instead of the mc2xml app.

In the future:

sudo home/hts/mc2xml/mc2xml

by itself will cause it to update the file in the future.

To reset the program,

sudo rm /home/hts/mc2xml/mc2xml.dat /home/hts/mc2xml/xmltv.xml

. Set up Cron Job to download updated guide data daily

sudo nano /etc/cron.daily/mc2xml

type the following:

#!/bin/sh
# Update Program Guide Information Daily
cd /home/hts/mc2xml
/home/hts/mc2xml/mc2xml


CTRL-X, Y to save and exit

sudo chmod +x /etc/cron.daily/mc2xml

. Download TV Grab File

cd /usr/bin
sudo wget https://tv-grab-file.googlecode.com/files/tv_grab_file
sudo chmod 777 tv_grab_file
sudo nano tv_grab_file

and change line that begins with cat to:

cat /home/hts/mc2xml/xmltv.xml

CTRL-x, Y to save and exit.

Note: This file is needed to allow TVHeadEnd to interface with the XML files that are downloaded by MC2XML.

. Restart TVHeadEnd:

sudo service tvheadend restart

Note: Necessary so that TVHeadEnd finds tv_grab_file.

. Configure TVHeadEnd:

Using a computer that has a web browser on it, enter the following URL:

http://IPADDRESS:9981

Note: Replace IPADDRESS with the IP address of your Ubuntu machine. If you don't know what it is, type:

ifconfig eth0

at the command prompt.

Click chevrons in bottom right hand corner to bring up log and watch as TVHeadEnd does the configuration. click the gear to the right after the log is open to enable debugging (more detailed log information).

. Have TVHeadEnd Scan for channels

click "Configuration", click "DVB Inputs," click "TV Adapters"
Select Click on "Select TV Adapter" to pull down a list of recognized TV Sources;

Check Enable, Autodetect muxes, Skip Initial Scan, and Uncheck Idle scanning;
optionally change the adapter name;
click save at the bottom;
Click Add DVB Network by Location, select US, select "US_ATSC....", click Add DVB Network.

Repeat the above for the second TV Adapter in the dropdown list.

Over on the right hand side of the screen, take note of the following:

Services: 0
Muxes: ??
Muxes awaiting initial scan: ""

The system will scan each Mux (a potential channel) to see if there is a service (an actual channel). When Muxes awaiting initial scan reaches 0, all potential

channels have been scanned and the number shown in "Services" is how many channels were actually found.

You can watch the scan by opening the log (chevron in bottom right hander corner of screen) and enabling debugging by pressing the gear next to the chevrons after the

log window is open.

. Set-up Program Guide in TVHeadEnd:

Configuration/Channel/EGP/EPG Grabber:

Check all three options in general config

Internal Grabber
Module: XMLTV: tv_grag_file

Over the Air Grabbers: Uncheck All

Save

Note: This tells TVHeadEnd to use the tv_grab file to get the XML data that you downloaded previously. It will force TVHeadEnd to download the choices for Guide Data. The actual guide data will not be downloaded because you haven't set-up any channels yet.

. Give a Temporary Channel Number to Each Service so you can watch each channel in XBMC:

NOTE: Wait here until "Muxes awaiting initial scan:" reaches 0 in the "Configuration/DVB Inputs/Select TV Tuner" area. You can also tell that this is done because

the "Map DVB Services to Channels" button will become active. Note that due to a bug in TVHeadEnd, the "Map DVB Services to Channels" button does not currently work.

Instead, you'll have to manually map the DVB Services to Channels using the following procedure:

Configuration/DVB Inputs/Services

Close the log window (chevrons in the bottom right hand corner) or you may not see all the Services!

Click the spot under Channel Name to the right of the first service.
Type a number in the "Channel Name" field, starting with 100.
Hit enter after each one to move to the next cell and increase the number by 1, i.e. 101, 102, 103, and so on.

When done, click "Save Changes"

Note: This will also create Channels in Configuration/Channel/EGP/Channels for each channel that you name.

. Go to a device that runs XBMC

Install XBMC PVR App for TVHeadEnd and configure.

System -> Settings -> Addons -> Installed Addons -> PVR Clients -> Tvheadend HTSP Client -> Configure;

Give it the IP address and username and password for TVHeadEnd.

System -> Settings -> Live TV -> Enabled: Check

Escape to XBMC main screen; select Live TV and verify it works.

. Watch each channel.

As you watch, go back to your TVHeadEnd interface:

Configuration/Channel/EPG/Channels

Once you determine what the channel is,

A. click EPG Grab Source for that channel and select the channel description that matches.

B. Type in the Channel Number in the "Number" field. These channel numbers are used by XBMC to Order the channels, and are shown if you select the option in XBMC to show original channel numbers.

When You're done, click save changes at the top.

. Update the program guide data in TVHeadEnd now that you've set-up your channels.

TVHeadend: Configuration/Channel/EGP/EPG Grabber:

Change the number of hours to anything other than what it is now (I recommend 24 - you can change it back later) to force a guide update now. Click Save.

Now the Program Guide in TVHeadEnd should populate. If it doesn't, hit the refresh button in the middle left hand-side of the screen.

*. Update the program guide data in XBMC: *

Settings/Live TV/General/Reset the PVR Database- to force XBMC to download the latest guide settings.

. Go to the Program Guide in TVHeadEnd and start setting up your timers to record shows.



If you prefer to use Schedules Direct for Guide Data, then skip the instructions above relating to mc2xml and TV Grab File, you can try these instructions. I haven't tested them, but they should work.

Go to: http://www.schedulesdirect.org/ and register for an account;
Log in, click "Add a new lineup" and follow the prompts;
Sign out;

sudo /usr/bin/tv_grab_na_dd --configure
follow the prompts

sudo cp ~/.xmltv /home/hts/
(Note: The line above may not be necessary.)

click the "XML TV tab" (in TVHeadEnd?)
Click "Enable debug output" (the little gear at the bottom right);
Select "North America (Data Direct)";
set desired grab interval;
check "Enable grabbing";
hit save;


Replies (9)

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by M Anderson over 3 years ago

I found these directions for adding the DVB Headers to Ubuntu 12.04.3, but I haven't tested them. If they work, you should be able to adapt the guide I wrote above to get TVHeadEnd to work with 12.04.3 LTS:

cd ~
mkdir tmp_kernel
cd tmp_kernel
git clone https://github.com/charsyam/linux-kernel-3.8/
sudo cp -R linux-kernel-3.8/drivers/media/dvb-core/* /usr/src/linux-headers-3.8.0-35/drivers/media/dvb-core/
sudo cp -R linux-kernel-3.8/drivers/media/dvb-frontends/* /usr/src/linux-headers-3.8.0-35/drivers/media/dvb-frontends/
sudo dpkg-reconfigure dvbhdhomerun-dkms

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by K Shea over 1 year ago

For anyone finding this old thread in late 2015 or thereafter, I recently installed Ubuntu Server 14.04 and TVHeadEnd stable version 4.0.7 (from the repository; I don't build anything from scratch if I can possibly avoid it) on a system and it found the HDHomeRun tuners on my network right out of the box, so to speak, with no installation of drivers or other software required. YMMV but since this thread is quite old by now, I'd try just doing that before getting too carried away. Also, regarding free schedule data for the USA and Canada, mc2xml no longer works (Microsoft changed its source provider) but zap2xml does. There is an article that explains how to use it with TVHeadEnd at http://freetoairamerica.wordpress.com/2014/12/03/some-hints-for-getting-free-to-air-satellite-channels-into-the-electronic-program-guide-in-kodi-or-xbmc-or-another-frontend/

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by Patlach 13 over 1 year ago

The part of nano tv_grab_file, did not work for me, I had to change the line

cat /home/hts/mc2xml/xmltv.xml

for cat ~/mc2xml/xmltv.xml.

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by manley mannerson over 1 year ago

K Shea wrote:

For anyone finding this old thread in late 2015 or thereafter, I recently installed Ubuntu Server 14.04 and TVHeadEnd stable version 4.0.7 (from the repository; I don't build anything from scratch if I can possibly avoid it) on a system and it found the HDHomeRun tuners on my network right out of the box, so to speak, with no installation of drivers or other software required. YMMV but since this thread is quite old by now, I'd try just doing that before getting too carried away. Also, regarding free schedule data for the USA and Canada, mc2xml no longer works (Microsoft changed its source provider) but zap2xml does. There is an article that explains how to use it with TVHeadEnd at http://freetoairamerica.wordpress.com/2014/12/03/some-hints-for-getting-free-to-air-satellite-channels-into-the-electronic-program-guide-in-kodi-or-xbmc-or-another-frontend/

I'm afraid my experience was not the same. As of three days ago, a brand new install of Ubuntu Server 14.04 and tvheadend 4.0.8 installed from repo via apt-get did not see my old HDHomerun until I installed the drivers, after which the tuners were accessible. It wasn't too difficult but definitely not working out of the box.

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by Mark Walker over 1 year ago

Likewise: I tried a brand new install of Ubuntu and an apt-get install of tvheadend 4.0.8 and nothing worked, and it's still that way.

I'm a complete newbie as regards TV HeadEnd and I'm finding it frustrating as hell.
I have both an older HDHomeRun Dual and the newer connect model and I can't see either from the configuration GUI.

Any chance of a refreshed complete newbs install guide for TVH and HDHR? I don't mind doing yet another install as long as the bloody thing works at the end of it ;)

Mark

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by M Anderson over 1 year ago

Hi Everyone,

I'm the person who originally wrote this guide several years ago. Although I got everything working as I wrote the guide, I almost immediately switched back to my Windows Media Center installation because I wasn't sure whether TVHeadEnd would continue being supported.

As a result, it is very, very unlikely that I will re-write the guide anytime soon. I encourage anyone who has gotten it working to take my guide and modify it as necessary to make it work using today's software. It would be especially nice to see a guide that is written from the perspective of the latest Debian and/or Ubuntu long-term supported releases.

If someone posts a complete guide as a reply here and other validate that it works, I'll be happy to cut and paste it into my original post.

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by K Shea over 1 year ago

manley mannerson wrote:

K Shea wrote:

For anyone finding this old thread in late 2015 or thereafter, I recently installed Ubuntu Server 14.04 and TVHeadEnd stable version 4.0.7 (from the repository; I don't build anything from scratch if I can possibly avoid it) on a system and it found the HDHomeRun tuners on my network right out of the box, so to speak, with no installation of drivers or other software required. YMMV but since this thread is quite old by now, I'd try just doing that before getting too carried away. Also, regarding free schedule data for the USA and Canada, mc2xml no longer works (Microsoft changed its source provider) but zap2xml does. There is an article that explains how to use it with TVHeadEnd at http://freetoairamerica.wordpress.com/2014/12/03/some-hints-for-getting-free-to-air-satellite-channels-into-the-electronic-program-guide-in-kodi-or-xbmc-or-another-frontend/

I'm afraid my experience was not the same. As of three days ago, a brand new install of Ubuntu Server 14.04 and tvheadend 4.0.8 installed from repo via apt-get did not see my old HDHomerun until I installed the drivers, after which the tuners were accessible. It wasn't too difficult but definitely not working out of the box.

I have no explanation for why some people may find it necessary and others don't, but all I can say is that I started out with Ubuntu SERVER 14.04 (which I see you did also), which is NOT the same as Ubuntu Desktop. It may include some dependencies that the desktop version doesn't? And also I used the STABLE build of TVHeadEnd from the repository at https://tvheadend.org/projects/tvheadend/wiki/AptRepository (following the instructions shown on that page for installing TVHeadEnd). Another thing is that since I also have a TBS satellite tuner card I had already installed the drivers for those, prior to installing TVHeadEnd, and perhaps they included a dependency that was required, that also gets brought in if you install the HDHomeRun software. Also, before you install the TBS drivers for the first time, they tell you to do this:

sudo apt-get update
sudo apt-get install linux-headers-`uname -r`
sudo apt-get install make gcc

If I recall correctly all those things were already installed in Ubuntu Server but perhaps not, and maybe one of those are required for TVHeadEnd to detect the HDHomeRun tuners?

The only reason I hate installing the HDHomeRun software on a server is because it brings in a ton of dependencies, many of which are useless on a system with no desktop or GUI (at least to someone like me; maybe those more familiar with Linux know of some way to view the GUI stuff using xterm or something like that but I don't and in any case I don't do HDHomeRun firmware updates or anything like that from my backend system). They don't really hurt anything, they just take up space unnecessarily. So I would say that if you can get by without them, I would do it. On the other hand if you are running Ubuntu Desktop then it's probably not as big a hit on drive space because most of the GUI dependencies will be installed already.

My guess is that when you install the HDHomeRun drivers and it brings in that crapload of dependencies, there are probably one or two of them that TVHeadEnd actually needs and the rest are useless, but if you don't know which dependency that is (and I don't), then it's just a matter of luck of the draw as to whether it will already be installed when you install the OS and TVHeadEnd. It may be as simple as that I had installed Midnight Commander (first thing I install on any new Linux system) and it brought in the needed dependency; I doubt it but who knows?

Linux can be weird and wonderful, I don't know how many times I have heard someone say they got something working with no problems at all when that was anything but my experience. Maybe just this once, I won the "it just works" lottery!

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by K Shea over 1 year ago

Mark Walker wrote:

Likewise: I tried a brand new install of Ubuntu and an apt-get install of tvheadend 4.0.8 and nothing worked, and it's still that way.

I'm a complete newbie as regards TV HeadEnd and I'm finding it frustrating as hell.
I have both an older HDHomeRun Dual and the newer connect model and I can't see either from the configuration GUI.

Any chance of a refreshed complete newbs install guide for TVH and HDHR? I don't mind doing yet another install as long as the bloody thing works at the end of it ;)

Mark

Don't mean to ask an obvious question since I don't know what you have read, but are you looking under Configuration | DVB Inputs? That is where you should see them. Then (assuming you do see them) if you have not done so already, you need to create a network of type ATSC (if you are in an ATSC country, which I assume you are if you are trying to use a HDHomeRun) and assign each of the tuners to that network, also make sure the tuners are marked as enabled. If you don't see the tuners then you may be one of those that needs to install the HDHomeRun packages from the Ubuntu repository (probably hdhomerun-config, so maybe try sudo apt-get install hdhomerun-config but be aware it will bring in a crapload of dependencies). If you still don't see the tuners I'd try starting over with a fresh install, or if all else fails try a different version of TVHeadEnd such as the "unstable" version.

One other thing, I think everyone finds TVHeadEnd frustrating as hell the first time you try to configure it because much of the documentation is out of date (or at least it was when I first tried to set it up) but once you have gotten it to work the first time then it all makes sense. Part of the problem is that in some cases there are far too many options exposed, many of which are not used and should be left alone, and then in other cases some options aren't exposed at all until your tuners are detected and such. So you will see references to pages you can't find because you're not ready to configure them yet anyway, they only appear when you need them. And in other cases you will see a bunch of fields on a screen but maybe you really only need to change two or three of them. What TVHeadEnd sorely needs is some kind of "Wizard" program to guide new users through the setup steps, but I don't think anyone other than the developers understand TVHeadEnd well enough to write such a thing, and in the past they've struggled to even keep the documentation and help screens up to date, so I am not holding my breath.

RE: Complete Setup Guide for TVHeadEnd, Ubuntu, HDHomeRun Tuner, XBMC, and North American Program Guides - Added by Mark Walker over 1 year ago

Tried it out again yesterday (fresh install, on a testing box) and the tuners are picked up when I upgrade TVHeadend to 4.1.1 (from the unstable repo), but not found when I use TVHeadend 4.0.8.

Seems to be an issue with 4.0.8 (for me, as usual, others' mileage will vary).
So, my next step is to point at unstable on my main box (I'll tar up everything first, just in case)

Mark W.

(1-9/9)