Stream Amazon Prime to UPNP Devices via WLAN

Ok this is weird: I simply want to stream an Amazon Prime movie to our receiver supporting UPNP to be able to watch the film on the big TV screen and ideally use the notebook at the same time. Why is this so incredibly hard to realize and you need several software projects to realize it?

First I tried to use plugins for already existing software within our network. Namely:

Obviously it isn’t as simple as I thought initially. So how about a more generic solution. What if I just stream the whole desktop to the device?

If you start googleing about this it really looked like VLC is the way to go. I tried. I really tried. But whenever I tried to forward the desktop to a stream (http://, udp or whatever) VLC crashed. So while in theory VLC does exactly what we need it doesn’t work (at least it didn’t for me).

Now several hours later I’m still not ready to give up. How can such a simple thing not work? You know what? Gaming has been really successfull in streaming things via twitch.tv, so I guess I should look there for mature software and see how far I can get…

First I installed OBS the first software recommended by Twitch.tv and actually open source (so I thought it might be open enough to do other things than stream for twitch.tv). So now OBS is designed to stream to a streaming server and not to UPNP device so I need my own streaming server. After some more help from google it was clear that OBS itself provides the required documentation to do it. The only problem is that I’m using windows and had no intention of compiling anything, therefore I used a precompiled nginx version with rtmp support.

For recording I used the following trick:

For nginx I basically used the exact configuration from the documentation above:

C:\Users\dragon\Downloads\nginx-rtmp-win32-master\conf:

worker_processes  1;

error_log  logs/error.log debug;

events {
    worker_connections  1024;
}

rtmp {
    server {
        listen 8089;
        #chunk_size 256;

        #wait_key on;
        #wait_video on;
		
        application live {
            live on;
            record off;

            #wait_key on;
            #interleave on;
            #publish_notify on;
            #sync 10ms;
            #wait_video on;
            #allow publish 127.0.0.1;
            #deny publish all;
            #allow play all;
        }
		
		#application hls {
		#	live on;
		#	hls on;  
		#	hls_path temp/hls;  
		#	hls_fragment 8s;  
		#}
    }
}

http {
    server {
        listen      8088;
		
        location / {
            root www;
        }
		
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }

        location /stat.xsl {
            root www;
        }
		
		location /hls {  
           #server hls fragments  
			types{  
				application/vnd.apple.mpegurl m3u8;  
				video/mp2t ts;  
			}  
			alias temp/hls;  
			expires -1;  
        }  

    }
}

I like that the pre compiled nginx already has setup a page where I can directly what the stream if I want to.

After starting nginx in a console window (or by double clicking nginx.exe) your streaming server should be ready and you can finalize the OBS setup and start the stream:

Now the stream can be started successfully and we can even watch it via http://localhost:8088 by entering rtmp://127.0.0.1:8089/live/test in the box.

We are almost there, because we only need to bridge the gap between the rtmp stream and the UPNP device. Luckily serviio can close the gap:

Screenshot Setup 'Serviio'

Further information for this setup