Replacing an unreliable Slingbox, DIY-style!

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
I spend a lot of days each year away from home. To keep up on TV (directv), I have a Slingbox. But lately it just disconnects every few minutes and it is exceedingly frustrating. There are no superior placeshifting products out there that I can find, so I decided to put together my own.

To do this, you really need two things: An IR blaster to control a set-top-box, and a device to capture and stream HD video over IP.



The IR blaster turned out to be easy. I used an iTach: http://www.globalcache.com/products/itach/

The iTach has a powerful API and is controlled by TCP/IP so I was easily able to bend it to my will.



The HD capture was more of an adventure.

The adventure:

First, I tried an HDMI capture card, because my brother already had one that integrates with directshow. After a lot of tries, I was able to get VLC to open the audio and video, then transcode it for network transfer. But the latency was a sad 6+ seconds and a lot of frames got dropped, ruining the video. I don't know what to blame here, but my brother got tired of my screwing around with his computer and I had to stop :)

So the next thing I tried was an $80 HDMI extender that takes HDMI input and multicasts PCM audio and JPEG frames at about 90 Mbps over IP (what a great way to ruin your network performance!). In fact the packets are even malformed so a lot of high level socket libraries can't read the data correctly. I spent several days tinkering with this, with help from this blog: https://danman.eu/blog/reverse-engineering-lenkeng-hdmi-over-ip-extender/ In the end I was able to capture the video and audio from it, then transcode this in FFMPEG to h264/aac. Total latency ended up between 1 and 4 seconds depending on what kind of optimizations I applied to the x264 encoding in ffmpeg. Unfortunately, there were two problems. This device struggles to keep up just 25 FPS at 1080p, and the audio goes out of sync and continually shifts around in relation to the video even at 720p.

Then I discovered this fancy little box: http://www.auvidea.com/index.php/theme-styles/2013-06-22-21-23-36/encoder-e110 It takes HDMI input and outputs an h264/RTSP stream just like an IP camera! Exactly what I need! They even claim latency is as low as 100 ms. Problem was, it would cost close to $370 not including shipping from Germany to the USA, and for all I know there would be a surprise import duty as I have never ordered anything from Germany before. Either way, too expensive. :(

The eventual solution:

Finally, I looked on aliexpress to see if the Chinese were selling a comparable device. To my surprise, I found one for just $200 plus shipping:

"MPEG-4 AVC/H.264 HDMI Encoder Replace HD Video Capture Card"
from seller: Unisheen Tech Store
http://www.aliexpress.com/snapshot/6401297143.html

I complained to the seller about the high shipping charge ($65 for EMS) and he agreed to ship it DHL for $35, so $235 total. Much better. So I ordered one last week and today it arrived. I am pleased to say my search is done. This thing works brilliantly. HDMI in, H264/AAC out (over RTSP or HTTP or RTMP). There are no problems with audio sync. I can get reliable 1080p@30fps video to VLC with about 2 seconds latency over LAN, using the HTTP output method and without even reducing VLC's network caching from the default of 1000 ms. I can get latency down to under half a second with some settings tweaks, though this introduces a lot of dropped frames. I am more than happy with 2 seconds and I bet it will work great with less than 4 seconds latency over WAN/VPN.

The contrast and color accuracy are poor out-of-the-box but there are brightness, contrast, hue, and saturation settings in the web interface that can greatly improve things. They were all set to 50 by default. So I loaded up the same monitor calibration image on my PC and on the source HDMI device (also a PC) and got to work at making the "input" and "output" match, using ColorPix to precisely measure on-screen colors. I ended up setting brightness to 35, contrast to 60, and saturation to 70. Hue stays at 50. This fixes the contrast and brightness so that the shades of gray don't get shifted around by more than ~1 brightness level and the colors are considerably more accurate. Still not perfect, but good enough for me and the limited adjustments available. One important thing to note is that I enable full dynamic range in my Nvidia control panel's video color settings. Otherwise VLC displays a limited 16-235 range instead of the full 0-255.
 

fmflex

Getting the hang of it
Joined
Mar 11, 2014
Messages
179
Reaction score
25
Thanks BP2008,

I was only just thinking that I might need something of the sort but had yet to hunt around to see what was out there and you post up your findings and experiences. I appreciate that you've taken most of the work out of it for me.

Cheers
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
I have finally had a chance to try this system of mine remotely, and it works great so far. As usual, I built my own web interface. It is just a simple page with a virtual directv remote and a video player which connects and finishes buffering within about 2-3 seconds of requesting the page in the browser. Beat that, Slingbox!! I used the WebChimera plugin, as the live video stream is not HTML5-compatible.

My solution is obviously a bit light on the features compared to Slingbox (which has mobile apps, client-side timeshifting, a program guide, etc), but I dare say the video quality is better and stability/reliability is no longer a problem. I have full control of the directv box using the IR blaster, and pressing buttons does not cause the video to unnecessarily pause and re-sync (which happens by design with Slingbox). Video latency is comparable to the Slingbox, at 2-3 seconds.

