SureWest IPTV

From MythTV Official Wiki
Revision as of 20:12, 19 April 2011 by Mythboy (talk | contribs) (Mythtv Channel Configuration)

Jump to: navigation, search

SureWest uses IPTV by sending the raw MPEG2TS (or as of 5/24/2009, h264) stream directly to a UDP multicast address. This means it's relatively easy to set up mythtv. Their DVR interface is horrible, and so mythtv is a huge step up. If you order their DVR, you should be allowed to record two channels at once by setting up two identical tuners. For two tuners to work correctly, you need at least SVN revision 18969 (on the 0.21 branch.) Otherwise it works around half the time. PIP also works sometimes.

On my box, recording two channels at once makes watching a third unusable (too choppy) but with a very fast CPU and disk subsystem you might be able to record perhaps three or four channels and still watch something.

What you need

  • MythTV 0.21 or better with the built-in IPTV tuner
  • SureWest Fiber IPTV
  • An Amino or DVR settop box
  • A spare network port on your mythtv box (sharing with your WAN network is a very bad idea). This card needs to support software setup of the MAC address (most do).
  • As of 5/24/2009, SureWest has switched from MPEG2 streams to h264 for their HD channels. For this reason, a video card supporting VDPAU is recommended for an HDTV frontent, unless the frontend has a very powerful CPU.

Mythtv Setup

  • Before you shut down your old cable box, it's a good idea to write down the channels you actually get. I boot my old box up occasionally to see if there are any new channels available.
  • Get your cable box MAC. This is written right on the box, usually on the bottom or the side. You need it to fool SureWest that everything is coming from your registered MAC.
  • Force the MAC address on your spare network card to match the one on your set-top box. Exactly how to do this varies per distro; for gentoo, add this to /etc/conf.d/net:
mac_eth2="NN:NN:NN:NN:NN:NN"
  • Set the mythtv box to use DHCP. Do not allow dhcp to set the default route or the DNS. Instead, force a route as follows (substitute ethN for the correct network card name):
 route add -net 224.0.0.0/4 ethN

Again, specifics of how to get this to work varies per distro; on Gentoo, put something like this in /etc/conf.d/net:

config_eth2=( "dhcp" )
dhcpcd_eth2="-G -R"
routes_eth2=( "224.0.0.0/4" )
  • Switch your system to use IGMP v2:
# echo 2 > /proc/sys/net/ipv4/conf/all/force_igmp_version
# echo 2 > /proc/sys/net/ipv4/conf/default/force_igmp_version
  • Make SURE the reverse packet filter (rp_filter) is off (disabled):
# cat /proc/sys/net/ipv4/conf/all/rp_filter
1
# echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
# cat /proc/sys/net/ipv4/conf/all/rp_filter
0

Also verify that /proc/sys/net/ipv4/conf/default/rp_filter is off for your next reboot. Packets come from someplace that is not routed to this interface, so you get nothing unless this is disabled. To make this persistent, add the following to /etc/sysctl.conf:

net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.all.rp_filter = 0
  • Unplug the network cable from your operating set-top box and plug it into your dedicated mythtv box. Bring up the interface. If all goes well, you should have a private IP address (like something in the 10.x.x.x range), not something on the public network. If not, double check your MAC address.
  • Verify that you can watch video. Use "mplayer udp://225.1.100.1:2001" and watch SureWest ads for at least 10 minutes (not a joke; this is to make sure that the IGMP timeouts are all propogating properly). If they are not, double check your IGMP version. If you get nothing, check your rp_filter and make sure there are no firewall rules on your network card.
  • Create an m3u file to correspond to the surewest channels. They use group 225.1.x.y where x=c/100 and y=c%100 (using 100 instead when the result is 0). For example, channel 1 is 225.1.100.1 and channel 255 is 225.1.2.55. Your m3u file should look like this:
#EXTM3U
#EXTINF:0,1 - LOOR001
#EXTMYTHTV:xmltvid=23309
udp://225.1.100.1:2001
#EXTINF:0,2 - WGNSAT
#EXTMYTHTV:xmltvid=17098
udp://225.1.100.2:2001
#EXTINF:0,3 - KCRA
#EXTMYTHTV:xmltvid=10388
udp://225.1.100.3:2001
#EXTINF:0,4 - KQCA
#EXTMYTHTV:xmltvid=10683
udp://225.1.100.4:2001
...

It's hard to get the xmltvids for all the channels. I downloaded the "report" from SchedulesDirect and massaged the data (using perl) to get me started.

  • Using mythtv-setup, create a freebox IPTV "network" tuner in mythtv. Use the m3u file you created when prompted. Scan for channels and save your settings.
  • Set up Schedules Direct for your listings. It sure would be nice to sniff the listings direct from SureWest too, but Schedules Direct is cheap and gives you more in the future.

Mythtv Channel Configuration

A quick way to setup all the channels is to use the following python script: To Prep the script make sure you copy the report and save it to a readable location such as /tmp/channels. I just copied the report and pasted it into a file called /tmp/channels. The format should be this:

1       23309   LOOR001         Local Origination - LOOR001
2       17098   WGNAMER         WGN America
3       10388   KCRA    KCRA

where the spaces are tabs.

#!/usr/bin/python

import os, sys

file = "/tmp/channels"

for line in open(file):
    div = line.split()
    print "#EXTINF:0,%s - %s" % (div[0],div[2])
    print "#EXTMYTHTV:xmltvid=%s" % (div[1])
    chandiv = div[0]
    count = len(div[0])
    if count == 1:
      print "udp://225.1.100.%s:2001" % (chandiv[0])
    elif count == 2:
      print "udp://225.1.100.%s%s:2001" % (chandiv[0],chandiv[1])
    elif count == 3:
      if chandiv[1] == "0" and chandiv[2] == "0":
        print "udp://225.1.%s.100:2001" % (chandiv[0])
      else:
        print "udp://225.1.%s.%s%s:2001" % (chandiv[0],chandiv[1], chandiv[2])

Execute the script like so

python script.py > /home/mythtv/list.m3u

This will output all the channels to a file that you can call when setting up your video input. Under the Freebox option in your input where it asks for the channel locations, remove the URL and simply enter /home/mythtv/list.m3u. (Newer versions of MythTV use the common URL format: file:///home/mythtv/list.m3u) Continue your configuration as usual.