How to stream Freeview HD (DVB-T2) over multicast using dvblast, you Idiots

This is a follow-up to my earlier post, How to stream EVERY channel from Freeview onto your network. If you’re new to this, you’ll want to go and read that one first, or a lot of this article won’t make sense.

Almost a year ago now, the first DVB-T2 USB tuner shipped in the form of the pctv 290e nanoStick T2, and work began on getting it working under Linux. Thanks to the sterling efforts of the developer community, working drivers for this tuner (which is based on the Sony chip) are now shipping as standard with Linux distros that use a kernel version of 3.0 or greater. This includes the recently released Ubuntu 11.10, and since this was my distro of choice for my previous DVB streaming project, I upgraded my streaming server and finally went ahead with buying a nanoStick tuner.

The hardware

At the time of writing, the 290e nanoStick T2 was coming in at just under £80 on Amazon. It comes with a bunch of Windows software I haven’t bothered to look at yet, and few different accessories (including a next to useless sucker-cup portable aerial), but these are the bits from the package you need.

The tuner itself is the size of a fat flash drive, and is about the same weight. That said, you’ll probably still want to use the the included USB flylead to help prevent strain on the USB connector, and you’ll also need the aerial adaptor.

The nanostick only has a small aerial connector, which is what the included aerial uses, but to hook it up to a standard UHF aerial, you use this adaptor.

As expected, Ubuntu detected the tuner immediately and I could tune to a standard definition DVB-T signal straight away using VLC. But we’re not interested in that! We want DVB-T2, for some proper HD goodness. So, lets get started.

Are you ready for this?

Before you get ahead of yourself, make sure you have the following in place unless you want to make things stupidly difficult for yourself:

  1. Make sure you are within range of a transmitter that broadcasts in HD. Honestly, you should probably have checked this before you bought the tuner. In the UK, if your area has been through the digital switchover (i.e. analogue broadcasts have been switched off), then you should be able to get Freeview HD. Some pre-DSO transmitters (such as Crystal Palace in London) also carry HD, but not many of them. Check here if in doubt.
  2. Make sure your Linux install (I used Ubuntu for this guide) is up to date and running a kernel version of 3.0 or later. For Ubuntu, that means installing version 11.10 or later.
  3. Make sure your clients have some fizz in them (the machines receiving the stream, not the server). That old Pentium 4 you’ve got lying around will not have enough processing power to decode an MPEG4 HD stream. It will look awful, if it picks it up at all. Do not come crying to me.
  4. Make sure your network connection can handle it. In my previous guide I recommended you have a 1Gbps connection for the machine doing the streaming, though it wasn’t essential. Well, bad news. If you are already running a bunch of standard definition DVB streams off of the machine, adding 4 HD streams (about 40Mbps extra) will almost certainly push you over 100Mbps, so you really do need a 1Gbps connection now, unless you cut down on the number of channels you want to stream. An alternative would be to add a second 100Mbps network card and split the broadcasting across the two by binding dvblast, but I don’t cover that here because you need to do some damn work yourself, you lazy gits.

Getting the program data

Previously, we used the config files from the dvbapps project to scan for programme data. Unfortunately, due to the digital switchover going on in the UK at the moment, the dvbapps files are not 100% up-to-date for all transmitters. I receive Freeview from the Crystal Palace transmitter, and the details for the HD multiplex are missing.

UPDATE 08/05/13: I’ve recently blogged about using a different scan tool called w_scan that eliminates the need to find out the frequency information in advance, so you can use that method and skip straight to writing the config file if you want a shortcut.

Below is what the ukfree.tv website says about this multiplex. You can find the same information for your transmitter here.

The important bits are circled. The most important bit is the frequency in Hz (not MHz, so multiply by 1,000,000), but also useful is 256QAM (which we reverse into QAM256), the 2/3, and the 32k.

A line for one of the SD multiplexes from the dvb-apps config file for Crystal Palace looks like this:

T 505833000 8MHz 3/4 NONE QAM16 2k 1/32 NONE

Hopefully you can see where the values 554000000, 2/3, QAM256, and 32k can be substituted in here (your values may vary, obviously). The 8MHz stays as 8MHz, so the only value missing is that to replace the 1/32 (which is the guard interval). According to DVB.org, Ofcom specify this as 1/128 for UK DVB-T2. So, we end up with the following, which I saved into a file named uk-CrystalPalaceHD:

T 554000000 8MHz 2/3 NONE QAM256 32k 1/128 NONE

