Steam streaming

From wikinotes

Stream games over your local network.
You may also be interested in moonlight.

Firewall

https://support.steampowered.com/kb_article.php#networkports

# on host (in traffic?)
UDP: 27031,27036
TCP: 27036,27037

Configuration

Client

# Client

View > Settings:
  Remote Play:
    - [x] Enable advanced client options
        - video: beautiful
        - [x] hardware decoding
        - [ ] HEVC video             # immediate crash on start stream
        - [x] low latency networking

Host

# Host
View > Settings:
  Remote Play:
    - [ ] Change resolution to match streaming client # unecessary so far
    - [x] Dynamically adjust capture performance
    - [ ] Use NVFBC capture on NVIDIA GPU             # network fail - possibly requires nvidia gpu on both sides?
    - [x] Enable Hardware Encoding
      - [x] on Nvidia
      - [ ] on AMD
      - [ ] on Intel iGPU

Finally, stream a game and run nload to determine bandwidth performance.
For me at 1080p, bandwidth was just over 50 Mbps.

Troubleshooting

Show Performance Overlay

Enable detailed overlay stats

Steam > Settings:
  - Remote Play Tab:
    - Advanced Client Options:
      - Performance Overlay: Details  # default, icons

Then in-game you can toggle it's visibility with

gamepad:  select + y
keyboard: # I think F8?

Network Performance

  • Watch bandwidth usage using nload
  • Determine bandwidth type using tcpdump
  • If network is congested, consider increasing buffer sizes
sysctl -q net.ipv4.tcp_window_scaling  # want 1
sysctl -q net.ipv4.tcp_syncookies      # want 1

# increase TCP send/recv buffers
sysctl -q net.core.rmem_max            # want high
sysctl -q net.core.wmem_max            # want high
sysctl -q net.ipv4.tcp_rmem            # want high
sysctl -q net.ipv4.tcp_wmem            # want high

# set temporarily using:
#    sysctl -w net.ipv4.tcp_window_scaling=1


NOTE:

Apparently, steam streaming struggles with multiple network interfaces.
Connecting explicitly via ip address sometimes yields better performance.

steam://open/console
connect_remote <ip>:27036

# should see < 1ms ping over wireless N even, apparently


Settings Troubleshooting

- ensure game resultion matches display
  # (ex. rendering 1440p, but downscaling stream to 1080p tv)
  # this has given me +15fps

- enable hardware encoding/decoding (on host/client)

Performance Overlay Warnings

Warnings

Slow convert, display:  # encoding faster than can decode
Slow decode:
Slow encode:

Ensure your game, desktop are running at the resolution of the stream.
Otherwise, you'll get scale, which means it's being scaled down, and decoded locally (which is slower).
https://github.com/ValveSoftware/steam-for-linux/issues/5591#issuecomment-1060051597

Encoder: Game Vulkan RGB + libyuv + scale + NVENC H264  # bad
Encoder: Game Vulkan RGB + libyuv + NVENC H264          # good

Remote Play Crashes

The streaming client exited unexpectedly (2)

I encountered this streaming with the intel igpu drivers.

On the streaming client

- Steam > Settings:
  - Remote Play:
    - Advanced Client Options:
      - [ ] Enable Hardware Decoding