Stream HDHR - a CGI script to stream over the internet

Want to write your own code to work with a HDHomeRun or work with the HDHomeRun DVR? We are happy to help with concepts, APIs, best practices.
Post Reply
Posts: 26
Joined: Mon Dec 21, 2015 11:45 am
Device ID: 1043647F, 10581BCB

Stream HDHR - a CGI script to stream over the internet

Post by liquid64 » Tue Jul 10, 2018 9:14 am

I had posted my "rube goldberg" solution a year or so ago, for how I had been using my HDHomeRun CONNECT to stream over the internet (Similar to HDHRFling or using Plex's GrandSlam plugin). I was going to update my post with an updated version of my script, but I wasn't able to find the original post. Anyway, I'm going to repost this, if anyone has any interest in it. This is a CGI script that uses FFMPEG to transcode a stream from the HDHomeRun device. It was originally written for the CONNECT, and using an old netbook with an Atom processor and running Ubuntu 16.04. The specs didn't really allow me to transcode to h264, but i was able to transcode to a much smaller mpeg2 stream, so I could stream to VLC remotely. ... aJJJVP5Zpw

To install this, you need to have a functioning Apache installation already, with FFMPEG installed, the HTTP port configured through the firewall, and a DNS solution in place (like duckdns). The script will work on Windows using Strawberry Perl, and one of the Windows builds of Apache, but I haven't tested that as thoroughly as under Ubuntu. There are also a few variables that need to be set, at the top of the script. I am including two sets of arguments for FFMPEG. one for use with my EXTEND, and one for use with my older CONNECT.

Also, somewhat related to this script, although it doesn't need the script at all. If you enable mod_proxy in Apache, you can directly stream the EXTEND through Apache really quite well. I only added 3 lines to my sites file to make that work.

ProxyPass /hdhr/auto/ http://hdhomerunlocalIP:5004/auto/
ProxyPassReverse /hdhr/auto/ http://hdhomerunlocalIP:5004/auto/
ProxyPreserveHost On

Now, remotely I can goto in VLC, and it will begin playing.

For more on that, Google (apache reverse proxy)

Anyway have fun with these two solutions. Thanks Silicon Dust for offering devices that are so flexible. Mods, please feel free to move this post elsewhere, if it doesn't belong in the development forum.

Post Reply