One thing to note for anyone thinking of building a similar system is that some of the DirecTV DVRs can be controlled by IP so you may not need an IR blaster. In my case I am connecting to a Genie Mini that only supports IR input, so the IR blaster was needed.

Edit: Turns out I was wrong - the Genie Mini can be controlled via the main box (HR34 or HR44) if you specify which device you want to control in the http request to the main box. I guess I will be able to use two different control methods!

Edit 2: Again, I am wrong. You can't turn on the Genie Mini via http requests, but you can send remote control commands to it if it is already powered on. So it seems I do in fact need the IR blaster if only to turn on the mini clients.
 
Last edited:

elude

n3wb
Joined
Dec 13, 2015
Messages
3
Reaction score
0
I am trying to set up an identical system with the Oupree NH100. However I am having problems with the unit. Did you have any issues with sudden disconnections? I am getting sudden drops where the interrupt number goes back to zero, the green light on the ethernet goes dark and my vlc stream is cut. Then in ~1-2 seconds the device wakes back up. I am connecting over Http at 1920x1080 25 fps. Maybe the unit is defective?
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
I am trying to set up an identical system with the Oupree NH100. However I am having problems with the unit. Did you have any issues with sudden disconnections? I am getting sudden drops where the interrupt number goes back to zero, the green light on the ethernet goes dark and my vlc stream is cut. Then in ~1-2 seconds the device wakes back up. I am connecting over Http at 1920x1080 25 fps. Maybe the unit is defective?
I haven't seen anything like that happen to mine. I have two of the h264 encoders, although they are not branded Oupree, they are the same device from what I can tell. Neither of them suddenly disconnects like that.

I stream over http at 1920x1080 at 30 fps with the maximum bit rate (later I recompress to 3 Mbps with ffmpeg, as this results in better quality than taking 3 Mbps straight out of the encoder box).

In fact just in the last few months I got one of Oupree's new OPR-NH100P encoders which can do up to 60fps in h264 or h265 and the only problem I've had with it is that if I feed it an interlaced video then the encoded video output bobs up and down by one pixel and is very distracting. They keep telling me they don't have a fix yet.

So I suspect your unit is defective. Have you tried updating its firmware?
 

whoslooking

IPCT Contributor
Joined
Oct 3, 2014
Messages
1,524
Reaction score
548
Location
London
I took the easy option and got a cryptobox 650hd streams direct from my satellite receiver to my Samsung tab 3 10.1 with full control.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
Nice. In the USA the two satellite TV companies make sure only their 1st-party receivers can be used.
 

Git

Banned
Joined
Sep 14, 2014
Messages
211
Reaction score
34
I will give you an easier solution - DISH!

I had been a DTV customer for at least 14 years and was fed up with the games they play when it comes to their prices. Our last 2 year contract was up in September and the price jumped up $50 per month and they wouldn't give me any "credit" because I just had one of the DVR's replaced due to a failing hard drive

Signed up with DISH and have been very happy. Locked in the price for 2 years. Received NetFlix subscription free for a year (since I am already a NetFlix customer they gave me a $120 credit on my NetFlix account) and a $50 gift card. I have been using a Roku but their receiver can stream Netflix by itself

No difference in picture quality, the actually dish antenna is smaller, and the installer was very professional. Best part - we have the Hopper with Sling. So with their "Dish Anywhere" app, it will stream live tv or anything on your DVR anywhere you are

https://www.mydish.com/dish-anywhere
 

elude

n3wb
Joined
Dec 13, 2015
Messages
3
Reaction score
0
I haven't seen anything like that happen to mine. I have two of the h264 encoders, although they are not branded Oupree, they are the same device from what I can tell. Neither of them suddenly disconnects like that.

In fact just in the last few months I got one of Oupree's new OPR-NH100P encoders which can do up to 60fps in h264 or h265 and the only problem I've had with it is that if I feed it an interlaced video then the encoded video output bobs up and down by one pixel and is very distracting. They keep telling me they don't have a fix yet.

So I suspect your unit is defective. Have you tried updating its firmware?
Yes I have the latest 3.82 firmware. Another question: If you look at the "Interrupt number" on the status page of either of your devices is it a very high number? Does it ever reset to zero?

For me it goes up to maximum ~17000 and then the unit resets and goes back to 0.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
Yes I have the latest 3.82 firmware. Another question: If you look at the "Interrupt number" on the status page of either of your devices is it a very high number? Does it ever reset to zero?

For me it goes up to maximum ~17000 and then the unit resets and goes back to 0.
It does go up fairly quickly. Perhaps 30-50 per second. I'll watch it to see what happens.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
Up to 23000 interrupts, no reboot.

I've recorded hours-long movies using this to encode them without any spontaneous reboots though.

- - - Updated - - -

I will say I have to cut the bit rate down to under 1000 Kbps for it to stream reliably to my parents house. Internet around here just isn't very good. Supposed to be capable of 19 Mbps up at my house and ~25 Mbps down at my parents but a 1 Mbps stream is just too much for it sometimes.

