Jul 26 2010

The Angry Technician’s Guide to streaming Freeview via VLC, you Idiots

Published by AngryTechnician at 1:45 pm under The Angry Technician and tagged:

On Wednesday, the England vs. Slovenia World Cup match brought many a broadband connection across the UK to its knees as iPlayer, the BBC’s streaming video service, hit a peak of 800,000 concurrent streams (mostly skiving gits who should have been working).

Even before the match, IT professionals in schools were marginally backing a meltdown in a poll on EduGeek, realising that demand coupled with shared local authority bandwidth would likely scupper chances of getting a decent stream in schools. That prediction was largely borne out on the day, though experiences varied, with some schools getting a decent feed, while others got only a few minutes into the game before it stuttered to a halt.

We had no problems watching the game at all; we had more than 25 computers across the school watching a high-quality feed, despite having nothing more than an ADSL connection for the entire site.

How?

I cheated.

I realised the night before the match that I already had everything I needed to serve up a live site-wide feed without using an Internet streaming service at all. Instead, I used a TV tuner to stream the DVB-T Freeview feed straight off the air and onto our network. Here’s how you could do the same.

Why?

As I’ve already explained, this means you aren’t relying on an Internet streaming service with questionable reliability when faced with high demand. You are relying on having decent Freeview reception, but that doesn’t tend to vary much unless there’s a thunderstorm. (FYI, it’s probably best not to do this during a thunderstorm). You also won’t saturate your Internet connection bandwidth with multiple streams, meaning those people on site actually doing their job will not be impeded.

Another key advantage is that the standard Freeview feed is a superior quality picture compared with most online feeds, meaning your viewing experience should be better.

Lastly, doing this is very cool, and will definitely get you laid. Definitely. Even during a thunderstorm.

You will need

Your brain. I know this may be something of a liability, but you are going to need to pay attention. This guide is detailed and may seem complicated, but once you understand how it all works the actual process is not that hard.

A working DVB-T tuner device on a computer. There are a lot of these on the market, with PCI, PCI-E, and USB versions available. Which sort you use is pretty much irrelevant so long as it works. I’ve had a lot of success with the Hauppage WinTV Nova-T USB Stick. Whatever you use, make sure you can receive a TV stream using the manufacturer’s software before you proceed, or you could face a very frustrating time with the rest of this guide.

A working network that the computer is connected to. Again, I’m not helping you with this bit, and I’m only covering IPv4 networking. By the way, it will help if your network switches support IGMP multicast filtering, and have this feature turned on. More on this later.

VLC Media Player. This free software is available for Windows, Mac, and Linux. I used Windows but the procedure should work equally well on other platforms since VLC is almost identical on each. I used VLC 1.1.0, the latest version available at the time.

Details of your local Freeview transmitter frequencies. You may be able to get these directly from your existing software, but if not, first find out which transmitter is nearest you. That site will also tell you the frequencies, but it rounds them up to the nearest 0.1MHz, and VLC prefers the more precise kHz values. You should be able to find those sources online; I used an online database on the Medion support forums.

You’ll notice that only a few frequencies are listed, despite there being many more channels than this. This is because Freeview bundles channels together using multiplexing into a single stream on one frequency. For example, most of the BBC channels are on a single frequency. The site where you checked which transmitter is nearest you should also show which channels are bundled together, and therefore which frequency you’ll want. Getting individual channels out of that frequency is taken care of by the receiving software, as you’ll see later.

A TV licence. You may not like or agree with it, but in the UK, your premises must have a TV licence if any channel from Freeview is to be displayed. Most schools probably have this already. Anyone else in the UK needs to be aware that you are a thieving git if you are watching live TV without a licence (this applies to using iPlayer too). Breaking the law is bad, mkay?

What to do

1. Open VLC, go to the Media menu, and click Streaming.

2. Click on the Capture Device tab. Change the Capture mode to DVB DirectShow, change the Device Selection to DVB-T (and pick the correct device if you have more than one tuner), then enter the required frequency into the Transponder/multiplex frequency box (using the information you looked up earlier). Depending on your device, you may or may not need to change the Bandwidth setting. If it doesn’t work on Undefined, change it to 8Mhz.

Once that’s all entered, click on Stream.

3. Click Next on the Source section; you’ve set all this up on the previous screen.

4. In the New destination box, pick RTP / MPEG Transport Stream, and click the add button.

We’re using RTP/TS because it support multicast/broadcast, which will mean the bandwidth consumed by the device streaming the connection is the same regardless of how many clients watch the stream. As I said earlier, I had 25 machines receiving the stream, and the bandwidth usage on the broadcast machine never went above 5Mbps.

