Forums » Tutorial and setups »
NOOB Help - REALLY Remote ATSC Tuner via WiFi
Added by Alex Filatov about 8 years ago
Totally ignorant... and don't want to start down a black hole.
I live in a deep valley in the US. Want to setup a ATSC Tuner on a RPI on a mountain top 5 miles away and stream back (not sure what) to the house. I can make the WiFi link legally (already tested that part). Nearly all the HDTV stations are in a 20 degree vector on remote mountains 15 miles away so a static point antenna to the transmitters would work. The whole thing will be solar powered (50 watt panel) ~8500'(I'm at 5000') Will install SSH to bounce the RPI (not a complete NOOB)etc...
I assume I need a (RTLSDR type) ATSC USB Tuner with TVHEADEND installed on a RPI at the remote site. At the house I'd like to convert it to a PLEX stream (or something else) to watch on the Roku. I understand that TVHEADEND can transcode on the RPI.
1. What kinda of ATSC USB Tuner would work? BIGGEST ISSUE (I know I can't just use a cheap RTLSDR they are DVB-T and bandwidth is to narrow)
2. How can I change the channels at the remote Tuner (will TVHEADEND interfact with ?) SECOND BIGGEST ISSUE
3. I can probably figure out the Roku stream side (or whatever works) at the client end. LEAST OF MY WORRIES
Thanks for any and all help you can give me... I've read the forums and see others are doing something similar between countries but it's all been DVB-T and I'm not familiar with any ATSC tuners. If I can at least get that part right I can start hacking away at the house where I do get 1 very weak HDTV signal. All this needs to be low power since it is running on Solar.
Replies (7)
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by Mark Clarkstone about 8 years ago
Alex Filatov wrote:
Totally ignorant... and don't want to start down a black hole.
I live in a deep valley in the US. Want to setup a ATSC Tuner on a RPI on a mountain top 5 miles away and stream back (not sure what) to the house. I can make the WiFi link legally (already tested that part). Nearly all the HDTV stations are in a 20 degree vector on remote mountains 15 miles away so a static point antenna to the transmitters would work.
Not sure how good wifi will be for streaming HDTV..
The whole thing will be solar powered (50 watt panel) ~8500'(I'm at 5000') Will install SSH to bounce the RPI (not a complete NOOB)etc...
I assume I need a (RTLSDR type) ATSC USB Tuner with TVHEADEND installed on a RPI at the remote site. At the house I'd like to convert it to a PLEX stream (or something else) to watch on the Roku. I understand that TVHEADEND can transcode on the RPI.
You can convert the stream on the Pi using an external transcoder but tvheadend's internal transcoding has very limited gpu support for now and doesn't support the Pis gpu. But all is not lost, you can pipe to transcode a service using gstreamer-omx
I haven't done this myself so know very little about it but I think you'd have to create channels using pipe:// pointing to a script that launches gst-omx (which in turn requests the service from Tvheadend and transcodes it on the fly) and then pushes it back out to Tvheadend and finally to your client. However that could be rather slow especially when switching channels.
In fact it might be easier to use something like MuMuDVB
1. What kinda of ATSC USB Tuner would work? BIGGEST ISSUE (I know I can't just use a cheap RTLSDR they are DVB-T and bandwidth is to narrow)
Anything that's supported by Linux really and has drivers available in the rpi kernel.
2. How can I change the channels at the remote Tuner (will TVHEADEND interfact with ?) SECOND BIGGEST ISSUE
3. I can probably figure out the Roku stream side (or whatever works) at the client end. LEAST OF MY WORRIESThanks for any and all help you can give me... I've read the forums and see others are doing something similar between countries but it's all been DVB-T and I'm not familiar with any ATSC tuners. If I can at least get that part right I can start hacking away at the house where I do get 1 very weak HDTV signal. All this needs to be low power since it is running on Solar.
HTH
Someone with more experience may have a better method though so hang tight.
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by Alex Roth about 8 years ago
This type of setup is exactly the reason I wanted to use TVHeadEnd, and I have a working solution. Changing channels is a little slower than I'd like, but isn't awful, especially since I record most TV, not watch it live.
I have a remote setup which receives ~30 channels, but my main TVHeadEnd server (and where I live) is in an almost complete dead-zone. The upload speed there is ~5mbit, far too low to use.
This isn't exactly a straightforward process, and will require a lot of trial and error. Once it does work though, it works very well. This is a little bit of a wall-of-text, sorry about that. At some point I'll turn it into a proper tutorial and blog post.
The first thing you should try is to use a tool like iperf
to measure upload performance. To do this, you'll want to run the server (iperf -s
) on your main TVHeadEnd server, and the client (iperf -c your.server.ip.address
) on the RPi, over the WiFi link, at the remote location. If you get speeds > 20Mbit/s, then you're in luck, and setup will be significantly easier.
(For those who stumble upon this via Google, my setup uses a VPN at this point to connect the two locations, not a point-to-point wifi link. Aside from that, the setup is pretty similar).
Then set up TVHeadEnd on the RPi, with your ATSC dongle, and make sure all of the services have populated. Map them to channels, but don't bother with icons or EPG data. Set up an anonymous user which has streaming access. Then, go to http://your.rpi.ip.here:9981/api/channel/list
, and keep that open. You may want to put that data into a site like jsonlint.com for an easier time viewing it.
So what you have now is a fully-functional TVHeadEnd instance at the remote location. You now need a way to get those channels to the master TVHeadEnd instance (which your Roku/whatever can connect to directly.)
If your WiFi speed is acceptable, then create a new IPTV network on the master. Add a mux for each channel, with the URL set to http://your.rpi.ip.here:9981/stream/channel/channel_identifier_here
. Wait for the muxes to be scanned and turned into services, which you can then map to channels as with a normal TVHeadEnd setup. From there, you can configure EPG/icons/whatever else you'd like. You're finished at this point if your speed was fast enough.
If your speed is not acceptable for direct streaming, then you'll need a little more work. I'm not sure which programs support GPU transcoding on the Pi, you'll need to do some research on that. What I can help you with is how to get data into the transcoder and out into the master instance on the other side.
You'll need to come up with a command which takes data from http://localhost:9981/stream/channel/channel_identifier_here
. Both GStreamer and FFMpeg should support that input type. The command should output to stdout. You may want to make a shell script which takes the channel ID as an argument. You can test this by using the >
operator to pipe to a file, and using something like ffmpeg to inspect the result.
Once you have the command, you'll need to create a shell script on the master server which contains: ssh -c arcfour user@pi yourcommand_here
. This script should also take the channel id as an argument. You'll need ssh keys setup so you can login without a password. Make sure that `hts` or whatever your TVHeadEnd user is has the key & has logged in once as well! The arcfour
algorithm is significantly faster, but has decreased security compared to a usual SSH link. That's fine considering you're on a private WiFi network.
Now, in TVHeadEnd, create an IPTV network, and add a mux. The URL should be pipe:///your/script/path channelid
.
I hope this helps you, let me know if you'd like me to clarify something.
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by K Shea about 8 years ago
Why is everyone making this so complicated? I would think that if you use a VPN to connect the two locations, OR if TVHeadEnd can see whatever is on the other side of your mountaintop location as part of your local network (typically anything on that side of the link would have a 192.168.x.x address), then this would be VERY easy. Just use a HDHomeRun (probably the HDHR4-2US unless you want to spring for the model with extra compression, which may help on a slow link), connect it to your antenna and to your WiFi bridge, and then run a recent version of TVHeadEnd at your house, and it should automatically detect the HDHomeRun tuner and use it. So all you need at the mountaintop is:
Antenna (and mast to mount it, etc.)
RG6 or RG11 cable to connect it to whatever enclosure will house your equipment
HDHomeRun
WiFi Link
Network cable to connect the HDHomeRun to the WiFi link
A way to power the HDHomeRun and the WiFi link device. The HDHomeRun runs off a low voltage "wall wart" power supply so you could probably feed it DC at the proper voltage, no need for a 120 volts AC source unless you need it for the WiFi. I think they only need 5 volts but don't quote me on that; it may vary with different HDHomeRun models.
Note you do NOT need any type of computer - no Raspberry Pi, nothing at all other than those two devices.
At your house you of course need a computer running TVHeadEnd. As long as the HDHomeRun and the Wifi link are up and running, TVHeadEnd should detect the HDHomeRun tuners and let you use them just as if they were some kind of tuner card plugged into your computer. The only caveat is that for it to be that easy, the HDHomeRun and the computer running TVHeadEnd must be on the same local network. If you need to use a VPN for some reason then things get a bit more complicated (a lot more if you have no experience with VPN's).
The HDHR4-2US has two tuners so you can play or record from up to two physical channels at the same time. Note that multiple subchannels from the same physical channel (for example you want to watch channel 10.1 and record channels 10.2 and 10.3) only use one stream and therefore only one tuner. So it is theoretically possible to watch or record more than two programs at the same time, as long as you're not tuning more than two physical channels. If that is not enough you can add additional HDHomeRuns; each you add will give you two more tuners, but you'd need a splitter to feed the antenna output into each of the HDHomeRuns. TVHeadEnd has no problem with multiple HDHomeRuns on the same network.
Be sure you use a 4.x version of TVHeadEnd, because the 3.9 and earlier versions didn't always auto-detect HDHomeRuns on the network. Also if your WiFi link is really slow there is a HDHomeRun model that includes hardware compression of streams at a significantly higher price; I've never used it so really can't say how well it works.
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by Alex Roth about 8 years ago
HDHomeRuns, while very useful devices, aren't always the right solution.
A long-range WiFi link may or may not be able to sustain the 15+Mbit/s throughput needed to maintain the stream, especially in all weather conditions. If you do your initial tests on a sunny day, you may find a month down the road that your system no longer works, and you're out the cost of the device.
In addition, spending ~$120 for a device which solves the problem just as well as a technical solution with half the cost isn't what everyone is looking for. I'm aware there are HDHomeRuns which can transcode to h.264, but that comes with nearly double the cost of a base model.
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by edit4ever ! about 8 years ago
The real question is what is the throughput of your extended wifi connection? ATSC carries up to 19.2Mbps - although most main channels (abc, nbc, cbs, fox, etc) will use between 10Mbps and 14Mbps for the primary channel and use the rest for the digital subchannels. This is the biggest difference between US and European tv. In Europe, their DVB-T signal is generally using h.264 mpeg-4 for their HD - so the bandwidth per channel is much lower.
For your setup, if your wifi backhaul joins the network at your home, then the hdhomerun solution would work. (Assuming 20+ Mbps bandwidth on that connection.) You could also just use any usb ATSC tuner connected to the raspberry pi, running tvheadend and get the same result. The challenge their is each usb tuner is only 1 channel...so if you want to be able to record something and watch something else, you'll need to install more than 1 usb. I currently use a raspberry pi running libreelec with both a kworld 435Q tuner and a hauppauge 950q usb tuner. I also run zap2xml to get guide data loaded into tvheadend as well. This setup can be seen by any system running kodi on my network and tune in channels and set and watch recordings. Of course - the bandwith issue is still the question. (check out the libreelec forums for how-tos on getting this setup running)
If your connection speed is lower than 20Mbps, you could install something like a tablo - which would handle the transcoding to h264. They make a 2 and 4 tuner option.
We used to use wifi over microwave at a tv station i worked at and we had a solid 50Mbps connection. Good luck!
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by K Shea about 8 years ago
Alex Roth wrote:
HDHomeRuns, while very useful devices, aren't always the right solution.
A long-range WiFi link may or may not be able to sustain the 15+Mbit/s throughput needed to maintain the stream, especially in all weather conditions. If you do your initial tests on a sunny day, you may find a month down the road that your system no longer works, and you're out the cost of the device.
If the WiFi link is that unstable you are going to have problems anyway. A single HDHomeRun is a lot less expensive than some other tuner device AND a computer (even if it's a Raspberry Pi) AND a SD card (and Raspberry Pis can kill SD cards in a relatively short time, so it may not be just one). If it were me, I'd rather keep it simple and put my money into better WiFi antennas if it comes to that. I know some people just love to do things the hard way, maybe they enjoy the challenge or something, and if that's what floats your boat feel free to do it that way. But I just figured that maybe the OP wasn't a glutton for punishment.
I think your concerns about the connection are overblown, but here's an easy test. Take a laptop to the remote site and connect it to the WiFi using a network cable and transfer a 3 GB file from one end to the other. If it takes longer than a few minutes you may have a problem. Normally it should transfer in a couple minutes, give or take a little and depending on the speed of the network interface in the laptop. Also run a ping test to the other end to check for packet loss; hopefully you won't see any loss.
Even if the system ultimately no longer works you are not "out the cost of the system", you are only out the cost of the HDHomeRun, and you can recoup much of that by selling it used on eBay. However, if it's a case of the link only being unreliable during major bad weather events (like heavy downpours) then that would be a reason to put a computer at the remote site, but in that case you'd want to run TVHeadEnd on that computer, so even in that case you could still use a HDHomeRun. The difference in that situation would be that instead of having the TVHeadEnd backend at the house you'd put it up on the mountain, so that even if the WiFi were temporarily interrupted it could still record shows, which could then be played back after the weather event passed. The only problem I see in doing that is that it will up the power requirements somewhat, since now you will also have to power a computer (to run TVHeadEnd) and a storage device (hard drive or large capacity SSD).
If weather doesn't really affect the WiFi connection (other than maybe a small percentage of packet loss) then it would be better to keep the backend in the climate-controlled house rather than in some equipment hut that's probably not heated in the winter (nor cooled in the summer if the elevation is low enough that you get hot summer temperatures).
The real issue is that the backend has to go one of two places, either on the mountaintop or in the house. If it goes on the mountaintop then you can't watch TV when the WiFi link isn't working, but it will still record anything that was scheduled to record. On the other hand, if it's in the house, it's not going to record anything during a WiFi outage no matter what kind of tuner you use. I'm not saying that the speed and reliability of the WiFi link will never be an issue, but I have a feeling the real problem is going to be in the winter when the solar panels and the antennas (depending on the type of antenna used) start collecting snow. If the solar panel stops sending power, then you aren't going to be able to watch live TV or record any new shows until the issue is resolved. But if the TVHeadEnd backend is at the house then at least anything previously recorded can still be viewed.
What being attempted here is quite interesting but it would be better if there were some way to run power and a fiber optic line up the mountain, however I suspect the OP probably doesn't own all the land in between.
In addition, spending ~$120 for a device which solves the problem just as well as a technical solution with half the cost isn't what everyone is looking for.
Really? What, pray tell, is your $60 solution? Remember to include all the costs, for example if you need on-site storage that has to be included to make a fair comparison. And also, Amazon is selling the HDHR4-2US models for $84 as I write this (https://www.amazon.com/SiliconDust-HDHR4-2US-HDHomeRun-CONNECT-2-Tuner/dp/B00GY0UB54). It's only if you want the model that converts video to H.264 that you'll pay more than double that, and honestly the OP doesn't need that unless the WiFi link is either really slow, or has a lot of packet loss. I don't know what model you're looking at with a $120 price, but that's far too much to pay for the stand two-tuner model I'm talking about.
If you are thinking that by locating the computer on the mountaintop you can get away with a cheaper tuner, keep in mind that first of all many cheap tuners sold on eBay won't receive ATSC signals (they are designed for the DVS-T standard signals used in other parts of the world, and the only reason they are sold in the USA and Canada is because some people used them as Software Defined Radio tuners, for receiving FM radio and certain other types of signals). You have to get a tuner that's ATSC capable, and then you'd be sticking it into something that's possibly going to be exposed to temperature extremes. I can't envision where there would be any scenario where this would work any better, or be any less expensive in the long run than just using a HDHomeRun as your tuner, but if you know of some way to pull this off I'd love to hear it. I get it, you did it the hard way and you are proud that you figured it out, but there's no reason anybody needs to make it that difficult in a situation such as the one the OP described.
RE: NOOB Help - REALLY Remote ATSC Tuner via WiFi - Added by K Shea about 8 years ago
Jay M wrote:
You could also just use any usb ATSC tuner connected to the raspberry pi, running tvheadend and get the same result. The challenge their is each usb tuner is only 1 channel...so if you want to be able to record something and watch something else, you'll need to install more than 1 usb. I currently use a raspberry pi running libreelec with both a kworld 435Q tuner and a hauppauge 950q usb tuner. I also run zap2xml to get guide data loaded into tvheadend as well. This setup can be seen by any system running kodi on my network and tune in channels and set and watch recordings. Of course - the bandwith issue is still the question. (check out the libreelec forums for how-tos on getting this setup running)
My real concern about a Raspberry Pi would be twofold: First, their tendency to eat SD cards if you do much reading and writing to the card, and second, whether there would be any bottleneck if you wanted to record or play back two or three signals at the same time. What you may be perceiving as a bandwidth issue could in fact be because you are pushing the Raspberry Pi (either the CPU or its network interface) to the max. I use an old (2009 vintage) Mac Mini with Ubuntu Server installed for my HDHomeRuns, it handles three HDHomeRuns with no problem. I'm sure I could get by with an even less powerful system, but I already had it, and figured I might as well make it useful.
Now granted the majority of my experience is with the original Raspberry Pi so if you are talking about a Raspberry Pi 2 or 3, they may have enough extra "under the hood" to work with no problems. But still, my preference would be to use a HDHomeRun rather than connecting tuners to the USB ports. But if it works for you with no problems, that is great. And if the OP wanted to put his TVHeadEnd server up on the mountain, I suspect a Raspberry Pi would be much better at handling temperature extremes, though it would still need to be in some kind of water-resistant enclosure that doesn't trap heat. And it could be powered from the solar panel, so that's a plus.