Interrupt number: 28256 now, still no problem, no reset to 0.
 

elude

n3wb
Joined
Dec 13, 2015
Messages
3
Reaction score
0
Up to 23000 interrupts, no reboot.

I've recorded hours-long movies using this to encode them without any spontaneous reboots though.

- - - Updated - - -

I will say I have to cut the bit rate down to under 1000 Kbps for it to stream reliably to my parents house. Internet around here just isn't very good. Supposed to be capable of 19 Mbps up at my house and ~25 Mbps down at my parents but a 1 Mbps stream is just too much for it sometimes.

Interrupt number: 28256 now, still no problem, no reset to 0.
It turns out they sent me the wrong power adapter. It is suppose to be 12V 1A but they sent 5V 1A... So much trouble for something dumb.

Btw, so how is your setup? Cable box -> device -> router (port forwarding) -> web server that embeds the video into a page -=-=-=-=-=-> Stream from anywhere?
 

sprucecams

Getting the hang of it
Joined
Aug 4, 2014
Messages
142
Reaction score
11
Location
Chicagoland
FWIW, if you can tolerate a delay, I use DVR software (SageTV Media Center V7 which was bought out and discontinued by Google) with SiliconDust HDHomeRun networked tuners to record TV (which I receive OTA via an antenna in my attic, but SiliconDust also offers tuners compatible with cable systems). I then use MCEBuddy (freeware) to convert the recordings to MP4 files, which I can remotely stream via the Internet with Plex Media Server (I use the free version). Plex Media Server also allows me to stream my MP4 movies.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
My setup is directv satellite box -> encoder device -> network. I do not port forward to the encoder device directly. I wrote a custom piece of software that hosts a simple web page with a directv remote controller on it which I wired up to all the appropriate functions. I click a button and an IR blaster sends the appropriate command. Also on the page is a WebChimera plugin which connects to the http video stream. The stream is proxied through my program so that I can password protect the access to it.

Unfortunately WebChimera (which is based on VLC) does not do http streaming very well. It has buffering problems over a high latency connection like ... the internet. So I've been thinking about writing a second piece of custom software to pull the video stream and buffer it locally, then re-host it for the web viewer. This would add some additional delay but it would make it possible to use much higher bit rates without the stream cutting out so often.
 

BGChicago

Young grasshopper
Joined
Apr 17, 2016
Messages
61
Reaction score
16
Hello folks,
I need to integrate a stream into a Android application (it's written on Tasker), no need for any controls. I can only make it open http page that has ***.mp4 at the end (streaming file). Can this box do that?
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
Hello folks,
I need to integrate a stream into a Android application (it's written on Tasker), no need for any controls. I can only make it open http page that has ***.mp4 at the end (streaming file). Can this box do that?
Hello. These Chinese encoding boxes will not provide mp4 format. They can do RTSP (like an IP camera). They can also stream over http, but I am fairly certain it is an mpeg transport stream (MPEG-TS), not mp4.
 

BGChicago

Young grasshopper
Joined
Apr 17, 2016
Messages
61
Reaction score
16
Hello. These Chinese encoding boxes will not provide mp4 format. They can do RTSP (like an IP camera). They can also stream over http, but I am fairly certain it is an mpeg transport stream (MPEG-TS), not mp4.
I see.

Another question - any of you know what happens if the source signal is DTS HD, DolbyTrueHD, or PCM 5.1 or 7.1 ? I contacted a Chinese seller and he said "engineers confirmed it accepts ANY audio format" but I somehow don't believe that. Honestly, I don't care that much about getting the sound into the stream but I am afraid it might cause me trouble if it's EDID is not programmed for anything higher than DolbyDigital.
 

bp2008

Staff member
Joined
Mar 10, 2014
Messages
12,681
Reaction score
14,043
Location
USA
I'm not sure. I wouldn't even know how to test that because consumer gear really likes to hide the complexity.

I have never had it fail to decode the audio from DirecTV, but it does only write recompressed stereo audio, never surround. I don't think it ever loses audio channels when it re-encodes the audio at least.
 

BGChicago

Young grasshopper
Joined
Apr 17, 2016
Messages
61
Reaction score
16
I'm not sure. I wouldn't even know how to test that because consumer gear really likes to hide the complexity.

I have never had it fail to decode the audio from DirecTV, but it does only write recompressed stereo audio, never surround. I don't think it ever loses audio channels when it re-encodes the audio at least.
If you have a Blu-Ray player, Play a modern movie (most of them have DTS-HD tracks now a days) and hock up the H264 box to the HDMI output. If it works Blu-Ray player should stay on the multi-channel track and audio be heard on the stream. What I am expecting it happen is this:
The h264 box, will have in it's EDID info that only dupports stereo input or DolbyDigital at best and thus, Blu-Ray player will down convert the multi channel track to stereo.

Another side question, have you ever checked the delay? Let's say you hock up both your TV and this box to your source, play the stream on your device while at home and see how far behind the stream is. I need something with 1 sec max.
 
Top