5. In the Address box, you need to enter a multicast or broadcast address to stream the video to.

  • If your network switches support multicast, pick a multicast address. There’s a long and detailed document from the IANA about picking one, but unless you are already using multicast on your network then you really just need to pick something in the 239.255.000.000-239.255.255.255 range, which is identified by the IANA as the Site-Local Scope. Anything in this range should work. I used 239.255.1.1 as shown below.
  • If your network doesn’t support multicast, or you don’t want to use it for whatever reason, then enter the broadcast address for your local subnet.

The advantage of using multicast instead of broadcast is that when using broadcast, every device on the network will have the stream broadcast to it and use up some bandwidth, while with multicast, only those devices listening for the stream will consume bandwidth.

Make sure that the Activate Transcoding box is NOT ticked. Unless you are really screwed for bandwidth, you don’t need to do any transcoding since the video stream is already compressed when it comes over the air, and transcoding introduces an extra layer of complexity that you just don’t need. I found the bitrate was between 3-5Mbps without transcoding; low enough for even a 10Mbps connection to cope with, and a walk in the park for a 100Mbps client.

Leave the port at 5004 unless you have a good reason to change it, then click Next once you’re done here.

6. Configure any advanced options. I didn’t touch any of this stuff, but knock yourself out if you know what you’re doing. Don’t tinker unless you know, or you’ll probably break something and coming crying to me like a baby. I will be… unsympathetic.

(I did experiment with SAP announcements, but it seemed a little buggy, so I didn’t use it.)

Click Stream once you’re done.

VLC should now be streaming away merrily. You won’t see or hear anything, because all you’re doing is streaming to the network, not playing the file locally.

7. Change the channel. Remember how Freeview has multiple channels on one frequency? Well, when VLC started streaming, it just picked whichever channel it felt like on the frequency you entered in step 2. To change the channel, go to the Playback menu, click Programme, and select the channel you want.

If the channel you want isn’t there, you either need to try a different frequency, or you can’t pick up that channel in your area.

8. Configure your damn firewall already. If you’re using a client-side firewall such as the one built in to Windows, you need to open up some incoming ports on every client you want to receive the stream. If you left the port setting alone like I told you in step 5, you need to open up UDP ports 5004 and 5005.

You shouldn’t need to change anything on the firewall to broadcast the stream, only to receive it. The exception is if you are using one of those stupid firewalls like the one in Symantec Internet Security that blocks any traffic by default, instead of just incoming connections.

9. Now open a second copy of VLC. You can do this on the same machine (open the firewall!), or skip straight to trying another machine on the network if you’re feeling cocky. Go to the Media menu, and this time pick Open Network Stream.

10. Enter rtp://@ followed by the streaming address you entered at step 5, e.g. rtp://@239.255.1.1

Now click Play.

Congratulations, genius

You’ve streamed Freeview to your network using VLC! The screenshot above shows the stream I broadcast alongside the web interface for one of my switches, with the graph showing multicast working successfully: only the clients actually listening for the stream are consuming bandwidth.

Or not?

Maybe you didn’t get it working, because you’re an idiot. That’s not really something I can help you with. This process worked for me, and it should work for you if you follow it properly. Unfortunately, this guide represents pretty much all I currently know about streaming with VLC, so you may want to consult your favourite search engine if replicating these steps doesn’t work.

Some tips

Here’s a couple of tips to make things easier for you and your users:

  • If you are able to, create a new A record on your local DNS server so you don’t have to remember the address you entered in step 5. You can use this when you set up the streaming in step 5, when you connect in step 10, and in the shortcut described below.
  • To make things easier on your users, make a shortcut for them that automatically starts the stream in fullscreen. An example of the command line you might use is "%ProgramFiles%VideoLANVLC Media Playervlc.exe" -vvv rtp://@239.255.1.1 --fullscreen
  • Turn on deinterlacing in VLC. This will improve your picture significantly whenever there is fast-moving action showing. Go to the Tools menu, click Preferences, then click the Video button on the left and play with the settings highlighted below. The selected options are the ones that worked best for me.

Useful? Useless? Feedback on this guide in the comments, you idiots.

One response so far




One Response to “The Angry Technician’s Guide to streaming Freeview via VLC, you Idiots”

  1. [...] This post was mentioned on Twitter by Tony Sheppard, Tony Sheppard. Tony Sheppard said: [blog] The Angry Technician’s Guide to streaming Freeview via VLC, you Idiots: On Wednesday, the England .. http://bit.ly/aVMesA [...]

Trackback URI | Comments RSS

Leave a Reply

*
To prove you're a person (not a spam script), type the security word shown in the picture.
Anti-Spam Image

You must be logged in to post a
video comment.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes