Send stream from home to AWS EC2 instance

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
Israel Calvete
Posts: 2
Joined: Sun Aug 12, 2018 2:11 am

Send stream from home to AWS EC2 instance

Post by Israel Calvete » Mon Aug 13, 2018 12:23 am

Hi,

I'm trying something odd to get fun. Send stream from home to AWS EC2 instance.

First aproach. Read stream with ffmpeg
(tested locally successfully)

hdhomerun_config discover sya my device have ip 192.168.1.200 so I open port on my router in this way

<my home public ip>:5005 -> 192.168.1.200:80
<my home public ip>:5004 -> 192.168.1.200:5004

w3m and telnet say everything is ok.

But...

from EC2 instance I do

Code: Select all

/usr/bin/ffmpeg -y -i 'http://<my home public ip>:5004/auto/v5057?transcode=internet240' -t 12 -vn -acodec pcm_s16le -ar 16000 -ac 1 '/tmp/test.wav'
In tuner1 I can see...

Code: Select all

Virtual Channel	none
Frequency	698.000 MHz
Program Number	186
Modulation Lock	t8qam64
Signal Strength	89%
Signal Quality	100%
Symbol Quality	100%
Streaming Rate	none
Resource Lock	<EC2 public ip>
In system logs...

Code: Select all

19700102-10:27:25 Tuner: tuner0 tuning 5057 Telecinco (t8qam64:698MHz-186)
19700102-10:27:25 Tuner: tuner0 streaming http to <EC2 public ip>:34124
Everything seems ok but ffmpeg don't get any data.

Seccond aproach. Send stream to wowza

I have a wowza server running in EC2 instance


From a linux box at my home

Code: Select all

root# /usr/bin/hdhomerun_config 1250D7B2 scan /tuner1 scan.log
root# /usr/bin/hdhomerun_config 1250D7B2 set /tuner1/channel auto:651000000
root# /usr/bin/hdhomerun_config 1250D7B2 get /tuner1/streaminfo
root# /usr/bin/hdhomerun_config 1250D7B2 get /tuner1/program 190
root# /usr/bin/hdhomerun_config 1250D7B2 set /tuner1/target rtp://<wowza server public ip>:1935/TEST/hdhr
root# echo $?
root# 0
Ends without error buy doesn't work
This was a long shot but ....

Any ideas to do this.

Thanks !!!

jasonl
Silicondust
Posts: 13828
Joined: Sun Oct 28, 2007 9:23 pm

Re: Send stream from home to AWS EC2 instance

Post by jasonl » Tue Aug 14, 2018 1:20 pm

HDHomeRun devices have a TTL of 3 set on outgoing video packets, as specified by DLNA standards. You will not be able to stream over the internet.

liquid64
Posts: 26
Joined: Mon Dec 21, 2015 11:45 am
Device ID: 1043647F, 10581BCB

Re: Send stream from home to AWS EC2 instance

Post by liquid64 » Fri Aug 17, 2018 6:35 am

I have had pretty good luck using apache as a reverse proxy, to stream my extend over the internet. If you have a working apache installation on the same network as the hdhomerun, enable mod_proxy:

Code: Select all

sudo a2enmod proxy
sudo a2enmod proxy_http
and use this directive:

Code: Select all

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

Now, remotely I can goto http://myprivatedomain.com/hdhr/auto/v14.1 in VLC, and it will begin playing.

Israel Calvete
Posts: 2
Joined: Sun Aug 12, 2018 2:11 am

Re: Send stream from home to AWS EC2 instance

Post by Israel Calvete » Sun Aug 19, 2018 11:32 pm

I finally achieved it.

I used ffserver.

ffserver with 4 feeds and 4 streams.

4 ffmpegs consuming hdhomerum and feeding ffserver. Besides, I used ffmpeg to trascode the streams acording to my needs.

Bad new? I need a machine to do that.

Thanks all.

Radio example:

ffserver.conf

Code: Select all

<Feed feed0.ffm>
  File /tmp/feed0.ffm
  FileMaxSize 200K
  ACL allow 127.0.0.1
</Feed>


<Stream s0.wav>
  Feed feed0.ffm
  Metadata title "Stream 0 wav"
  Format wav
  AudioCodec pcm_s16le
  AudioBitRate 32
  AudioChannels 1
  AudioSampleRate 16000
  NoVideo
</Stream>
Incoming feed with ffmpeg

Code: Select all

/usr/bin/ffmpeg -i "http://192.168.1.200:5004/auto/v5054?transcode=internet240" -vn -ar 16000 -ac 1 http://localhost:8090/feed1.ffm

Final url is http://192.168.1.123:8090/s0.wav. (With public IP from Internet)

Post Reply