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.
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:
cd /lib/firmware/ 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:
sudo -s apt-get update apt-get install dvb-apps minisapserver vlc
– 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 cd bitstream sudo make install git clone git://git.videolan.org/dvblast cd 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 # http://www.rsm.govt.nz/cms/policy-and-planning/current-projects/broadcasting/digital-television-2007-frequency-plan # # 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:
TV ONE:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:280:330:1200 TV2:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:281:331:1201 U:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:282:332:1202 TVNZ 7:682000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:283:333:1203 TV3:698000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:450:400:1300 FOUR:698000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:451:401:1301 TV3 PLUS1:698000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_16:HIERARCHY_NONE:452:402:1302 C4:698000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_3_4:FEC_AUTO:QAM_64:TRANSMISSION_MODE_8K:GUARD_INTERVAL_1_
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.
/home/localadmin/M1.cfg ;TV1 184.108.40.206:5004 1 1200 [ff08::1]:5004@[2001:17:17::1] 1 1200 ;TV2 220.127.116.11:5004 1 1201 [ff08::2]:5004@[2001:17:17::1] 1 1201 ;TVNZU 18.104.22.168:5004 1 1202 [ff08::6]:5004@[2001:17:17::1] 1 1202 ;TVONE+1 22.214.171.124:5004 1 1205 [ff08::7]:5004@[2001:17:17::1] 1 1205
/home/localadmin/M2.cfg ;TV3 126.96.36.199:5004 1 1300 [ff08::3]:5004@[2001:17:17::1] 1 1300 188.8.131.52:5004/mtu=2000 1 1300 ;FOUR 184.108.40.206:5004 1 1301 [ff08::4]:5004@[2001:17:17::1] 1 1301 ;TV3PLUS1 220.127.116.11:5004 1 1302 [ff08::5]:5004@[2001:17:17::1] 1 1302 ;C4 18.104.22.168:5004 1 1303 [ff08::8]:5004@[2001:17:17::1] 1 1303
/home/localadmin/M3.cfg ;PRIME 22.214.171.124:5004 1 1404 [ff08::9]:5004@[2001:17:17::1] 1 1404 ;Maori TV 126.96.36.199:5004 1 1400 [ff08::10]:5004@[2001:17:17::1] 1 1400 ;Parliament TV 188.8.131.52:5004 1 1401 [ff08::11]:5004@[2001:17:17::1] 1 1401 ;Trackside 184.108.40.206:5004 1 1402 [ff08::12]:5004@[2001:17:17::1] 1 1402 ;ChineseTV 220.127.116.11:5004 1 1403 [ff08::13]:5004@[2001:17:17::1] 1 1403 ;TV9 18.104.22.168:5004 1 1413 [ff08::14]:5004@[2001:17:17::1] 1 1413 ;TV33 22.214.171.124:5004 1 1405 [ff08::15]:5004@[2001:17:17::1] 1 1405 ;ChoiceTV 126.96.36.199:5004 1 1407 [ff08::16]:5004@[2001:17:17::1] 1 1407 ;BaseFM 188.8.131.52:5004 1 2002 [ff08::20]:5004@[2001:17:17::1] 1 2002 ;RadioNZ National 184.108.40.206:5004 1 2000 [ff08::21]:5004@[2001:17:17::1] 1 2000 ;RadioNZ Concert 220.127.116.11: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 [global] # Number of seconds between announces. 5 is default. Internet announces better use 30. sap_delay=5 # The network interface on which to stream. #interface=eth2 [program] type=rtp name=TV1 user=localadmin machine=tvserver site=mattie47.com address=18.104.22.168 port=5004 [program] type=rtp name=TV1v6 user=localadmin machine=tvserver site=mattie47.com address=ff08::1 port=5004
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.