Unofficial Road Trip Mode

Unofficial Road Trip Mode

Postby bigstu80 » Sat Sep 03, 2016 11:03 pm

Hi all! Just thought I'd share my experience in playing Obduction with my sister 300kms away with <2 seconds lag at high quality [email protected] including voice chat and webcam for drawing puzzles. Skip to the end for the summary. I couldn't find any other mention of road trip mode from the forums so I'm not sure if others have talked about it before.

The goal: To play obduction with my sister like we used to play Myst and Riven - sitting side by side discussing and problem solving, usually with pen and paper on hand (whilst being geographically separated).

The solution: Road trip mode. But alas, VR won the funding battle. So, on to the alternatives...

We’ll need to chat to each other, so Skype or Hangouts are the obvious choices. They have video so we could also share desktop to stream the game video to the other person. Unfortunately the encoder isn’t optimised for quality. Instead it’s optimised for realtime video. So even if it did capture the fullscreen application (which is unlikely), the compression artefacts destroy it.

OK so to maintain quality we could use a streaming service designed for quality like Twitch, YouTube Live, Steam, or any number of others. They’re meant for broadcasting to many viewers but in this case we just need one viewer. Unfortunately you gain image quailty but lose realtime - they’re all between 15-20 seconds delay. This is because your PC needs to send video to their server, their server transcodes to multiple qualities to target connection speeds and then broadcasts; all of which introduces lag. This is fine for the problem they’re solving as a 15 second delay in a large broadcast is perfect. But having the other player say “try that lever” when you pulled it 15 seconds ago isn’t ideal.

Next up would be something like NVidia GFE Share. The idea being that you can stream or even have the other player control your games via Nvidia’s GFE software. It generates a unique URL to share with the other person. Unfortunately it’s in beta and always crashes for me. We’ve never had a successful connection with it.

We’re running out of options. Low tech solution of using Hangouts over smartphone and camera recording screen is rubbish. High tech solution of reverse engineering the game and adding networking sync is time (and probably legally) prohibitive.

The Final Solution

We really want P2P Twitch. Since that doesn’t exist, we can make our own streaming server like Twitch instead. Then we can stream from Open Broadcaster Studio (OBS) both the game and webcam (either inset or swapping between them) and try to get the delay as short as possible.

I’m using the web server nginx with an RTMP module. RTMP is the protocol used by some of the aforementioned services. I’m running this on an Ubuntu server with dedicated hardware on my LAN. The default RTMP port 1935 is port forwarded from my router to allow outside connections. OBS sends it’s stream to this server from my Windows PC. The server doesn’t perform any transcoding so it’s important the settings in OBS are correct to ensure a fast, good quality stream.

Note: you don’t need a dedicated server, you could run it all on your PC either installed directly or running via a virtual machine. I already had a linux server so it was easier for me to use that instead. Plus that means one less thing that the PC needs to do.

Now Nvidia cards have hardware encoding, but I skipped that in favour of CPU encoding as it allowed further tweaking of the encoder to allow me to go from a 4 second delay over LAN to less than a second. I’m using a Skylake i7 so I’ve got enough spare cycles to do this task whilst also running the game without issue.

Testing this whole setup showed around a 1-2 second lag at [email protected] over the WAN at 2000kbps. It could be faster but I’m more than happy to leave it here.

The next problem is voice chat. Without headphones, voice chat is problematic in general as you’ll possibly hear an echo of yourself from the other end. Headphones or a headset are the only way to go for crisp, echo-free voice chat.

Now the real problem here is that the stream via OBS is independent of the voice chat in Skype. OBS needs to send the audio of the game but not the voice chat or we’ll end up with the other end getting a crystal clear echo of their conversation with a 2 second delay. This raises a problem of how to separate the two?

Audio Setup 1
The game will use the default playback device for it’s audio and in Skype we can customise what device we use for playback. OBS also has control over which device it’ll use to stream the audio. So if the headphones are the default, Skype uses headphones and OBS uses headphones, then we’ve got a voice chat echo problem as OBS will be sending the received Skype audio from the headphone device.

Audio Setup 2
If the speakers are the default, Skype uses headphones and OBS uses the speakers, we’ve separated the two but the mic will pick up the local game audio from the speakers, creating a different kind of echo for the other end (they’ll hear the background game audio via Skype, followed by the real game audio in the stream 2 seconds later).