Now run a scan:

scan ~/uk-CrystalPalaceHD -u > channels.txt

The scan command complained about not recognising some of the parameters given in the file, but performed a successful scan anyway (including the SD channels on the same transmitter). The important bits were as follows:

BBC HD:554000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_256:TRANSMISSION_MODE_AUTO:GUARD_INTERVAL_AUTO:HIERARCHY_AUTO:101:102:17472
BBC One HD:554000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_256:TRANSMISSION_MODE_AUTO:GUARD_INTERVAL_AUTO:HIERARCHY_AUTO:6601:6602:17540
ITV1 HD:554000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_256:TRANSMISSION_MODE_AUTO:GUARD_INTERVAL_AUTO:HIERARCHY_AUTO:201:202:17604
Channel 4 HD:554000000:INVERSION_AUTO:BANDWIDTH_8_MHZ:FEC_2_3:FEC_AUTO:QAM_256:TRANSMISSION_MODE_AUTO:GUARD_INTERVAL_AUTO:HIERARCHY_AUTO:301:302:17664

Write your config file

As in the previous guide, this gives us enough information to build a config file for this multiplex to use with dvblast, by taking the SID value from the last column of each row and assigning it to a multicast IP address:

239.255.0.54:5004     1     17472
239.255.0.50:5004     1     17540
239.255.0.51:5004     1     17604
239.255.0.52:5004     1     17664

I saved this file as mpsb3.cfg (as this multiplex is called PSB3 on the Crystal Palace transmitter).

Time to upgrade dvblast

Now, at this point you might be thinking, “hey, all that’s left is to run dvblast”, but unfortunately for you, life is never that simple. As of May 2013, the stable version of dvblast that is available from the standard Ubuntu repositories is version 2.2-1, and that will work fine, but if a version below 2.0 isn’t yet available in your distro repository, you’ll need to compile and install at least version 2.0 from VideoLAN’s git repository. I removed the installed version of dvblast 1.2 first, just to be on the safe side.

(You should issue the following commands from somewhere in your home directory to avoid leaving source code directories in random places on your machine.)

First install git either through subversion or by running apt-get from the command line:

sudo apt-get install git

First we need to fetch and install the bitstream library,which is the only pre-requisite for dvblast:

git clone git://git.videolan.org/bitstream
cd bitstream
sudo make install

Now issue the following commands to get the latest source for dvblast and compile it:

git clone git://git.videolan.org/dvblast
cd dvblast
sudo make install

(I didn’t have to tweak the makefile at all during my test on Ubuntu. Your mileage may vary.)

… and we’re finally ready

Right, after all that tedious rubbish, we are ready to actually run dvblast and watch some HD television.

sudo /usr/local/bin/dvblast -f 554000000 -c ~/mpsb3.cfg -m qam_256 -b 8

If you remember the command from my previous guide, you’ll notice I’ve left off the -e directive, which sends the over-the-air EPG data to the network. I’ve left this off because VLC can’t read the data (yet). The EPG in DVB-T2 is compressed in a way that differs from the DVB-T implementation, and the libraries that VLC relies on don’t support it yet, so the EPG data is garbled. This is a known issue, and I expect it will be fixed in a future update in the coming months. UPDATE 22/02/12: VLC 2.0 has now been released, which has partial support for the new EPG. Anything it can’t decode will be omitted, rather than garbled, so you can safely add the -e directive for DVB-T2 streams now.

Tip:  To reduce skipping, I’ve found it helps  to add the -i 1 parameter to the dvblast command line to set it to realtime priority. This is particularly useful if you already have another 6 tuners on the same system streaming regular DVB, as I do. You shouldn’t need to add it to the commands for your other DVB streams, and it would probably be detrimental to do it for all of them.

Other than that, you should then be able to watch a stream with VLC via rtp://239.255.0.54:5004 and find everything working quite nicely:


The BBC HD channel (even though it may not be around much longer) is good for testing because, unlike the other 3 channels currently on Freeview HD, it always broadcasts shows that were shot in HD. Because the others (BBC1, ITV1, and Channel 4) are simulcasts of the regular Freeview channels, some of their content will be upscaled SD, and won’t look much different from the SD broadcast.

Another reason it’s handy for testing is because in the mornings (during the ‘preview’ period) it runs test screens between some of the previews, such as the audio/video sync check signal and the new HD test card:


(More about these here)

Finishing up

