PS4 RTMP Proxy

General discussion about Gargoyle, OpenWrt or anything else even remotely related to the project

Moderator: Moderators

Post Reply
beastwick987
Posts: 1
Joined: Mon Jul 06, 2015 12:24 pm

PS4 RTMP Proxy

Post by beastwick987 »

Hi everyone,

First of all Gargoyle has been extremely stable so far on my WDR3600. I am very pleased with it, but the reason why I switched to this firmware is giving me a headache.

I am following https://gist.github.com/benphelps/ac1f3171883669c24657, which allows me to redirect the RTMP stream from my PS4 to my PC running NGINX in a Virtualbox. I am doing this because it sounded interesting, I lack a capture card, and I would like to use FFMPEG to mix in a camera and other visual elements.

I use these IPTABLES rules:
iptables -t nat -A PREROUTING -d 199.9.0.0/16 -p tcp --dport 1935 -j DNAT --to-destination <local_ip>:1935
iptables -t nat -A POSTROUTING -j MASQUERADE

This is working beautifully. The stream hits my PC and is port fowarded to my Virtualbox instance. I then run FFMPEG using the NGINX path and I can locally record. However, I am having problems with broadcasting back to Twitch.TV. When I stream it works for a few minutes and then crashes. The router does not reboot as far as I can tell, but I am unable to hit any webpages until it seems to recover (takes like 30 seconds). Also using TCPDUMP I can still see a healthy flow of RTMP traffic from the PS4 still flooding into the Vbox.

I thought it was high bandwidth, but Gargoyle shows 20% use of RAM and like 1% of CPU in use at all times.

I am reading that I may have to setup a transparent proxy, but I'm not 100% sure what that means or how it is truly different from the above IPTABLE rules. This is how I am going to do it, but I would like some elaboration.

This I am assuming simply accepts RTMP traffic from the PS4 to the router as normal.
iptables -t nat -A PREROUTING -i br-lan -s $PS4 -d 192.168.1.1 -p tcp --dport 1935 -j ACCEPT

This makes sure any non proxy address using RTMP is directed to my proxy PC.
iptables -t nat -A PREROUTING -i br-lan -s ! 192.168.1.130 -p tcp --dport 1935 -j DNAT --to 192.168.1.130:1935

I have no idea what this does.
iptables -t nat -I POSTROUTING -o br-lan -s 192.168.1.1/24 -d 192.168.1.130 -p tcp -j SNAT --to 192.168.1.1

I have no idea what this does.
iptables -I FORWARD -i br-lan -o br-lan -s 192.168.1.1/24 -d 192.168.1.130 -p tcp --dport 1935 -j ACCEPT

I'm hoping that setting up a transparent proxy will fix my crash issues when I broadcast back to TwitchTV using the same port and destination IP that I suppose is being affected by the IPTABLE rules (since the PS4 is filtered by them).

Any help in understanding why my stream is crashing and my LAN connection seems to go poof at this point would be awesome.

Lantis
Moderator
Posts: 7153
Joined: Mon Jan 05, 2015 5:33 am
Location: Australia
Contact:

Re: PS4 RTMP Proxy

Post by Lantis »

My guess would have been a memory lockup of some kind. Can you do a logread after it hangs? There might be a clue.
https://lantisproject.com/downloads/gargoylebuilds for the latest releases
Please be respectful when posting. I do this in my free time on a volunteer basis.
https://lantisproject.com/blog

Post Reply