Adding Digital Cable Channels For DVB-C Tuner Cards -- Norway

From MythTV Official Wiki
Jump to: navigation, search

Time.png Outdated: The information on this page may no longer be relevant to the current release of MythTV, 0.27. Please consider helping to update it.

The following instruction might be specific for
0.20
. Please update if it is outdated.

Warning.png Warning: See User Manual:Setting up DVB-C (cable) for up to date information on DVB-C channel scanning

My system is a Mythtv pc installed with Fedora Core 6 following this howto [1]. I use the Technotrend Premium DVB-C 2300 Hybrid dvb-c card[2] bought from Dvb shop in Germany [3]. The video4linux Wiki have a list of supported dvb hardware [4]. This Wiki is a howto for Norwegian dvb-c broadcasting (cable), but some part are general for DVB broadcasting with satelite or terrestial. I use my dvb-c card only for viewing the unencrypted tv channels. Grimstad cabeltv use Chinacrypt as the encryption method and I have not found any place yet where I can buy a Chinacrypt CAM module for viewing encrypted tv-channels (for this to work I must also have a paycard for the channels I want to see). I have used Mythtv with analog tuner card (PVR-350) some time now, but after I moved to dvb-c card the quality from the tv broadcast is much better.


DVB-C Installation [5]

The Linux 2.6 kernel had already support for Technotrend Premium DVB-C 2300 so the card was autodetected after first time boot. The firmware for the card was not in place so you must download the correct dvb-ttpci-01.fw-2622 (or newer) firmware file from this place [6]. Place this file in the hotplug directory. On Fedora 6 this was /lib/firmware and then rename the downloaded file to dvb-ttpci-01.fw. Change the permission on the file.

# cd /lib/firmware
# wget http://www.linuxtv.org/downloads/firmware/dvb-ttpci-01.fw-2622
# mv dvb-ttpci-01.fw-2622 dvb-ttpci-01.fw
# chmod 755 dvb-ttpci-01.fw

After a reboot you should get some file in /dev/dvb/adapter0/. Check also that the permission are correct.

[mythtv@mythpc ~]$ ls -l /dev//dvb/adapter*

Scanning for channels [7]

Using Fedora, assume root privileges then install the dvb utilities with

  # yum install dvb-apps

The program dvbscan will need some idea of where to start searching; for this reasons it takes a file for your location as a starting point. Therefore, you need to find channel information for your locality. Again, the location where they are installed may vary. For Fedora Core 6 the directory for DVB-S users (Satelite) should use the location files under /usr/share/dvb-apps/dvb-s/. DVB-C location files (Cabel Broadcast) are placed under the directory /usr/share/dvb-apps/dvb-c and Terrestial broadcast under the directory /usr/share/dvb-apps/dvb-t. In each case, the name of the file you're looking for is of the form cc-Ttttt, where cc is a two-letter country abbreviation, and Ttttt is the name of the location of the transmitter. So in Oslo, Norway, you'd look for a file called no-Oslo; the following example relates to the company CanalDigital in Norway.

[mythtv@mythpc dvb-apps]$ pwd
/usr/share/dvb-apps
[mythtv@mythtv dvb-c]$ ls
at-Innsbruck   at-Vienna         ch-Video2000         de-iesy      fi-3ktv  fi-Joensuu-Tikka  lu-Ettelbruck-ACE
at-Liwest      be-IN.DI-Integan  ch-Zuerich-cablecom  de-Muenchen  fi-HTV   fi-TTV            no-Oslo-CanalDigital
at-SalzburgAG  ch-unknown        de-Berlin            de-neftv     fi-jkl   fi-vaasa-oncable  se-comhem
[mythtv@mythtv dvb-c]$ 

I use Grimstad cabeltv. I did not find any channel information file I could use. But I find one for Norway no-Oslo-CanalDigital which I first take a copy of and then edited it. I got the correct Frequency setting, Symbol Rate and QAM Mode from the menu the cable box Grimstad cabeltv delivered me.

