First of all I can’t help but recommend you read the Angry Technician’s post How to stream EVERY channel from Freeview onto your network as he’s written an excellent tutorial on what I’m going to also try and explain below. I’ve spent some time fine tuning (huh, get it? cause we’re tuning in…oh forget it) my setup based on his tutorial and hopefully it will provide you with some more examples and help in getting TV streaming across your network.
What you will need:
– Some technical knowledge.
You could say this is quite an ambitious project and you’ll need to be able to do things like install linux on a dedicated machine, install tuners, get drivers working etc. If all this is new to you, good luck, and I still recommend you give it a go, but I can’t promise I’ll be able to help you if you get stuck. Admittedly I got it all working within a couple of hours, and at the time of first setting this up, I was quite a linux novice. Through this project, I have acquired a lot of skills and knowledge of linux, so for me it’s been very good.
– Actually a bit of technical [networking] knowledge
Sweet so you have some linux knowledge maybe? That’s great but this could become quite an intermediate to expert project. It really depends on the network you’re plugging the TV Box into.
I would highly recommend at minimum you use a Gigabit Switch in your network. There’s quite a lot of ways you could have the traffic flow to clients, and each configuration suits different scenarios. E.G. If you have specific hosts purely for receiving TV, you could simply have a separate VLAN the TV box and clients are connected to. Traffic would then just spam out all connected ports in the VLAN, basically this would be a broadcast network. This probably isn’t practical though, and what you would do instead is enable a feature called IGMP Snooping (and possibly filtering). This will probably be satisfactory enough for small networks, but if you are running the multicast over a layer 3 network, you will need to have a look at PIM-DM or PIM-SM.
I’m a network engineer but found this project quite full on getting it working throughout the network it’s currently running in (quite a few layer 3 switches using PIM-SM). I put this under intermediate to expert because if you’re running this through a layer 3 network, that’s exactly where it’s defined by Cisco. Cisco documentation and configuration is minimal in the Cisco CCNP curriculum, and only the CCIE Routing and Switching book will you find a bit more detail. If your network is small and all you have is a managed layer 2 switch[s] you’re probably fine, as you’ll only need to enable IGMP Snooping and possibly filtering on your devices. Don’t let above drive fear into you in trying to set this up, but you may just need to do a bit of background reading on multicasting 🙂
-At least 1 Terrestrial or Satellite TV tuner.
This really comes down to your budget and how many channels you want to be able to stream. Basically you will need at least 1 tuner per frequency for channels you want to receive. Here in Christchurch NZ, we currently have 16 TV channels and 3 Radio stations transmitted over 3 frequencies. This means I only need 3 tuners to be able to stream all channels at once. Effectively 1 dual TV card and 1 single tuner.
– Dedicated PC
This could just be an old 1GHZ pc with 1gb of ram. Nothing fancy, as we’re simply sending the received digital data and multicasting the traffic on to the network. A 1Gbit Network card would be recommended though. Make sure you have enough free PCI/PCI-E/USB ports for Tuners though.
The box after inserting several NICs and the Tuners
Post OS installation
I won’t go into detail with physical installation, nor installing your choice of linux (I recommend Ubuntu 12.04) but once you do have it installed, probably the first thing I’d suggest you do is make sure your tuners are coming up correctly and working. Simply open a terminal and enter “ls /dev/dvb/”
Depending on how many tuners you have, you should see adapter0 and up for each tuner. If you don’t see any tuners, it’s probably time to start googling support for your tuner, but you can also find more log info by typing dmesg. I’m simply suggesting all this as the HVR2210 didn’t work out of the box for me. If you have this card, I believe my solution was:
sudo wget http://www.steventoth.net/linux/hvr22xx/firmwares/4019072/NXP7164-2010-03-10.1.fw
Reboot the machine
Still with me? Lets get started!
Programs to install:
- Ubuntu 12.04
- VLC 2.0.1 – Possibly not needed, but very helpful for diagnosis
- Vino – VNC Server that comes with Ubuntu
- dvb-apps (A package containing various different tools for dvb cards)
- dvblast (Made by the same people as VLC. This is what multicasts all the channels out)
- minisapserver (for creating the channel playlist in VLC)
- udpxy (converts the RTP multicast streams into unicast HTTP streams. Currently useful for viewing the TV streams on wireless devices.)
Open a terminal and enter the following:
apt-get install dvb-apps minisapserver vlc
- Sudo is basically running the command as administrator, like in win 7 opening command prompt by right clicking it and “run as administrator”. -s is opening a shell, so you’re opening a shell as root so you can enter any commands in it you want without having to be asked to run it as admin (as such).
– Apt-get would probably be one of my favorite things since using linux. Ubuntu/linux comes pre-loaded with a database of websites hosting apps and utilities that you can request to download from without having to manually go to the website, find the download link, wait for it to finish and then install. Instead you can do above and it will download it and install it for you! There’s also a gui “app store” as such called synaptic package manager, and also the ubuntu software center.
You could also simply add dvblast to that list above, but I believe I had issues with SD channels (sound not working) which resulted in me needing the current unstable version. More info is available on the commands below again on another Angry Tech post, but simply copy and paste below in a terminal and it “should” install fine. I’ve done this on linux mint and ubuntu with no issues.
sudo apt-get install git
git clone git://git.videolan.org/bitstream
sudo make install
git clone git://git.videolan.org/dvblast
sudo make install
DVBlast is now installed so we can now get on to the first step which is scanning your local terrestrial tower. DVB-apps comes with some configs for different terrestrial towers, and you can see if your local one already exists by typing “ls /usr/share/dvb/dvb-t/”
In my case, my local tower here in Christchurch New Zealand didn’t exist, so I just entered “sudo gedit” into a terminal, which opens the gui text editor, and created and saved the following:
Sugarloaf, Christchurch NZ
# Channel allocation details for NZ can be found at
# T freq bw fec_hi fec_lo mod transmission-mode guard-interval hierarchy
# Multiplex DA
T 562000000 8MHz 3/4 NONE QAM64 8k 1/16 NONE
# Multiplex DB
T 578000000 8MHz 3/4 NONE QAM64 8k 1/16 NONE
# Multiplex DC
T 594000000 8MHz 3/4 NONE QAM64 8k 1/16 NONE
I had to find out the frequencies used, which wasn’t too hard. Just do a google and find out what your local tower is and what frequencies are used.
Once you have your configuration file sorted, we use a program called “scan” which does just that. It will tell us the all important PIDs (the unique identifiers for each channel) and a lot of other helpful information.
Just run the following command, which will output what it finds into a file called channels.txt
scan /usr/share/dvb/dvb-t/nz-christchurch -u > channels.txt
If you open channels.txt, you will find something similar to the following:
The only thing we’re really interested in is the Channel, the frequency, and the PID. These are the first and last values, so as an example with the first one, the channel is TV ONE, the frequency is 682MHZ, and the PID= 1200, which I also made bold as you can see.
What you now need to do, is make a config file for each frequency which will then be used for each tuner. So if your local tower has 3 frequencies, you will need 3 config files, and 3 tuners.
I’d suggest you just make a folder in your home directory called dvb, which you store each config file in.
Below are my 3 config files.
22.214.171.124:5004 1 1200
[ff08::1]:5004@[2001:17:17::1] 1 1200
126.96.36.199:5004 1 1201
[ff08::2]:5004@[2001:17:17::1] 1 1201
188.8.131.52:5004 1 1202
[ff08::6]:5004@[2001:17:17::1] 1 1202
184.108.40.206:5004 1 1205
[ff08::7]:5004@[2001:17:17::1] 1 1205
220.127.116.11:5004 1 1300
[ff08::3]:5004@[2001:17:17::1] 1 1300
18.104.22.168:5004/mtu=2000 1 1300
22.214.171.124:5004 1 1301
[ff08::4]:5004@[2001:17:17::1] 1 1301
126.96.36.199:5004 1 1302
[ff08::5]:5004@[2001:17:17::1] 1 1302
188.8.131.52:5004 1 1303
[ff08::8]:5004@[2001:17:17::1] 1 1303
184.108.40.206:5004 1 1404
[ff08::9]:5004@[2001:17:17::1] 1 1404
220.127.116.11:5004 1 1400
[ff08::10]:5004@[2001:17:17::1] 1 1400
18.104.22.168:5004 1 1401
[ff08::11]:5004@[2001:17:17::1] 1 1401
22.214.171.124:5004 1 1402
[ff08::12]:5004@[2001:17:17::1] 1 1402
126.96.36.199:5004 1 1403
[ff08::13]:5004@[2001:17:17::1] 1 1403
188.8.131.52:5004 1 1413
[ff08::14]:5004@[2001:17:17::1] 1 1413
184.108.40.206:5004 1 1405
[ff08::15]:5004@[2001:17:17::1] 1 1405
220.127.116.11:5004 1 1407
[ff08::16]:5004@[2001:17:17::1] 1 1407
18.104.22.168:5004 1 2002
[ff08::20]:5004@[2001:17:17::1] 1 2002
22.214.171.124:5004 1 2000
[ff08::21]:5004@[2001:17:17::1] 1 2000
126.96.36.199:5004 1 2001
[ff08::22]:5004@[2001:17:17::1] 1 2001
What’s this doing? the semicolon is just specifying a comment purely in this case just to help you identify the channel. Next line in the multicast address chosen:port chosen. 1 sets the stream to always be on, followed by the unique channel PID.
If you looked closely you will notice I’m also doing IPv6. IPv6 addresses must be specified in brackets due to using semicolons (which would otherwise be followed by a port). As I mentioned earlier, this machine has several network cards in it. I then have the IPv6 address specified that I want the IPv6 multicast to send out of. Otherwise the stream will default to eth0. This is specific to where this box is used and your set up will probably be quite different.
Note here that you could have used a route in the linux routing table to also specify the out going network card. This is what I had set up before knowing that I could use DVBlast to specify out. The reason I changed it though is because after an unspecified amount of time, routing would stuff up and the IPv6 multicast started sending out with the IPv6 link-local address, not the global-address, which had bad results due to using a layer 3 switched network.
Now that the config files are done, it’s time to actually start the streams.
Continuing with my example, put the following 3 commands in separate terminal windows:
For tuner 0 (TVNZ Frequency):
dvblast -a 0 -c /home/localadmin/dvb/M1.cfg -f 578000000 -m qam_64 -b 8 -e
For tuner 1 PRIME/KORDIA Frequency):
dvblast -a 1 -c /home/localadmin/dvb/M3.cfg -f 594000000 -m qam_64 -b 8 -e
For tuner 2 (Mediaworks Frequency):
dvblast -a 2 -c /home/localadmin/dvb/M2.cfg -f 562000000 -m qam_64 -b 8 -e
Here’s what each parameter does:
-a n tells dvblast to use tuner number n for this multiplex. Obviously, you can’t use each tuner more than one at any one time. Numbering starts at 0, not 1.
-c nameoffile.cfg tells dvblast to use the config file you just write. It doesn’t matter where you save it.
-f 000000000 is where you specify the frequency for this multiplex.
-m qam_x the modulation type for this multiplex. And then…
-b n the bandwidth for this multiplex.
-e Finally, -e tells dvblast to also stream the EPG data.
If you wanted to do them all in 1 terminal, just put “&” on the end of the command, enter, then the next dvblast instance.
Now you should be able to open VLC and type in each multicast address to view each stream (provided you have a route on your host [and the sever] to the multicast range.
2.5 SAP configuration
SAP allows you to simply pick the channels from a nice friendly list of channel names in vlc playlist. All you need to do is create a config file for it like below, and save it to /home/localadmin/dvb/sap.cfg
# sap.cfg - Configuration file of the mini SAP server
# Global miniSAPserver options
# Number of seconds between announces. 5 is default. Internet announces better use 30.
# The network interface on which to stream.
Then open a terminal and run: sapserver -c /etc/dvb/sap.cfg
It looks like SAP announcements was implemented in one of the latest versions of DVBlast as seen here.
So, I hope this was helpful in getting multicast IPTV streaming on your network. Possibly a bit of work, but it’s pretty cool to have setup. If you’ve gone through above, there’s also another pretty good IPTV multicast program for linux called MuMuDVB. I’d recommend also checking it out.