A few years ago I was working on a project where we had to provide a reliable and high quality free to air broadcast signal to 70 TV’s for the Melbourne Cup. For anyone that doesn’t know, the Melbourne Cup is the biggest horse race in the Australian racing calendar and it is a huge day for the hospitality industry. The state of Victoria where the race is held has a public holiday to celebrate and most other states stop work at midday and enjoy a long lunch until the race starts at about 3pm. Bars and restaurants host these booze filled affairs and TVs are crammed into every available space so that everyone can watch the big race!
This particular venue had been beset by major technical difficulties with the TV’s in previous years (including the picture dropping out during the main event!) so I was involved in providing a new solution. It ended up being quite complex with lots of AV and IT integration work being done however the important part of getting the signal to the TV’s reliably was done using MuMuDVB.
MuMuDVB was used to ingest a DVB-T signal from the venues TV aerial and multicast it across an IP network to set top boxes attached to each TV. It runs on Linux, is very lightweight and is very reliable. The multicast streams can also be viewed using VLC Media Player.
This post will cover how to install and configure MuMuDVB on a Raspberry Pi 3. The Raspberry Pi 3 is a great hardware platform for running this type of application as it is very cheap, has more than enough grunt to run MuMuDVB, and is very easy to setup.
Apart from the Raspberry Pi3, you will need a USB TV tuner. The tuner I like to use is the Sony Playstation Play TV. These have dual tuners, are available cheaply on eBay, they are very reliable and are easy to setup in Linux. There are plenty of other suitable tuner models available, more information can be found here.
Another important requirement is that your network is capable of efficiently handling large volumes of multicast traffic, support for IGMP is quite important in a larger installation. If you are only streaming a few channels on a small network you can probably survive without it. You can read more about IGMP here.
The operating system we will be installing on the Raspberry Pi is Ubuntu Mate. I have found this to be much more stable than the default Raspbian OS when running MuMuDVB. Instructions for installing Ubuntu MATE 16.04.2 LTS can be found here.
The first step is to install the prerequisite packages for MuMuDVB.
Run the following commands to update the apt package list and then install the necessary software.
sudo apt-get update
sudo apt-get install dtv-scan-tables dvb-apps dvbtune w-scan libdvbcsa1
Now we will download MuMuDVB for the Raspberry Pi from here using wget.
I have had issues with the latest version of MuMuDVB so I recommend using 2.1.0 (March 2017).
sudo wget http://data.mumudvb.net/release/mumudvb_2-1_armhf.deb
Install the downloaded package.
sudo dpkg –i mumudvb_2-1_armhf.deb
The next step is to plug in our USB TV Tuner and make sure that it is picked up correctly.
With the Playstation PlayTV, the red light should turn on shortly after plugging it in. We can confirm that the driver has loaded correctly by running the following command
The output should be similar to the below and should show the tuner being recognised as a Sony PlayTV, an appropriate driver loaded and both tuner modules being registered.
Run the following command to make sure mumudvb can see the two tuner modules or “cards” as well.
Now we need to create some configuration files, but first I will explain what we are about to do.
With DVB-T each station generally broadcasts multiple channels. For instance here in Australia, the ABC station has the channels ABC, ABC NEWS, ABC2/KIDS, ABC ME and ABC HD. These channels are all broadcast on a common transponder carrier frequency with each channel identified by a unique service id and program id’s. Each instance of MuMuDVB that we run can only stream the channels from a single transponder carrier frequency and each tuner module can only be tuned to one transponder carrier frequency at a time. As we have 2 tuner modules in our PlayTV we can run two separate instances of MuMuDVB simultaneously to stream all the channels from 2 different TV stations. Each of the channels will be streamed across our IP network using a unique multicast address. You can read more about IP multicasting here. If we wanted to be able to stream more stations, we would just need to add more tuners. The only real limits are the CPU on the server, the available USB bandwidth for the connected tuners and the bandwidth of the network.
To build our configuration files (1 for each station/transponder carrier frequency) we will need to:
- Discover the transponder carrier frequencies.
- Discover the service id for each unique channel.
- Choose a unique multicast address for each channel we wish to stream.
Before we start we will create a directory to keep all of our MuMuDVB configuration files in.
sudo mkdir /etc/mumudvb
The first step is to run a tuning scan to discover the transponder carrier frequencies and the Service ID’s for the local TV services. Make sure you have a suitable antenna plugged into your TV tuner and then run the following command.
sudo w_scan -X -c AU > /etc/mumudvb/channels.txt
This will run through a scan of available DVB-T frequencies for Australia and output its findings to the text file channels.txt.
This file will contain lines similar to below that are delimited by a colon, each line represents a channel and you should see channels grouped together based upon a common transponder carrier frequency.
In the example above, the 2nd field is the transponder carrier frequency (620500000) and the last field is the Service ID (656).
The other fields contain useful information that may be required for configuring MuMuDVB outside of Australia but for the purposes of this post we have what we need.
Fire up your favourite text editor and lets create our first configuration file /etc/mumudvb/2.conf
PLEASE NOTE: The channel declarations in the example configuration file below are specific to my location in Tasmania. They will be different for each area in Australia.
The top section defines the card and tuner we will use for this station (refer to the output from
mumudvb -l above), this needs to be different for each simultaneously running instance of mumudvb.
frequency is the common transponder carrier frequency for the station converted to MHz (i.e. drop 3 trailing zeros) obtained from the tuning scan results in channels.txt.
bandwidth is 7MHz for Australia, this value can be different in other countries and can be obtained from the 4th field of the tuning scan results.
rewrite_pat is set to 1, this is for compatibility with certain set top boxes.
autoconfiguration is set to full, this greatly reduces the amount of manual configuration required.
The new_channel line is used to start each individual channel declaration.
ip is the unique multicast address that a particular channel will be streamed on. The default port is 1234.
service_id is the unique service id for a channel obtained from the tuning scan results in channels.txt.
More details of the available configuration options can be found here.
Create a unique channel configuration file for each transponder worth of channels that you wish to stream.
Fire up your text editor again and create a file called /usr/bin/mumudvb1.sh
This will be used to start the mumudvb instances.
Enter the following, using your own configuration file names and making sure you don’t add more configurations than the number of tuners that you have available.
Save and exit the file and make it executable with the following command:
sudo chmod +x /usr/bin/mumudvb1.sh
fire it up by running
If you want the startup file to run automatically on boot, add it into /etc/rc.local
#!/bin/sh -e # /usr/bin/mumudvb1.sh exit 0
To view the stream from your PC or laptop, download a copy of VLC media player from here.
Make sure you create a firewall rule on your PC or laptop to allow traffic in on UDP ports 1234 and 9875.
You can view an individual stream manually by going to the Media menu, selecting Open Network Stream and entering the stream address in the following format:
Alternately, when MuMuDVB is configured with the autoconfiguration flag set to 1 as in our example above, it will generate SAP announcements that are multicast across the network on the address 184.108.40.206 using UDP port 9875. A SAP (Session Announcement Protocol) announcement uses SDP (Session Description Protocol) to advertise the details of the multicast streams available for a client.
VLC has the ability to read these SAP announcements making channel selection much easier. Go to the View menu and select Playlist. In the left hand pane of the playlist look for Network streams (SAP). Double click this and a few seconds later you should see all of the channels that your MuMuDVB server is streaming. Double click one of the channels to begin playing it.