[mythtv@mythpc ~]$ cat no-Grimstad-CanalDigital
# no-Grimstad-CanalDigital (cable)
# Frequency, Symbol Rate, QAM Mode
C 410000000 6875000 NONE QAM64
C 418000000 6875000 NONE QAM64
C 426000000 6875000 NONE QAM64
C 442000000 6875000 NONE QAM64
C 450000000 6875000 NONE QAM64
C 458000000 6875000 NONE QAM64
C 466000000 6875000 NONE QAM64
C 474000000 6875000 NONE QAM64
C 482000000 6875000 NONE QAM64
C 490000000 6875000 NONE QAM64
C 498000000 6875000 NONE QAM64  

After I have edited the channel information file I did a scan. This should produce output saying "WARNING: >>> tuning failed!!!" if a signal was not found on that particular frequency. Eventually, a list of services found should be displayed (Radio, TV, EPG). Here is a sample list where you see the radio and TV channels found. Remark: The scandvb program output TV and radio channels as scrambled (encrypted) without being encrypted sometimes.

[mythtv@mythpc ~]$ /usr/bin/scandvb no-Grimstad-CanalDigital 
scanning no-Grimstad-CanalDigital
using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
initial transponder 410000000 6875000 0 3
initial transponder 418000000 6875000 0 3
initial transponder 426000000 6875000 0 3
initial transponder 442000000 6875000 0 3
initial transponder 450000000 6875000 0 3
initial transponder 458000000 6875000 0 3
initial transponder 466000000 6875000 0 3
initial transponder 474000000 6875000 0 3
initial transponder 482000000 6875000 0 3
initial transponder 490000000 6875000 0 3
initial transponder 498000000 6875000 0 3
>>> tune to: 410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64
0x0000 0x05eb: pmt_pid 0x0000 Telenor -- NRK mP3 (running)
0x0000 0x05ea: pmt_pid 0x0000 Telenor -- NRK Stortinget (running)
0x0000 0x05e6: pmt_pid 0x0000 Telenor -- NRK Sami Radio (running)
0x0000 0x05de: pmt_pid 0x0000 Telenor -- NRK2 (running, scrambled)
0x0000 0x05e3: pmt_pid 0x0000 Telenor -- NRK Klassisk (running)
0x0000 0x05e1: pmt_pid 0x0000 Telenor -- NRK P3 (running)
0x0000 0x05e0: pmt_pid 0x0000 Telenor -- NRK P2 (running)
0x0000 0x05df: pmt_pid 0x0000 Telenor -- NRK P1 (running)
0x0000 0x0db3: pmt_pid 0x0000 (null) -- NRK1 sorlandet (running)
0x0000 0x0870: pmt_pid 0x0000 (null) -- ZTV Norway (running, scrambled)
0x0000 0x0456: pmt_pid 0x0000 Viasat -- TV3 Norge (running, scrambled)
0x0000 0x05f9: pmt_pid 0x0000 Telenor -- Radio Paris Oslo (???)
0x0000 0x05f7: pmt_pid 0x0000 Telenor -- KANAL 24 (???)
0x0000 0x0076: pmt_pid 0x0000 Telenor -- P4 (???)
0x0000 0x01ff: pmt_pid 0x0000 Telenor -- NRK Alltid Nyheter (???)
0x0000 0x05e4: pmt_pid 0x0000 Telenor -- TV2 Norge (???, scrambled)
>>> tune to: 418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64
Network Name 'Multiplexer'
0x0000 0x05e5: pmt_pid 0x0000 Telenor -- TVNorge (???, scrambled) 

Remember to stop the mythbackend daemon when you do this

[root@mythpc mythtv]# /sbin/service mythbackend stop

Saving to channels.conf

Next try to create a "channels.conf". I make a hidden directory called .czap because I shall use czap to tune in the channels. Czap is only for cable broadcasting, then you have tzap for terrestial and then szap for satelite.

[mythtv@mythpc ~]$ mkdir .czap
[mythtv@mythpc ~]$ /usr/bin/scandvb /home/mythtv/no-Grimstad-CanalDigital > /home/mythtv/.czap/channels.conf  