Audio Setup 3
If the headphones are the default, Skype uses speakers and OBS uses headphones, we’ll get the normal echoey chat that you’d normally get with a non-headphone voice chat. This is almost as good as we could get it, but there’s one more thing to try.

Audio Setup 4
Under recording devices I’ve got Stereo Mix (turn on disabled/hidden devices to see if your onboard/external soundcard supports it). This allows me to mix the default playback device into another of my choosing. This means I can have speakers default, Skype headphones, OBS speakers, with Stereo Mix mixing the speakers into the headphones. With the physical speakers off, I’ll still hear the output as they’re mixed into the headphones, plus OBS won’t hear the Skype audio as it’s sent directly to the headphones which means every source is clean. No echo. One small problem is it doesn’t work in the default device is SPDIF. So I’ve used analog out for the default which mixes in for the analog headphones. Solved. If you don’t have Stereo Mix, use Setup 3.

So in the end we have this setup:

The player end
  • 2 computers: one Windows, one Linux
  • 2Mbps+ upload speed with ISP
  • Windows is playing Obduction and streaming the video using OBS to the Linux machine whilst running Skype for audio chat
  • Linux has nginx + RTMP and handles receiving the stream from the Windows machine, and sending it to the participant end
  • Router has a port forward to the Linux machine to allow the participant to connect to the stream
  • Obduction audio comes through default playback device speakers, Skype uses headphones, OBS captures speakers and the Stereo Mix recording device mixes the speaker device into the headphones (physical speakers are turned off). All this achieves echo free game audio and voice chat simultaneously over headphones.

Participant end
  • Computer running VLC for game stream and Skype for audio chat
  • 2Mbps+ download speed from ISP

As you can see, whoever is feeling more nerdy and/or has more horsepower will be the player end :)

If you have an easier/better solution I’d be interested to hear it. If you want more details of this setup let me know and I’ll post the details. Even if there’s software X that does it, it was an interesting exercise nonetheless.
bigstu80
Obduction Backer
 
Posts: 3
Joined: Fri Nov 15, 2013 6:34 pm

Re: Unofficial Road Trip Mode

Postby bigstu80 » Sun Sep 04, 2016 6:08 pm

I wrote this up for a friend, so I thought I'd post all my sources in case someone else wants to attempt the setup explained in the OP. Good luck :)

# configure ubuntu 14.04 server with nginx + rtmp
https://gist.github.com/naiwungmusic/10 ... b79a8e0e1f
# OR as a friendlier, descriptive guide, including editing /usr/local/nginx/conf/nginx.conf to setup stream
https://obsproject.com/forum/resources/ ... -nginx.50/

# setup encoder settings for OBS
# Note: any settings not listed are to remain as default
https://github.com/arut/nginx-rtmp-module/issues/378
Code: Select all
Settings
  Stream
    URL: rtmp://server_name:1935/live
    Stream key: stream
  Output
    Mode: Advanced
    Streaming
      Encoder: x264
      Enforce streaming service encoder settings: true
      Rate Control: CBR
      Bitrate: 2000
      Tune: zerolatency
      x264 Options: -intra-refresh=1 -pix_fmt=yuv420p
    Video
      Base Resolution: 1920x1080
      Output Resolution: 1280x720
      Downscale Filter: Lanczos
      Common FPS Value: 30


# test the stream
ffplay -fflags nobuffer rtmp://222.174.255.26/live/stream -loglevel verbose
https://github.com/arut/nginx-rtmp-module/issues/378
https://ffmpeg.org/ffplay.html

# port forward 1935 UDP (and maybe TCP) on your router to your linux box

# to share the stream, find the public IP and the following will be your address:
# rtmp://<public_ip>:port/application_name/stream_name
# e.g. rtmp://13.15.182.1:1935/live/stream
wget http://ipinfo.io/ip -qO -
http://askubuntu.com/questions/95910/co ... -public-ip

# and finally, this is what I based my audio setup on
http://superuser.com/a/997538


Extra curricular stuff:

# additional settings can be found here to tweak the rtmp server
https://github.com/arut/nginx-rtmp-modu ... ives#allow

# FYI set up a transcoded stream using above settings for android
https://github.com/arut/nginx-rtmp-module/issues/758
bigstu80
Obduction Backer
 
Posts: 3
Joined: Fri Nov 15, 2013 6:34 pm


Return to GENERAL DISCUSSION (No Spoilers)

Who is online

Users browsing this forum: No registered users and 2 guests

cron