I have found getting Live Tv working on my Pi 2 to be a somewhat traumatic exercise, and judging by the different threads on the subject I am not alone. I have there tried to assemble notes of what I did in the hope that it will help others, and perhaps eventually form the basis of a wiki entry.
Feedback welcome.
##SETTING UP OSMC TO VIEW FREEVIEW TV
####Rough Draft 1
##1. Introduction
This document outlines how I set it up OSMC/Kodi to allow me to watch live UK FreeviewTV, using a Windows PC for that process. I am publishing it in the hope that it may be of use to any other newbie like me struggling to get Live TV working, and in the hope in can be adapted to be in a form suitable for inclusion in the wiki.
Though the information is based on the UK Freeview, I suspect much is relevant to other networks.
Regrettably in some cases I have not found a method of avoiding performing operations at the Linux command line, in which case I have indicated the necessary commands in a blue font thus. Hopefully future updates to OSMC will make these redundant.
I have only tried these procedures on a Pi 2, but believe they are also applicable on a Pi 1, though in the latter case times to perform various action may be significantly extended.
Where I have come across alternatives I have included them with comments as to the relative merits of each, though some may solely reflect my personal preferences.
I would welcome feedback, particularly on:
-
Any errors, or significant omissions in the context of a newbie attempting to get OSMC working with live TV.
-
Any changes needed for other Pi models
-
From OSMC developers on any features or anomalies noted below that they intend to change.
and information on other tuners/networks.
2. Other sources of Information & HELP
If you have difficulties, the following sources of information may help:
-
OSMC operation: OSMC wiki
-
OSMC forum (Pi Help & Support): OSMC forum
-
Resolving Pi problems: Pi forum
-
Kodi operation: Kodi wiki
but note that the last is based on using the Confluence skin rather than the default OSMC skin and it may be difficult to relate your screen to the wiki without changing to the Confluence skin as detailed below.
3. Change Skin (To allow use of mouse)
For setting up purposes, I find a mouse much more convenient than keyboard, but the OSMC skin is not compatible with use of the mouse (it does respond, but far too quickly) so changed to the Confluence skin using the instructions here. If you are happy with using the keyboard, or do not have a mouse connected to your PC, skip this section and use keyboard arrow keys + Enter/OK instead of clicking in the instructions below.
4. Installing Firmware for Your Tuner
4.1. General
I have two tuners, requiring different firmware files downloaded from the internet, and some limited Linux experience. I chose to use SSH {user = osmc, password= osmc}, and run the relevant commands from my PC using “PuTTY” - this can be done while waiting for App Store installations to be completed. Using PuTTY on the machine being used to read this will allow you to paste commends directly from this document - select the relevant text here, ^C, click on PuTTY to move the focus, right click to insert the text at the cursor position. Otherwise you will need to return to the Linux prompt as detailed here.
4.2. Hauppage WinTV-HVR-900H
The relevant commands I used were:
cd /lib/firmware
sudo wget goo.gl/xZSPH -O dvb\_firmware.tar.gz
sudo tar -xzf dvb\_firmware.tar.gz
cd /lib/firmware
sudo wget https://github.com/OpenELEC/dvb-firmware/tree/master/firmware
While the scanning process does not seem to work, I can view TV if I first scan with the other tuner.
4.3. PCTV tripleStick 292e
The following commends seem to lead to satisfactory operation:
sudo wget http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/dvb-demod-si2168-02.fw -O /lib/firmware/dvb-demod-si2168-02.fw
sudo wget http://palosaari.fi/linux/v4l-dvb/firmware/Si2168/Si2168-B40/d8da7ff67cd56cd8aa4e101aea45e052/dvb-demod-si2168-b40-01.fw -O /lib/firmware/dvb-demod-si2168-b40-01.fw
sudo wget http://palosaari.fi/linux/v4l-dvb/firmware/M88DS3103/3.B/dvb-demod-m88ds3103.fw -O /lib/firmware/dvb-demod-m88ds3103.fw
4.4. Hdhomerun Tuners
The following has been extracted from @HarryL’s posts - hope I have got it right!
sudo apt-get install libhdhomerun-dev
cd /usr/src
ln -s /usr/include/libhdhomerun/ /usr/lib/libhdhomerun
wget http://downloads.sourceforge.net/project/dvbhdhomerun/dvbhdhomerun\_0.0.15.tar.gz
tar zxvf dvbhdhomerun\_0.0.15.tar.gz
cd /usr/src/dvbhdhomerun-0.0.15/userhdhomerun
make
make install
5. Build/install Tvheadend Server
As of 6/4/2015, I have been unable to get the App Store versions to work, so by courtesy of @HarryL have compiled & installed the latest github version using the following commands via putty & SSH {user = osmc, password= osmc}:
sudo -s
apt-get update
apt-get install git build-essential pkg-config libssl-dev dvb-firmware-osmc dvb-tools libdvbv5-0 liburiparser-dev liburiparser1 libavahi-client-dev zlib1g-dev libavcodec-dev libavutil-dev libavformat-dev libswscale-dev
adding libhdhomerun-dev libhdhomerun1 hdhomerun-config cmake
to the last command for hdhomerun network tuners.
cd /usr/src
git clone https://github.com/tvheadend/tvheadend
cd tvheadend
./configure
make
The first part takes around 10 minutes to complete, and the second a further 5-6 minutes, after which you need to make the Access Control File using:
(sudo?) mkdir -p /home/osmc/.hts/tvheadend/accesscontrol
sudo nano /home/osmc/.hts/tvheadend/accesscontrol/1
inserting the following lines:
"enabled": 1,
"username": "osmc",
"password": "osmc",
"comment": "Default access entry",
"prefix": "0.0.0.0/0,::/0",
"streaming": 1,
"dvr": 1,
"dvrallcfg": 1,
"webui": 1,
"admin": 1,
"id": "1"
followed by ^O, Enter, and ^X to save the data and exit. You then need:
chown -R osmc:osmc /home/osmc/.hts
The final step is to ensure Tvheadend runs every time you reboot, requiring
sudo nano /etc/rc.local
and inserting the line:
/usr/src/tvheadend/build.linux/tvheadend -u osmc -g video -C &
for my tuners and:
modprobe dvb\_hdhomerun
sleep 4
/usr/local/bin/userhdhomerun -u osmc -g video -f &
sleep 4
/usr/src/tvheadend/build.linux/tvheadend -u osmc -g video -C &
for hdhomerun tuners. Save the data and exit using ^O, Enter, and ^X.
Then reboot by clicking on the Confluence on/off button icon (circle with short vertical bar at top) and then clicking on Reboot or:
sudo reboot now
6. SetTing up Tvheadend
6.1. General
Tv headend is set up using a web page accessed using your PC browser, and all the instructions within this section refer to the PC, not the Pi/OSMC directly. If you have installed SAMBA , the URL to enter your browser is http://OSMC:9981, otherwise use http://x.x.x.x:9981 where x.x.x.x is the Pi’s IP address (obtainable from System - Settings - Addons - OSMC Settings - Network or System - System info - Network). The disadvantage of the latter is that it may change if you disconnect your Pi from the network by rebooting or powering off.
N.B. Using the above version of Tvheadend you do not need a username or password, but with the App Store version you they are both “osmc”.
Having logged in, you should see something like:
6.2 General Settings
Select Configuration/General, Select the language you wish to use language, click on right arrow in the Language Selections box so it appears under “Selected” & click on Save Configuration
6.3 Networks
At this stage there should be no entries. Click on “Add” and in the subsequent boxes:
-
Choose your network type, DVB-T in my case for Freeview (whether just SD or both SD & HD)
-
Network name - anything you like - I chose “Freeview” and have assumed that below.
-
Skip Initial scan - uncheck
-
Pre-defined muxes - from the drop-down list select your transmitter (UK-Sudbury in my case) if it is there - I suspect it only lists the main UK transmitters and not the local satellites.
-
Network discovery - uncheck if you found an appropriate entry in the list or if you would prefer to enter all the mux data manually - see below.
leaving other parameters at their default values, and click on Create (You may need to move the box to make this visible at the bottom). Go to the Muxes tab. If you found your station in the list now you should see the muxes for your area, all with scan status = “PEND”, otherwise you have the choice between:
- Manually creating muxes for each of the frequencies of your local transmitter
or
- Manually creating a mux entry for one frequency and using the “network discovery” option above.
The disadvantage of the latter is that mux entries are created for all the associated satellite transmitters, so many will fail during the scanning process, and you could encounter problems if you pick up the same channels from more than one transmitter (certainly the latter causes problems for users of the Topfield PVRs).
Details of transmissions from all 2023 TV transmitters in the UK can be found here.
6.4. TV Adapter
Click on the TV adapter tab, and you should see your device. Click on the lowest level entry for that device, to set up its parameters as follows:
- Enabled - checked
- Network - Freeview from the drop down list (or whatever name you have used)
and then click on “Save”. If you now go back to the Muxes tab, you should see the “Scan Status” for all valid muxes change to “Idle”, and the “~Serv” column have non-zero numbers thus:
Note that if you only have an SD tuner, HD mux scanning will fail. Though not necessary, things will look tidier if you manually delete all failing muxes.
6.5. Rescanning
If you want to rescan at any time to receive new channels etc, go to Configuration - DVB Inputs - Networks, Select the Freeview network (or whatever you have called it), and then Click on “Force Scan”. I think this adds to rather than replaces existing services, so deletion of all services first may be appropriate.
6.6. Editing & Mapping Channels
Having successfully completed the scans, the next task is to remove or disable all the unwanted channels, such as the unnamed channel that seems to appear on each mux and those in categories such a shopping, porn, etc according to your tastes. Select the Configuration - DVB inputs - Services tab when you should see something like:
and either click on the relevant “Enabled” check boxes, or select each unwanted channel and click on “Delete” (consecutive channels can be selected using the shift key + click). Click on “Save” when you have finished (and at intermediate points in case you forget).
It is then necessary to click on “Map All” to make the services visible to Kodi, selecting “Merge same name” in the pop-up window.
7. Setting Up Kodi
Reverting to the Pi/OSMC, go to System - Settings - Live TV - General and click on Enabled. A popup box will warn you that you have no PVR add-On. Click on OK, and you will be presented with a list of suitable add-ons. Click on Tvheadend HTSP Client, and then Enable. If you have compiled your own Tvheadend the default settings should be OK, but using the App Store version click on Configure to set username and password to “osmc”.
You should then see a small message about loading channels, and “TV” should have been added to the top level menu. However sometimes the above procedure does not seems to work, and you may need to repeat it.
Now click on TV, and you should see the TV channels listed in LCN order. Click on the one you want to watch and it should appear.
Clicking on the film symbol next to a channel brings up a list of largely self-explanatory options.
8. KNOWN Issues
I would have liked the channel LCN to appear instead or just a serial number, but have not found out how to do this.
The IPTV channels accessed via Freeview (LCN 225 onwards) seem to be ignored in the Tvheadend mapping process, so cannot be viewed.