Next display the contents of the channels.conf file to make sure the file creation proceeded correctly

[mythtv@mythpc ~]$ cat /home/mythtv/.czap/channels.conf
NRK mP3:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:706:1515
NRK Stortinget:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:705:1514
NRK Sami Radio:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:49:1510
NRK2:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:525:47:1502
NRK Klassisk:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:703:1507
NRK P3:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:702:1505
NRK P2:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:701:1504
NRK P1:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:35:1503
NRK1 sorlandet:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:512:640:3507
ZTV Norway:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:2161:2162:2160
TV3 Norge:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:1111:1112:1110
Radio Paris Oslo:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:704:1529
KANAL 24:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:700:1527
P4:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:692:118
NRK Alltid Nyheter:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:660:511
TV2 Norge:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:514:668:1508
TVNorge:418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:515:672:1509
Disney Channel:418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:520:673:3206
TV4:418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:35:37:1602
SVT2:418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:512:640:3001
SVT1:418000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:517:660:2702
Star-Showtime:426000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:520:672:2507
Eurosport:426000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:513:645:905
Animal Planet:426000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:1000:1001:407
Discovery:426000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:900:901:406
Nat Geo Channel:426000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:400:401:201
Infokanalen        :442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:530:291:1
BBC World:442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:513:644:1001
TV 2 Nyhetskanalen:442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:515:652:149
TV 2 Zebra:442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:34:676:1839
SportN:442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:4061:4062:4060
Voice (NO):442000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:514:648:3202
Hlm:450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:1000:1001:1
CNN International:450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:700:701:202
Hlm_Jtx:450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:1100:1101:230
Travel Channel:450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:512:640:203
MTV (N):450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:600:601:205
TV 2 Filmkanalen:450000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:522:664:153
TV1000 Plus One:466000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:5051:5053:5050
EPG:466000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:0:0:1190

Verifing channel tuning

Then you can try to tune in one of the channels using the Programidentification (PID) from the channels.conf file.

[mythtv@mythpc ~]$ /usr/bin/czap -r -c /home/mythtv/.czap/channels.conf "ZTV Norway"

which in turn displays lines similar to (terminate with Ctrl-C)

using '/dev/dvb/adapter0/frontend0' and '/dev/dvb/adapter0/demux0'
10 ZTV Norway:410000000:INVERSION_AUTO:6875000:FEC_NONE:QAM_64:2161:2162:2160
10 ZTV Norway: f 410000000, s 6875000, i 2, fec 0, qam 3, v 0x871, a 0x872
status 00 | signal 01ff | snr 0235 | ber 00000000 | unc 00000000 | 
status 1f | signal 02f8 | snr 0eb4 | ber 00000000 | unc 00000000 | FE_HAS_LOCK
 ... (repeated output) ...

Adding channels to database

Importing channels.conf

MythTV 0.20 can import the channels.conf made above into the database. (NB! The importing of channels.conf file was broken after Mythtv 0.20 rev. 11682. This has been fixed 20.04.2007 [8]) You must stop the mythbackend service before you start up mythtv-setup

[root@mythpc mythtv]# /sbin/service mythbackend stop
[root@mythpc mythtv]$ mythtv-setup

In the Mythtv-setup menu choose:

2. Capture Card

Then you must choose which Card Type you have. I choose the "DVB DTV capture card (v 3.x)" profile. The rest of the DVB configuration was automatically done when I used this profile. After the Capture Card configuration has been done enter the Finish button.

Mythtvsetup-dvbsetup.jpg

In the Mythtv-setup menu choose:

3. Video Sources

Here you must enter the Video source name. I called the Video source "Kabeltv". Then you must choose which country you live in. If you have choosen the correct channel frequency table in Mythtv-setup Menu --> General then you can choose Default here. If not you must specify Europa-West. When you enter the Finish button a new terminal window will start up in the background. You can use the Alt-F2 or Alt-F3 button on the keyboard then you can get the terminalwindow in the front. Mythtv-setup will make a configuration file named Kabeltv.xmltv under the hidden directory /home/mythtv/.mythtv after mythtv-setup exits. Say No to the question about configuring Xmltv. We are going to do this after mythtv-setup are finished. This is a different and a more manually approach of importing xmltv id into the Mythtv database but it works for me.