For details on setting up SAP announcements for the streams, and setting everything up to run at boot time without having to start dvblast manually, refer back to my earlier Freeview streaming guide.

As of today, you’ll be shelling out £80 to essentially upgrade 3 (and a bit) of your Freeview channels to HD. This is definitely an optional extra compared to the much better value of getting every Freeview channel available with standard definition tuners, as covered in the earlier guide. It will, however, still be cheaper than buying an Exterity IPTV gateway.

It is worth noting that while BBC channels in particular are available online, you cannot currently get a live stream in HD from iPlayer (and I suspect it will be a year or two at least before that becomes available). If you have HD at home already, you’ll know that for big events (especially sports), HD makes a difference, and if you have some decent projectors in school, it might be well worth spending that little extra.

On a related note, I have learned over the last couple of days that watching cookery shows in HD is a very good way of making yourself hungry.

Was this guide useful? Useless? Do I have a glaring typo or a completely broken script? Feedback in the comments.

Tags: , , , , , , ,

About The Angry Technician

The Angry Technician is an experienced IT professional in the UK education sector. Normally found in various states of annoyance on his blog. All views are those of his imaginary pet dog, Howard.

46 responses to “How to stream Freeview HD (DVB-T2) over multicast using dvblast, you Idiots”

  1. ScottishTech says :

    Ooh! Shiny!!! And in HD…

    That’s a brilliant guide – thank you very much.

  2. ollie says :

    Returning to school IT next year for my placement.. I know what I’ll be setting up in my lunch breaks :P

  3. Meuuh says :

    There is a typo in the second git command (dvbstream instead of dvblast).

  4. Goncalo Azevedo says :

    Hello,
    I am newbie at this questions and i am trying to do something similar to this…
    I already put my DVB-T Stick working but now i am having some problem when i use DVblast to stream because my network became overloaded by my streams and i don’t know why…
    In my project i want to embed the vlc in a php/html page and with the arrows of the keyboard switch the “channel”.
    So my questions are:
    – With Dvblast can i use other then rtp? (because my firefox vlc plugin can’t open rtp connections and i don’t know why if you or someone can give me a help…)
    – Its suppose the lan network became overload with dvblast?
    – the file channel.conf can’t have a different consctuction???because i am from portugal and i can’t do the scan and i have to do the file my own…

    Thanks for the help
    Best regards

    • AngryTechnician says :

      To answer your questions:

      1. dvblast can only use RTP. It’s not designed to use anything else. The standard Firefox VLC plugin can open RTP (I’ve used it myself), so if you’re using the standard one you should try checking your firewall settings.
      2. It is definitely possible your network switch or router could be overloaded by dvblast, especially if it’s cheap or has wireless. Consumer wireless routers might well have trouble handling the multicast traffic as they don’t really design or test them for that.
      3. channel.conf has to have that construction. You might find this link helpful in getting it working, as you aren’t the first person to find there is no transmitter data in dvb-apps for Portugal.
  5. Goncalo Azevedo says :

    RE: 1. About my firewall is disabled…and i steel can’t open RTP streams can you help me?

    NEW: About the streaming there are another good way do stream the channels from my DVB-T USB stick???
    I was thinking like my dvb-t usb stick catches 4 channels in the frequency 754000000 and 8 Mhz of bandwidth using the w_scan for PT and i can stream witch channel using a single instance of the vlc… What you think???can you give me a help????

    Best regards

  6. siva says :

    I bought a DVB-T receiver can I watch DVB-T2 channels using it?

  7. siva says :

    thank you

  8. Skuli434 says :

    Dear sir,
    i have a little problem with dvblast I have configured the system to use dvblast and everything is working , how ever i have an codec problem so how do i change mpeg-2 output of the dvblast to lets say mpeg-4 codec

    i have been reading that dvblast uses bitstream and that is responsible to encode the mpeg-2 by default, but how do you change this default thing .. thank you for the great guide

    Regards

    • The Angry Technician says :

      dvblast does not do the MPEG-2 encoding itself. It just sends just sends the original encoding, whatever that is. If you are receiving standard DVB-T, it will be MPEG-2. If it is DVB-T2, it will be MPEG-4. It is not possible to change the format with dvblast.

  9. spacedvb says :

    Question< I had 8mbps upload ina HD channel it can take over 4.2mbps . if i use a SD channel work fine , but if I execute Only 1 H 2.62 channel I still get alot of des-conection issue , In a theority of 10mbps you can uplaod 4 SD channels and 2 HD channels,. But when i do a test only in 1 H2.62 format start desconecting..

    • The Angry Technician says :

      With that sort of upload speed, are you talking about streaming this via an Internet connection? If so, its unlikely there is anything you can do to prevent skipping. Most consumer Internet connections cannot provide the low network latency required for a big UDP stream like DVB-T2.

  10. Skuli434 says :

    GUYS,
    How can i monitor bandwidth consumption on playing video at the time
    thank you

  11. Craig Breener says :

    Hi Angry Technician,

    I have a problem that has been making me angry. I’m having jittering and packet loss issues when streaming multiple channels from the same transponder when running one instance of dvblast.
    This doesn’t seem to be a throughput issue since the issue does not exist when streaming the same number of channels in multiple instances of dvblast running.

    Any insight would be much appreciated.

  12. jon says :

    Hi Angry’

    FYI, the reference to the “PID” at the end of each channels.conf line – it’s actually the DVB service_id (for that service). See EN 300 468 for details.

  13. Nalin says :

    Hi
    this is brilliant but could you elaborate on the switching architecture in a separate article please ? We have exterity. support is bit rubbish as they keep complaining about our multicast set up etc etc. This will set us free of RM and exterity. i just want to make sure that our Multicast setup is up to scratch.

    • The Angry Technician says :

      The reason I haven’t gone into this before is because a) there’s not much to elaborate on, and b) the configuration is different on pretty much every switch brand.

      Basically, you need switches that are capable of multicast filtering, also called IGMP filtering or IGMP snooping. You need this feature enabled on every switch that is connected to your network (or to the VLAN that carries the IPTV traffic, if you are using VLANs). Any switch that does not have this feature, or has it disabled, will treat the multicast traffic as broadcast, and will likely be swamped with traffic.

      You will only find this feature on managed switches. The option to turn it on is usually in the web interface. If your switch has a command line interface will almost certainly be an option to enable it there.

  14. spacedvb says :

    Hi, I install dvblast was working fin in 1 frequency has 8 multicast adrress, but the strange this is from 8 multicast on 2 i can play becuase when i kill dvblast only show up this end on terminal:
    C^Cinfo: Shutdown was requested.
    debug: removing 239.192.1.20:5000/udp
    debug: removing 239.192.1.21:5000/udp

    This are only 2 multicast can play the rest 22,23,24,25,26 won’t play even wont come up after killing dvblast

  15. ccsalway says :

    We have a dish on the roof which streams HD to the tv in one part of our house and albeit running several other aerial cables to the other TV’s I thought we could just use the network cables with this method instead. So my thinking is to set up a website to display on fullscreen with a hidden menu available by say the right click button for viewing, and then either use the TV’s built in web browser or buy a small form factor with Linux and a browser for each of the older TV’s. It will also mean I could watch tv on the tablets too.
    Do you think this method would? Can you think of a better way? Would it be possible to watch channels on the tablets over wifi?
    Great article. Love clever tricks like these.

  16. chris says :

    great artical,is there any way of transporting a mux thru the internet to be recompiled in another geographic location,cash prize?

  17. hiphin says :

    is there a way to filter out one or more sid’s (services) from transponder , when we use dvblast ? ( I wan’t to watch 10 of 13 available services )

    • The Angry Technician says :

      I think you mean PID rather than SID in your question (a SID in the context of DVB refers to the distinct audio and video streams within a single TV channel), in which case the answer is yes. dvblast will only stream a PID (i.e. a particular TV channel) if you assign it an IP address in the config file. Simply omit the channels you don’t want.

      If you actually do want to filter out particular SIDs, then you’re out of luck, as dvblast doesn’t get that far inside the transport stream.

      • jon says :

        Sorry, Angry (at the risk of provoking your ire), but the OP was correct…
        – SID = Service_ID = an identifier for a Program (collection of components).
        – PID = a unique identifier for a specific component (as referred to in the PMT – Program Map Table, which lists all of the streams, by PID, constituting a Service).

        • The Angry Technician says :

          Looks like you’re right, and that I’ve been working off of out of date documentation – when I started there was very little documentation at all, and a lot of what us online is as described above.

          So to answer the original question, yes you can filter SIDs.

          • hiphin says :

            example: transponder carries 17 TV programs, and I need 16, so should exclude only one program (only one SID) … I need almost the entire transponder, it would be nice if I do not write config file, but to simply say ignore SID number xxxx

            and a little more help, if someone can direct me to how to implement the locked programs (not cccam, I have smart card) …

  18. nobbyjull says :

    Hi, Great tutorial.
    I Would like to create a similar setup using DVB-S2 USB devices.
    Will the DVB-T2 frequncies relate to the DVB-S2?
    Could you give me any pointers.

    Thanks in advance

    Karl

    • The Angry Technician says :

      DVB-S2 works pretty much the same way, but the frequencies are completely different. You can get frequency information from Lyngsat. I’ve never tried it myself, but you should be able to use the same tools to get it working that I talk about here and in the previous article.

      The big gotcha however is that each multiplex on satellite only carries a small number of channels, and there are many more multiplexes. You would need dozens of tuners to even get near the same number of channels as you can on DVB-T. Even if you’re just after the HD DVB-S1 channels, you’re going to need quite a few tuners.

      • nobbyjull says :

        Many thanks for the speedy response.

        I will investigate further and post my findings

        Regards

        Karl

  19. Andrew says :

    Hi to all,

    I have 1 question regarding the Nova adapter. I am using Ubuntu 12.04 and the adapter have been installed successfully, identified by the system and i could scan frequencies. Also i test it with mplayer and i could watch channels on the same machine.

    My problem is when i am using DVblast and trying to stream i get the error:

    kernel: [ 4283.997633] DVB: adapter 0 frontend 0 frequency limits undefined – fix the driver

    According to the frontend code (i open it to see the line related to the above issue) must be a problem with the frequencies somewhere. Does someone face it before?

    Thank you in advance,
    Andrew

  20. THE Trash says :

    error: couldn’t writev to 192.168.44.7:5004 (Connection refused)

    :(

    you give us everyting, including pictures of the usb dvb-t receiver … but

    any chance you give us an ideea of what to use as multicast SERVER, i can’t seem to find any and all your configuration don’t work without that :(

  21. eran sagi says :

    hello my DVB-T has radio stations in the stream as well
    I have been trying to stream those but vlc shows that in receives the stream and shows the codec information but no audio
    for the Video streams everything works well
    any ideas ?

  22. Steve Goodey says :

    Thanks for the article. Just in case you do an upgrade it seems there are problems with newer kernels.

    “New kernels from kernel.org break the PCTV nanostick T2 290 e, a popular HD tuner here. 3.10.22, 3.12.3

    https://bugzilla.kernel.org/show_bug.cgi?id=66861

    Steve.

    • The Angry Technician says :

      Thanks for the heads-up! I tend to run Ubuntu’s LTS versions to cut down on this sort of thing, so my DVB system is currently running Ubuntu 12.04.3 LTS, which has the significantly older 3.2.0-26 kernel. The next LTS is due next April, so hopefully this will be fixed by then.

    • Jon Holden-Dye says :

      FYI, working just fine on 3.11.0-15-generic (Ubuntu 13.10, kept up-to-date).

  23. Stuart Watson says :

    Can you advise me how to tune my freeview hd receiver to itv1 hd london so l can receive the England game in Scotland as stv1hd do not show England games in Scotland(sour grapes-Scotland did not qualify for the world cup).thanks, Stuart

    • The Angry Technician says :

      Unless you’re very close to the border (and therefore near a transmitter that carries the England ITV regions), you’re probably going to be out of luck. Even then, you would to realign your roof aerial to point in the right direction, which would mess up your normal reception.

  24. Rupert Kelly says :

    HI – great guide. Do you know whether the upgrade/replacement for the 290 – the 292 – works the same way with your techniques?
    I have read on Antti’s blog (http://blog.palosaari.fi/2014/04/naked-hardware-15-pctv-triplestick-292e.html ) that the driver for the new hardware has been written but wondered if you had any feedback or experience with the new device?
    Apparently the obsolete 290 is hard to get nowadays (Sept14)
    Thanks again.

  25. John says :

    I have the 290e but have problems streaming HD with it. SD programs stream ok across my network to my Android handset and my desktop PC. However when I select a HD channel it can work for 10-20 minutes and stop or sometimes it will fail after only 1 or 2 seconds. Other times it won’t actually start.

    I’ve tried VLC and mplayer on my desktop and both have problems holding a solid stream over the network. I tried plugging the stick into my desktop PC and HD works “better” but also craps out after maybe 20 minutes.

    This makes me think it’s not a networking issue but possibly a hardware issue with the stick. Any ideas?

    (Server is HP N40L).

    Any ideas? I know there’s not much to go on in this post but just curious.