Kodi Community Forum

Full Version: GUIDE: Complete Setup Guide for TVHeadEnd, HDHomeRun, and N.A. Program Listings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6
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:

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 httpSadDownload 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:

# Update Program Guide Information Daily
cd /home/hts/mc2xml

CTRL-X, Y to save and exit

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

Note: Thanks to mathgeek97 for correcting a mistake that I made in the original version of this guide with respect to the Cron job!

. 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:


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


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:


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;

It has been reported that you must do the following as user "hts". If that's the case, issue this command:

sudo su hts

Now configure the schedules direct grabber:

/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;
Wow. Thanks for the instructions. Should make using tvheadend much easier.
You're welcome!

If you or anyone else knows how to get the DVBHDHomerun installed on Ubuntu 12.04.3, please let me know.

It involves recompiling either the Kernel or DVBHDHomerun with the DVB Headers that were, but are no longer, included in the Linux Kernel. Unfortunately, I've not been able to find sufficient information that will allow me to write up a guide to do that..
Thanks for this, I added a link to this guide here http://forum.stmlabs.com/showthread.php?tid=12706 hope that's ok with you.
This is really nice work, thanks.

Regarding compiling dvbhdhomerun in versions of Ubuntu greater than 10.04... have you seen this page?


Seems as if he's trying to keep up with builds up to the most current kernel headers. There's also this hack proposed on another thread for your problem:


That being said, I haven't been able to get the dvbhdhomerun driver to behave nicely on Ubuntu 12.04 LTS, but perhaps this might help your thinking.

Depending on the tuner (I have the HDHomerun Prime and three tuners), I get a different number of services identified on the upfront initial scan process... which strikes me as a flaky dvbhdhomerun driver. I also can't get any channels to render on my client, but can get HDHomeRun Prime to work great in other circumstances.
For now, I'm sticking with Windows Media Center. I may also try out Argus TV, as I've heard good things. I'd like to use a Linux solution, as I regard Linux as more reliable, but MythTV is so poorly documented that I'm not ready to commit to that. TVHeadEnd looks good, but it seems like further development is needed, and they need to integrate the HDHomeRun drivers as MythTV has..
Awesome guide!

Any possibility of making something similiar for a Synology server? Preferably the arm cpu variety.[/align]
I've never tried installing it on my Synology box, and so I wouldn't know where to start. But, I'm confident you could adapt my guide and get it working. When you do, please post a similar guide here, and I may just try it!

(2014-01-17, 04:32)Shermer321 Wrote: [ -> ]Awesome guide!

Any possibility of making something similiar for a Synology server? Preferably the arm cpu variety.[/align]
Great guide! I was finally able to get tvheadend working on my Intel Nuc. I'm running XBMCbuntu 12.2 and it still seems to work. I'm just using antenna stations, no cable or anything.
I just used this guide on my OpenELEC box.

Support for TVheadend and HDHomeRun are included in the addons for openelec, so once I installed both and rebooted, I got TVHeadend up and running.

Now, my HDHomeRun seems to keep turning itself off, so it might be bad, I did get a super deal on a Refurb from newegg, so i'm going to look into that.
I wonder what version of Ubuntu that XBMCbuntu is using.

Did you set it up using the HDHomeRun Network Tuner?

If so, how?
i'm running xbmcbuntu 12.0. I got the HDHomeRun tuners working by installing the dvbhdhomerun package. there are versions for ubuntu 12 and even 13, i think.
I got tvheadend 3.9 running now. It found and labelled my stations automatically, so it was easier than having to search through the muxes. I think I missed a dependency, however, since i get an error on the web UI and I do not have an option for "transcoding" or "image caching" on the Configuration -> General tab.
i just cant get the hdhomerun to show up in my tv adapters in TVHEADEND.

Any suggestions?
You may need the headers, i know Ubuntu 12.04 doesn't seem to come with them

Try the below
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

best of luck, i am struggling to get the channels to decode properly...
I have to compliment you on a wonderful guide, it saved me from hours of frustration.
I would like to see the section, below, edited with regards to the cron job. I had to use the following script to get mine working (under an Ubuntu 12.04LTS VM using ESXi 5.5 as the hypervisor).

# Update Program Guide Information Daily
cd /home/hts/mc2xml

(2014-01-07, 07:20)advocate99 Wrote: [ -> ]. Set up Cron Job to download updated guide data daily

sudo nano /etc/cron.daily/mc2xml

type the following:

# Update Program Guide Information Daily

CTRL-X, Y to save and exit

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

I'd also like to note that I'm using a Hauppauge WinTV-HVR-2250 card passed to the Ubuntu VM to receive ATSC OTA broadcasts in the USA, and that works quite nicely with the setup you describe in your guide.
Pages: 1 2 3 4 5 6