I have a projector out in the theatre room, however, this same room does not have any coax run for TV reception. Nor does the projector have a tuner for Digital TV. Thus the idea for the RPi TV streamer! I could have easily gone to the local tech shop and purchased a tuner and ran some coax, but I already have an android device hooked up to the projector, why not try and stream TV to it locally in the house. My own IPTV service of sorts.
I do want to give a bit of a shout out to CWNE88, (Go follow him if you get a chance!) This is the guy that got me started streaming TV via the Raspberry Pi, however he concentrates a lot on multicast streaming and to be honest, most of us do not have the infrastructure to handle multicast traffic on our LAN. So I had to find an alternative option that actually worked. (dvblast works great…if you have suitable switches/routers to handle multicast) Anyhow, during my research, I stumbled across TVheadend. I learned pretty quickly that it could be installed on a Raspberry Pi and be used to stream tv via HTSP. (Home TV Streaming Protocol) HTSP is a TCP based protocol and works in a unicast type fashion without killing your home network.
This is the hardware you will require:
- Raspberry Pi 3 B+ (This is what we tested with)
- USB Extension Cables
- Good quality 5v power supply for RPi
- USB TV Tuner (We used Avermedia Volar Green HD @ $29ea)
- Splitter (We used a 3-way splitter to really push the RPi3B+)
- F-type adapters
- USB to Ethernet Adapter (Optional)
Prerequisites
I am going to assume you know how to get Raspbian “Stretch” Lite onto your Raspberry Pi. If not check out the “Prerequisites” of this post here. It will walk you through, downloading the image, using Etcher to put the image onto an SD card, setting up the RPi via Raspi-config, and enabling SSH. Once you have completed those steps, come back here and continue.
The end state of the “Prerequisites” is to have access to your Raspberry Pi via SSH and have the command line up and in front of you.
For those confident on the RPi
For those of you who want to skip straight to the chase, the code below outlines all the commands issued to the RPi to install TVheadend. I will then take you step by step through these commands below:
Step 1: Update/Upgrade the Raspberry Pi
First things first, you need to ensure your Raspbian repositories are up to date. Run the Following commands:
sudo apt-get update
sudo apt-get upgrade
Select ‘Y’ and go get a coffee. This process can take 5-10 minutes.
Step 2: Install TVheadend server
Now that your Raspberry Pi is fully up to date, you need to run the following commands:
sudo apt-get install dirmngr
This command may not need to be run, however, for me, TVheadend would not install without it.
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 379CE192D401AB61
More info about installing the GPG keys can be found here.
echo "deb https://dl.bintray.com/mpmc/deb raspbianstretch stable-4.2" | sudo tee /etc/apt/sources.list.d/tvheadend.list
Again, more info on where to get the correct repo for the RPi ishere.
Check and make sure the correct one is used. This can update at times.
sudo apt-get update
In a nut-shell, we are telling ‘apt-get’ to grab any updates from the repository we added above. This will then allow us to install TVheadend because it now knows where to ‘grab’ it from.
sudo apt-get update
In a nut-shell, we are telling ‘apt-get’ to grab any updates from the repository we added above. This will then allow us to install TVheadend because it now knows where to ‘grab’ it from.
sudo apt-get install tvheadend
Select ‘Y’ and allow TVheadend to install. If you tried to run this command without doing the steps above, you would run into errors.
During the install, you will be asked to set an administrator username and password. Be sure to set this correctly and remember. You do not get two chances to enter the password. I learned this the hard way!
If for some reason, you did stuff up the username and password. Uninstall tvheadend with sudo apt-get purge tvheadend and sudo apt-get autoremove Then reinstall tvheadend again.
Step 3: Log into TVheadend
Now that your Raspberry Pi is fully up to date, you need to run the following commands:
Open up a web browser and enter the IP address of your Raspberry Pi. Also, use the port number ‘9981’. For example http://192.168.1.168:9981 (Your IP address for the RPi will be different.) Type ifconfig in the terminal screen to confirm.
When you first open Tvheadend, you will get the Wizard which will step you through setting up the tv tuners. Hopefully, you left them plugged in from the start. If not, plug them in and restart the Raspberry Pi. Go back into the web browser and log back into TVheadend.
Step 4: Configure TVheadend for streaming
The configuration for TVheadend settings is coming soon. Thanks for your patience…
I have no doubt, however, if you got this far, you will be able to bumble your way through the configuration. This was the easiest part. I then used VLC to watch the streams. You can get these links from inside Tvheadend.



















Hello,
First of all thanks for the top guide!
I’ve a problem with IPTV & TVHEADEND on a RASPBERRY.
Unfortunately I can see any of the channel in the m3u list.
I see all muxes, but no services.
I’ve tried with two different approach:
– Use directly the untouched m3u list, I can find 4000muxes and about 50 service
– Modify the m3u to use ffpmeg (with command: pipe:///usr/bin/ffmpeg -loglevel quiet -I http://xxxx -c copy -flags +global_header -strict -2 -f mpegts pipe:1)
I can find all the 4000muxes but 0 services! Also when I try to start a mux, VLC throw an error.
Is my commandline wrong?
thanks for any help 🙂
I’ll have a look tonight! What tuners are you using, and in what configuration? I really need to do a video/post of the TVheadend setup.
Thanks for the info. We are waiting for Step 4: Configure TVheadend for streaming 🙂
Is there a way to compress the signal you are sending out? I will like to stream over the internet.
Thanks for sharing
I stream it just nicely to my 4G mobile device, both via VPN or just your standard port forward. Give it a crack, port forward 9981 (*I think that’s the TVheadend port) then try access via your WAN IP and port number. It works well to my phone. If you go down the VPN route, then it is a bit hit and miss because of the encryption/decryption. As for compression, you can probably play with the output streams, but the HTSP protocol is not too bad, its made for streaming.
Some progress?
not yet!! Been too busy working on my DIY Powerwall. Promise I’ll have a TVheadend guide soon!