Real-time network Quality of Service (QoS), bufferbloat, and mesh overlay diagnostic engine designed specifically for low-latency interactive game streaming (Moonlight, Sunshine, GeForce NOW) and remote virtual workspaces.
Featuring an Intelligent Moonlight Configuration Advisor with psychovisual Bits-Per-Pixel-Per-Frame (
Traditional speedtests measure bulk TCP download speeds against public CDN edge servers. For real-time interactive game streaming, bandwidth is rarely the bottleneck; rather, stream quality is dictated by transport-layer stability and encoding limits:
- Idle vs. Loaded Latency (Bufferbloat): A home connection may demonstrate 15 ms latency when idle. Under a 40 Mbps video stream, unmanaged consumer router FIFO queues fill up, causing latency to spike to 200+ ms and dropping real-time frame deadlines.
- Interarrival Jitter (RFC 3550): Video decoders and packet buffers can handle a steady 40 ms ping, but erratic delay swings (10 ms -> 90 ms -> 15 ms) cause immediate frame drops, stuttering, and audio desynchronization.
- The 4K Bitrate Trap & Scene Entropy Bursts: Pushing 4K @ 60 FPS on a 65 Mbps connection with an 80 Mbps Moonlight preset causes immediate collapse. Constant Bitrate (CBR) encoders spike 30–50% during high-entropy scene changes (fast camera turns, grass, explosions). Without safety headroom, intermediate network buffers overflow.
- Overlay Mesh Routing (WireGuard / NetBird): When clients connect through software-defined mesh overlays, symmetric NATs can prevent direct peer-to-peer UDP hole punching. Traffic silently falls back to intermediate cloud relay nodes (TURN/DERP), introducing unexpected latency penalties without user awareness.
stream-netcheck resolves these visibility gaps by executing multi-phase telemetry, isolating root causes, and synthesizing precise, actionable Moonlight/Sunshine client configurations.
flowchart TD
Client["Client Device (Web SPA / CLI / Embedded Iframe)"] <-->|"Dual-Phase Probe (WebSocket Echo + 8 MB Throughput Stream)"| Gateway["stream-netcheck Server Gateway (FastAPI)"]
subgraph Gateway ["Diagnostics Engine"]
WSEcho["WebSocket Probing Engine<br/>- Continuous Sub-millisecond Echo Loop<br/>- RFC 3550 Interarrival Jitter Filter<br/>- 30s Live Canvas Oscillation Graph"]
LoadProbe["8 MB TCP Throughput Stream<br/>- Loaded Latency Measurement<br/>- Bufferbloat Delta Calculation<br/>- Slow-Start Window Mitigation"]
OverlayResolver["NetBird / WireGuard Topology Resolver<br/>- Direct Peer-to-Peer vs Relay Detection"]
Classifier["ITU-T Y.1541 QoS SLA Classifier<br/>- Root Cause Analysis (RCA) Engine"]
Advisor["Intelligent Moonlight Configuration Advisor<br/>- Adaptive Headroom & FEC Budgeting<br/>- BPPF Psychovisual Quality Scoring<br/>- Dual-Mode Optimization (Cinematic vs Competitive)"]
end
WSEcho --> Classifier
LoadProbe --> Classifier
OverlayResolver --> Classifier
Classifier --> Advisor
Advisor --> Report["Diagnostic Verdict & Actionable Moonlight Presets<br/>- Bitrate Slider, Codec Choice (AV1 / HEVC), Resolution & Frame Pacing"]
Rather than presenting raw network telemetry that requires specialized interpretation, stream-netcheck translates physical network parameters into exact, optimal settings for Moonlight and Sunshine.
Sunshine video streams share the underlying transport link with Forward Error Correction (FEC) packets. The advisor calculates the maximum safe video bitrate
-
Adaptive Headroom:
$\Delta \text{ Bufferbloat} \le 3.0\text{ ms} \rightarrow 0.80$ $3.0\text{ ms} < \Delta \text{ Bufferbloat} \le 12.0\text{ ms} \rightarrow 0.70$ $\Delta \text{ Bufferbloat} > 12.0\text{ ms} \rightarrow 0.60$
-
FEC Overhead Factor:
-
$\text{Packet Loss} < 0.2% \rightarrow \text{FEC} = 0%$ ($\text{Factor}_{\text{fec}} = 1.0$ ) -
$0.2% \le \text{Packet Loss} \le 1.0% \rightarrow \text{FEC} = 10%$ ($\text{Factor}_{\text{fec}} \approx 0.909$ ) -
$\text{Packet Loss} > 1.0% \rightarrow \text{FEC} = 20%$ ($\text{Factor}_{\text{fec}} \approx 0.833$ )
-
-
Penalties:
-
$\text{Penalty}_{\text{loss}} = 0.85$ if$\text{Packet Loss} > 1.0%$ -
$\text{Penalty}_{\text{bloat}} = 0.90$ if$\Delta \text{ Bufferbloat} > 35.0\text{ ms}$
-
To prevent visual degradation caused by excessive compression, candidate profiles are evaluated using Effective Bits Per Pixel Per Frame (
-
Hard Floor: Any candidate with
$BPPF_{\text{eff}} < 0.10$ is disqualified. -
Resolution Component:
$\text{Score}_{\text{res}} = \frac{\text{Height}}{2160.0}$ - Quality Saturation: $\text{Score}{\text{quality}} = \min\left(1.0, \max\left(0.0, \frac{BPPF{\text{eff}} - 0.10}{0.25}\right)\right)$
-
Cinematic Mode (
$\text{FPS} \le 60$ ): Focuses on visual fidelity and detail retention in motion: $$\text{Score}{\text{cinematic}} = 0.35 \times \text{Score}{\text{res}} + 0.65 \times \text{Score}_{\text{quality}}$$ -
Competitive Mode (
$\text{FPS} == 120$ ): Prioritizes frame rate and motion clarity. Strictly enabled only when$\text{RTT} \le 30.0\text{ ms}$ : $$\text{Score}{\text{competitive}} = 0.25 \times \text{Score}{\text{res}} + 0.75 \times \text{Score}_{\text{quality}}$$
On a 65 Mbps link with
-
4K @ 60 FPS (AV1):
$BPPF_{\text{eff}} = 0.154 \rightarrow \text{Score} = 0.489$ (heavy compression artifacts in motion). -
1440p @ 60 FPS (AV1):
$BPPF_{\text{eff}} = 0.346 \rightarrow \mathbf{\text{Score} = 0.873}$ (triumph: over$2.2\times$ the bit density, producing razor-sharp textures).
-
Quick Test (~4 seconds): 30 high-frequency ICMP/WebSocket probes (
$50\text{ ms}$ interval) followed by an 8 MB throughput burst. Ideal for rapid verification before launching a session. -
Full Stability Monitor (30 seconds): 180 continuous probes (
$150\text{ ms}$ interval) with a real-time Canvas RTT oscillation graph. Specifically detects periodic Wi-Fi frame drops, 802.11 MAC retransmissions, background channel sweeps, and modulation rate throttling.
Throughput probing utilizes an 8 MB binary stream (/api/bandwidth/chunk?size_mb=8.0). On connections with 25–40 ms RTT, smaller chunks (e.g. 2 MB) complete before the TCP Congestion Window (cwnd) fully opens, artificially deflating bandwidth estimates. An 8 MB payload ensures accurate link saturation.
Calculated using the exponential smoothing filter specified in RFC 3550 for RTP streams:
Quantifies buffer queuing delay induced under network load:
| SLA Grade | Designation | Average RTT | RFC 3550 Jitter | Packet Loss | Bufferbloat Delta | Overlay Route |
|---|---|---|---|---|---|---|
| Grade A | Ultra-Low Latency | Direct P2P | ||||
| Grade B | Stable Interactive | Direct P2P | ||||
| Grade C | Functional / High Latency | Direct P2P | ||||
| Grade D | Degraded / Relayed | Relayed (TURN) |
Run the pre-configured container exposing port 8055:
docker run -d \
--name stream-netcheck \
-p 8055:8055 \
--restart unless-stopped \
mateosek/stream-netcheck:latestAlternatively, build and run via Docker Compose:
docker compose up -dAccess the web interface at http://localhost:8055.
git clone https://github.com/Mateosek/stream-netcheck.git
cd stream-netcheck
pip install -r requirements.txt
python -m uvicorn server.app:app --host 0.0.0.0 --port 8055Execute network quality checks with complete Moonlight preset output from a terminal:
python -m cli.main --host 127.0.0.1:8055 --count 30To export structured telemetry (including moonlight_config) for automated pipelines:
python -m cli.main --host 127.0.0.1:8055 --jsonstream-netcheck includes an exhaustive automated test suite covering RFC 3550 jitter filters, bufferbloat edge-cases, Wi-Fi spike detection, and all 5 reference Moonlight advisor scenarios:
pytest -vtests/test_advisor.py::test_scenario_a_baseline PASSED [ 8%]
tests/test_advisor.py::test_scenario_b_fiber PASSED [ 16%]
tests/test_advisor.py::test_scenario_c_degradation PASSED [ 25%]
tests/test_advisor.py::test_scenario_d_narrow_band PASSED [ 33%]
tests/test_advisor.py::test_scenario_e_distant_p2p PASSED [ 41%]
tests/test_qos.py::test_rfc3550_jitter_zero_variance PASSED [ 50%]
tests/test_qos.py::test_rfc3550_jitter_varying_delay PASSED [ 58%]
tests/test_qos.py::test_qos_metrics_aggregation PASSED [ 66%]
tests/test_qos.py::test_sla_grade_a PASSED [ 75%]
tests/test_qos.py::test_sla_grade_f_due_to_relay PASSED [ 83%]
tests/test_qos.py::test_sla_bufferbloat_detection PASSED [ 91%]
tests/test_qos.py::test_sla_wifi_spike_detection PASSED [100%]
============================== 12 passed in 0.03s ==============================
stream-netcheck was developed as the diagnostic telemetry backbone for the Twierdza Cloud Gaming Platform.
Its zero-dependency frontend can be embedded into central management dashboards via an iframe:
<iframe
src="http://twierdza-host:8055"
width="100%"
height="620px"
frameborder="0">
</iframe>Developed and maintained by Mateusz Malinowski (@Mateosek).
Distributed under the terms of the MIT License.