Introduction: Multicast TV Using Raspberry Pi 3 & WinTV-HVR-955Q
DIY project to multicast OTA TV throughout a home. Multicast OTA TV should use a wired ethernet connection and not Wi-Fi. OTA means over-the-air or off-the-air and is the same as broadcast TV.
The goal of this project is to be one step in a larger Raspberry Pi media center.
A Raspberry Pi Media Center must meet the following requirements:
- Stream my videos
- Stream my music
- Display my photos
- Stream free internet channels
- Stream OTA TV
- Record and playback OTA TV (PVR or DVR functionality)
- Stream protected channels (e.g., Hulu, Netflix, Amazon, etc)
By "stream", I mean it must go to every device connected to my home network, and to family's smartphones, tablets, and laptops.
As of 04JUN2017, the last requirement is not supported by any media center running on the Raspberry Pi. Instead of using open source media centers. I chose Roku to replace my set top box. However, Roku doesn't seem to support OTA TV with recording and playback.
OTA TV is required because it is okay to wait a day or two to watch a TV show, but it is not acceptable to wait a day or two to watch time sensitive content, like a basketball or football game.
Google (cwne88 and multicast) and you will meet my hero. He built an impressive OTA TV setup.
I need to build 6 Raspberry Pi-based TV Tuners to stream the major channels in my city. Also, I need multiple TV Tuners to allow recording or watching of up to six stations at once. I have lots of people in my house and have seven TVs.
However, this instructable is useful if you only want one OTA TV Tuner.
This is the second step in my OTA TV system.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Gather Parts
Get parts and tools (prices in USD):
- Raspberry Pi 3 Element14 $35
- 5.2V 2.1A USB Power Adapter from Amazon $5.99
- Micro USB to USB cable 3ft from Amazon $4.69
- HDMI Cable 4ft from Amazon $5.99
- Case from Amazon $6.99
- Hauppauge WinTV-HVR-955Q from Amazon $72.99
- 1byone Antenna from Amazon $29.99
- SanDisk Ultra 16 GB microSDHC Class 10 with Adapter (SDSQUAN-016G-G4A) from Amazon $8.99
Parts lying around:
- MacBook Pro (a PC could be used)
- TV with HDMI port
- USB keyboard, USB mouse
- Text enclosed in spades, such as, ♣replace-this♣, should be replaced with an actual value. Of course, remove the spades.
Step 2: Setup Raspberry Pi
Setup the Raspberry Pi and install raspbian following this instructable.
Run raspi-config and change the Raspberry Pi's hostname as appropriate. I am using: tvtuner-ABC, tvtuner-CBS, tvtuner-NBC and so on.
Attach the Antenna to the TV Tuner and insert the TV Tuner in a USB port on the Raspberry Pi. And restart:
After the Raspberry Pi is setup and running Raspbian, plug Hauppauge 1191 WinTV-HVR-955Q Tuner into Raspberry Pi. Run the command:
$ sudo reboot
Step 3: Check If WinTV-HVR-955Q TV Tuner Is Setup Correctly
Login to the Raspberry Pi and run the command to check if tuner is recognized:
$ dmesg | grep dvb [ 4.232615] cx231xx 1-1.5:1.1: Successfully loaded cx231xx-dvb [ 4.232639] cx231xx 1-1.5:1.1: Cx231xx dvb Extension initialized
If there are issues such as a missing driver, then you have the wrong TV Tuner or the wrong version of the kernel or Raspbian installed. With a different TV Tuner, I spent a lot of time trying to resolve these issues by downloading drivers and rebuilding the kernel. It really wasn't worth the time. I returned the tuner to Amazon and got the right one. So, much easier.
Another way to check if it is working is to run the command:
$ ls /dev/dvb adapter0
If you don't see the above, then stop and start over. If starting over be sure to use the correct parts.
If you do see the above, then continue.
Step 4: Install TV Tuner Utilities
On the Raspberry Pi in a terminal window, install TV Tuner utilities:
$ sudo apt-get install dvb-apps dvblast w-scan -y
Step 5: Create ATSC and Channel Files for Your City
On the Raspberry Pi in a terminal window, run the command:
$ ls /usr/share/dvb/dvb-legacy/atsc
This section allowed me to understand how call signs, network names, digital channel and frequencies map to one another.
In a city's ATSC file, comments start with #.
I determined each channel frequency by using NoCable.org. Click on Change Address and go to your city. NoCable list the call sign (KTBC), network name (Fox), digital channel (7) and upper bound on the frequency band (180). See image.
I had to subtract 3 from each upper frequency to get the scan to work. So, 180 becomes 177. When I created the file below 177MHz had to be converted to Hz, 177000000.
8VSB is the modulation format.
$ sudo nano /usr/share/dvb/dvb-legacy/atsc/us-TX-Austin
and for Austin, add the following lines:
A 177000000 8VSB # KTBC (Fox) A 515000000 8VSB # KXAN (NBC) A 521000000 8VSB # KLRU (PBS) A 587000000 8VSB # KVUE (ABC) A 647000000 8VSB # KEYE (CBS) A 683000000 8VSB # KNVA (CW)
CTRL-o, ENTER, CTRL-x to save and exit
Scan channels using the file above. This scan takes less than minute.
$ sudo scan /usr/share/dvb/dvb-legacy/atsc/us-TX-Austin > channels_scan.conf
KLRU is Austin's PBS channel, and the channels_scan.conf has four lines for KLRU:
KLRU-HDv:521000000:8VSB:49:52:3 KLRU-CRv:521000000:8VSB:65:68:4 KLRU-Q:521000000:8VSB:81:84:5 PBSKids:521000000:8VSB:97:100:6
In channels_scan.conf, the last digit on the line is the PID. So, PBSKids PID = 6
Each frequency must have its own .cfg file. Make a cfg file for each frequency that contains channels you want to watch. 521 has four channels, but my family only watches two.
$ sudo nano klru.cfg
And add the lines:
# unique-multicast-ip:port always-on pid 126.96.36.199:1234 1 3 188.8.131.52:1234 1 6
CTRL-o, ENTER, CTRL-x to save and exit the file
Here are the rest of my files for Austin. There are more stations than this.
<p># unique-multicast-ip:port always-on pid<br># klru uses 1 2 184.108.40.206:1234 1 1</p>
# unique-multicast-ip:port always-on pid<br># klru uses 1 2, kvue uses 3 220.127.116.11:1234 1 3
# unique-multicast-ip:port always-on pid<br># klru uses 1 2, kvue uses 3, ktbx uses 4 18.104.22.168:1234 1 3
# unique-multicast-ip:port always-on pid<br># klru uses 1 2, kvue uses 3, ktbx uses 4, kxan uses 5 22.214.171.124:1234 1 1
# unique-multicast-ip:port always-on pid<br># klru uses 1 2, kvue uses 3, ktbx uses 4, kxan uses 5, keye uses 6 126.96.36.199:1234 1 3
Step 6: Run Dvblast
I ran dvblast multiple times. At first, I was getting lots of warning messages. After getting a better digital antenna, these warning messages stopped.
Use CTRL-c to stop dvblast.
On the Raspberry Pi, in a terminal window run:
$ sudo dvblast -a 0 -f 521000000 -b 6 -c klru.cfg -m VSB_8 -e
where the options are:
-a 0 is the adapter number from the ls /dev/dvb command
-f 521000000 is the frequency of the station. For KLRU, the frequency is 521000000
-b 6 is the bandwidth of ATSC channels in the US
-c krlu.conf is the configuration file for KLRU's channels created in a previous step
-m VSB_8 is the modulation used (8VSB doesn't work)
-e enables the electronic pass through guide (EPG), which provides information about the shows
Step 7: VLC
VLC is a great utility and allows us to view multicast TV.
Download VLC for MacBook or install VLC on the Raspberry Pi using the command:
$ sudo apt-get install vlc
Note: VLC will not play OTA TV on Raspberry Pi if that Pi is the one streaming OTA TV.
On the MAC, Install VLC. Open downloads folder. Open the vlc dmg. Drag VLC to Applications folder.
Eject the vlc dmg, and move to trash. If vlc dmg cannot be erased, then right-click and select Delete Immediately.
Go to the Applications folder, and start VLC.
My Mac is set to not allow running apps downloaded from the internet. I have to enter my password and jump through a few hoops to allow VLC to run.
Once running, I pinned VLC to the Dock.
dvblast must be running on the Raspberry Pi for this to work.
Within VLC, click on File > Open Network
When you press enter you should see multicast TV!