Video-source setup.jpg

After the Video Sources configuration has been done go back to Mythtv-setup and choose:

4. Input Connections

Here you must choose the DVB input connection. In the next window you must choose the video source "Kabeltv". In the same place you can choose to Scan for DVB channels using the channels.conf file we have made above. After the import have been done you should have all the radio and tv channels on your cable imported into the Mythtv database. You must edit this data to be useful for Mythtv. You can use Mythtv-setup Channel Editor which are the next step in mythtv-setup or Mythweb to do this. I used Mythweb.

Import channels.jpg

When you have finished the mythtv-setup remember to start up the mythbackend daemon:

[root@mythpc mythtv]# /sbin/service mythbackend start

Editing channels in Mythweb

Not all data will be imported from the channels.conf so you must edit with mythweb the channels after this has been done. This can be done in Mythweb from this page http://localhost/mythweb/settings/channels You must put in the correct multipex frequency into every channel imported. A easy way to find the multiplex frequency the channel use:

[mythtv@mythpc .czap]$ grep "ZTV Norway" ~/.czap/channels.conf | cut -f2 -d:
410000000
[mythtv@mythpc .czap]$ 

After you have this number copy it and paste it into to Frequency id table in Mythweb (freqid). For saving this into the Mythweb database choose Save in the bottom of the webpage. In the same place in Mythweb you can delete channels, paste the channel's xmltv id (xmltvid), reorder the channels...

Importing EPG data with XMLTV

