Saturday, March 16, 2019

TVHeadend on OSMC with Raspberry Pi TV HAT (DIY)

Disclaimer: The following is only an experiment for personal learning and does not compete with or replace professional Set Top Box products available in the market for Digital TV receivers. Please follow these instructions at your own risk. I will not be responsible for any damage caused to your equipments or configuration.

Raspberry Pi foundation had recently released TV HAT (TV tuner add-on card) compatible with DVB-T/DVB-T2 standards. Coincidently in Singapore, as the analog TV transmission was ceased from 1 Jan 2019 and all the Free-To-Air channels were digital only, available over DVB-T2, I thought of trying the TV Hat on Raspberry Pi 3B+ running OSMC. This was possible because the TV Hat was compatible with DVB-T2 frequencies/bandwidth used by Mediacorp FTA channels.

Following are the steps:


  • Install OSMC on Raspberry Pi and configure it to access Internet either wired or wireless. You should make note of the IP address as we'll need that later.
  • Install TV HAT on Raspberry Pi 3B+.
  • Attach an antenna based on DVB-T2. Lazada.sg has few models.
  • Install TVHeadend server from OSMC AppStore. This will enable the software which will make the TV Hat functional
    • Programs --> MyOSMC --> AppStore --> TVHeadend Server --> Install

  • To configure TVHeadend server, use a different computer to access the management console (port 9981) of TVHeadend server over browser, for example, http://192.168.1.100:9981. You'll need to use the IP address of OSMC that you made note of at step 1. The default username/password will be osmc/osmc.
  • Configure TVHeadend server. This will require quite a few steps because the frequencies/bandwidth used by Singapore's FTA channels are not pre-configured in TVHeadend, hence will require manual configurations.The Welcome screen will start with configuration wizard




You can retain the existing username/password of osmc/osmc or make it blank. If you make any changes, the next screen will prompt you for updated credentials.

 Select one of the Networks as 'DVB-T Network'


 This step will let you select pre-defined muxes available. These are set of pre-defined frequencies/bandwidth for the transmissions available in other countries. As Singapore is not listed in the pre-defined muxes, we can select any entry (e.g., co:co-All) to proceed further. The scan at later steps will fail but we'll edit the muxes to include specific frequencies/bandwidth.


TVHeadend server will scan and will show 0 services found. Proceed next.


Service mapping is not relevant for now because no services were found. Proceed next.


Finish the wizard.


The following screen Configuration --> DVB Inputs --> Muxes will show FAIL results. Select the pre-defined list and Delete these.




We'll now manually add entries in Muxes tab. Press the Add button and select the Network name defined at the beginning of the wizard (e.g., DVB-T Network).


Select Delivery System = DVB-T2


Enter the frequency of the channel (listed below for Singapore's MediaCorp FTA channels), enter 8MHz as Bandwidth and click on Create. Repeat the steps to Add the frequencies for all the FTA channels.
538250 Hz - Ch 5 (HD), Suria (HD)
554000 Hz - Ch 8 (HD), Vasantham (HD)
570000 Hz - Channel News Asia (HD), Ch U (SD), okto* (HD)
586000 Hz - Ch U (HD)

*okto channel will be merged with Ch 5 from 1 May 2019 onwards.


The server will automatically scan and will find the services available over the entered frequencies. The next step is to map the found services to establish 'channels'







At the end of mapping services, go to Electronic Program Guide (EPG) to view the program listing across the channels.
  • Next will be to install client for TVHeadend on OSMC.
    • Settings --> Add-Ons --> My Add-Ons --> PVR Clients --> Tvheadend HTSP Client
    • If the username/password on TVHeadend is not blank, this will show Access Denied error. Go to Config screen to manually enter the credentials for TVHeadend server.
Return to main screen on OSMC, you'll see a new section TV besides TV Shows, Movies, Music.

Similar to the Tvheadend client on OSMC, TvhClient is another client app for TVHeadend server available for other platforms - iOS, Apple TV (tvOS) which can let you watch the channels over local network on the client devices. 

You can also use the TvhClient app on iPhone for private listening, e.g., play a channel on OSMC connected to TV with TV sound muted and use the TvhClient on iPhone to playback the same channel with earphones to listen to the sound.

Do note that Raspberry Pi TV Hat has a single tuner which is using Sony CXD2880 chip. Single tuner will restrict you to watch/record/stream only one channel at a time. 

Using the clients, you can also configure recording options for the programs broadcasted.