Here in Norway we use the xmltv grabber tv_grab_no_gfeed. Before mythfilldatabase can import in the electronic program guide data (EPG) we must first insert the correct xmltvid for every tv channel into the Mythtv database. This can be done with MythTV channel info webpage (http://localhost/mythweb/settings/channels). We must first let tv_grab_no make a xml file for us to use. The first time tv_grab_no start up you must make a config file which are stored under the hidden directory /home/mythtv/.xmltv/tv_grab_no_gfeed.conf. The perl script tv_grab_no will ask you about which tv channels who want to have the epg data for.

[mythtv@mythpc ~]$ tv_grab_no_gfeed  --configure
The file at this URL describes which channels are available and where data can be found for them.
Root URL for grabbing data: [9]
tv_grab_no_gfeed uses a cache with files that it has already downloaded. Please specify where the cache shall be stored.
Directory to store the cache in: [/home/mythtv/.xmltv/cache]
Select the channels that you want to receive data for.
TV 1000 Action [yes,no,all,none (default=no)]

After you have finished the configuration then you must run tv_grab_no_gfeed and get EPG data for one day. This .xml file will give you the xmltvid you are going to insert into the mythconverg database

[mythtv@mythpc ~]$ tv_grab_no_gfeed --output /home/mythtv/epg.xml --days 1
downloading listings: 100% [=======================================================================]
[mythtv@mythpc ~]$
[mythtv@mythpc ~]$ less /home/mythtv/epg.xml
<?xml version='1.0' encoding='ISO-8859-1'?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv>
 <channel id="animalplanet.discovery.no">
   <display-name lang="nb">Animal Planet</display-name>
 </channel>
 <channel id="bbcworld.com">
   <display-name lang="en">BBC World</display-name>
 </channel>
 <channel id="discovery.no">
   <display-name lang="nb">Discovery Channel</display-name>
 </channel>

Then you must copy the channel id name for the channel you want EPG data for and past it into the xmltvid table for this channel in MythWeb's channel editor page. You can also do this from Mythtv-setup channel editor.

After you have done this you must copy the tv_grab_no_gfeed.conf from the hidden .xmltv directory to the hidden .mythtv directory in your home directory. Then you must rename the tv_grab_no_gfeed.conf to the name you have choosen for the Video Sources in the Mythtv-setup. For me the name I have choosen in this setup was "Kabeltv".

[mythtv@mythpc .xmltv]$ cp tv_grab_no_gfeed.conf /home/mythtv/.mythtv/
[mythtv@mythpc .mythtv]$ mv tv_grab_no_gfeed.conf Kabeltv.xmltv

After you configure tv_grab_no_gfeed and setup all the xmltv id's, you will then need to run mythfilldatbase as mythtv.

[mythtv@mythpc ~]$ mythfilldatabase
2007-09-24 11:15:22.636 Using runtime prefix = /usr
2007-09-24 11:15:22.650 New DB connection, total: 1
2007-09-24 11:15:22.662 Connected to database 'mythconverg' at host: 192.168.1.5
2007-09-24 11:15:22.668 New DB connection, total: 2
2007-09-24 11:15:22.672 Connected to database 'mythconverg' at host: 192.168.1.5
2007-09-24 11:15:22.708 Updating source #1 (Kabeltv) with grabber tv_grab_no_gfeed
2007-09-24 11:15:22.709 Found 22 channels for source 1 which use grabber
2007-09-24 11:15:23.421 Grabber has capabilities: baseline manualconfig tkconfig apiconfig cache
2007-09-24 11:15:23.421
2007-09-24 11:15:23.421 Checking day @ offset 0, date: Mon Sep 24 2007
2007-09-24 11:15:23.441 Data is already present for Mon Sep 24 2007, skipping
2007-09-24 11:15:23.442
2007-09-24 11:15:23.442 Checking day @ offset 1, date: Tue Sep 25 2007
2007-09-24 11:15:23.442 Data Refresh always needed for tomorrow
2007-09-24 11:15:23.442 Refreshing data for Tue Sep 25 2007
2007-09-24 11:15:23.443 New DB connection, total: 3
2007-09-24 11:15:23.447 Connected to database 'mythconverg' at host: 192.168.1.5
2007-09-24 11:15:23.449 Grabber Command: nice tv_grab_no_gfeed --config-file '/home/mythtv/.mythtv/Kabeltv.xmltv' --output /tmp/mythVb5faC --days 1 --offset 1
2007-09-24 11:15:23.449 ----------------- Start of XMLTV output -----------------
downloading listings:  35% [========================

Importing EPG with tv_grab_dvb for users without XMLTV grabbers

One of the DVB-C channels was for EPG data. Mark Bryars have developed a program which dump the dvb epg info into a xmltv format[10]. Download the source from his website. Unpack the tv_grab_dvb.tar.gz file.

[mythtv@mythpc ~]$ tar -xzf tv_grab_dvb-0.9.tar.gz
[mythtv@mythpc ~]$ cd tv_grab_dvb-0.9

You don't have to compile the source (i never did). Tune first into a mulitplex:

$ /usr/bin/czap  -r -c ~/.czap/channels.conf "ZTV Norway"

then you start opp the tv_grab_dvb program in a another terminal and dump the epg data into the .xml file:

[mythtv@mythpc tv_grab_dvb-0.9]$ ./tv_grab_dvb > whatson.xml
Status: 4137 pkts, 270 prgms, 0 updates, 0 invalid, 3 CRC err./tv_grab_dvb: 
[mythtv@mythpc tv_grab_dvb-0.9]$ less whatson.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE tv SYSTEM "xmltv.dtd">
<tv generator-info-name="dvb-epg-gen">
<channel id="4220.dvb.guide">
       <display-name>BBC ONE Scot</display-name>
</channel>
<channel id="4284.dvb.guide">
       <display-name>BBC TWO Scot</display-name>
</channel>
<channel id="8273.dvb.guide">
       <display-name>Scottish&TV</display-name>
</channel>
<channel id="8384.dvb.guide">
       <display-name>Channel 4</display-name>
</channel>

Then you can import the the epg data into Mythtv. Before you do this the xmltv id must be edited into every channel (more to come here)

$ ./tv_grab_dvb | mythfilldatabase --no-delete --file 1 0 -

Reference

Howto install DVB [11]
First step with a DVB device [12]
Adding Digital Cable Channels for ATSC/QAM Tuner Cards -- USA/Canada[13]