180e95f74d
- Switch OBS output to RTMP; add FFmpeg AAC->Opus transcoding via MediaMTX runOnReady so WebRTC can carry audio (WebRTC requires Opus, not AAC) - Enable RTSP on localhost so FFmpeg reads game path without publisher conflict; viewers connect to game-opus path (H264+Opus) - Fix WHEP/HLS path prefix stripping in NPM advanced config; move all custom locations (/whep, /hls, /v3) out of NPM GUI and into advanced conf so trailing-slash proxy_pass correctly strips prefixes before hitting MediaMTX - Fix MediaMTX API port 49997->19997 (49997 was in Windows ephemeral range) - Add /status proxy endpoint to OBS HTTP server so frontend can poll stream readiness without hitting /v3/ through NPM where auth_request blocked it - Fix authInternalUsers: split publish (localhost only) from read (any IP) so WHEP viewers are not challenged with Basic Auth by MediaMTX - Remove muted attribute from video element; show unmute/play button on autoplay block so viewers get audio after one click - Fix webrtcAdditionalHosts to include LAN IP 192.168.50.254 - Fix hlsAllowOrigin->hlsAllowOrigins deprecation warning - Move MediaMTX/HTTP server startup to script_load (not streaming started) so MediaMTX is ready before OBS attempts RTMP connection - Log MediaMTX output to bin/mediamtx.log for easier debugging Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
106 lines
2.9 KiB
YAML
106 lines
2.9 KiB
YAML
# MediaMTX configuration for game-stream-app
|
|
# Spawned as a subprocess by obs-script/game_stream.py when OBS starts streaming.
|
|
|
|
###############################################################################
|
|
# Global
|
|
###############################################################################
|
|
|
|
logLevel: info
|
|
logDestinations: [stdout]
|
|
readTimeout: 10s
|
|
writeTimeout: 10s
|
|
writeQueueSize: 512
|
|
|
|
###############################################################################
|
|
# API (used by the OBS script dock to poll viewer count / stream status)
|
|
###############################################################################
|
|
|
|
api: yes
|
|
apiAddress: 127.0.0.1:19997
|
|
|
|
###############################################################################
|
|
# WebRTC (WHIP ingest + WHEP playback)
|
|
###############################################################################
|
|
|
|
webrtc: yes
|
|
webrtcAddress: :48889
|
|
webrtcEncryption: no
|
|
webrtcLocalUDPAddress: :48189
|
|
webrtcLocalTCPAddress: ''
|
|
webrtcAdditionalHosts:
|
|
- stream.hetherman.cloud
|
|
- 192.168.50.254
|
|
webrtcICEServers2:
|
|
- url: stun:stun.l.google.com:19302
|
|
webrtcHandshakeTimeout: 10s
|
|
webrtcTrackGatherTimeout: 2s
|
|
|
|
###############################################################################
|
|
# HLS (fallback for clients where WebRTC fails)
|
|
###############################################################################
|
|
|
|
hls: yes
|
|
hlsAddress: :48888
|
|
hlsEncryption: no
|
|
hlsAlwaysRemux: no
|
|
hlsVariant: lowLatency
|
|
hlsSegmentCount: 7
|
|
hlsSegmentDuration: 200ms
|
|
hlsPartDuration: 200ms
|
|
hlsSegmentMaxSize: 50M
|
|
hlsAllowOrigins: ['*']
|
|
hlsTrustedProxies: []
|
|
|
|
###############################################################################
|
|
# Protocols
|
|
###############################################################################
|
|
|
|
# RTSP on localhost only - used internally so FFmpeg can read the game path
|
|
# as a consumer (not a publisher) without conflicting with OBS.
|
|
rtsp: yes
|
|
rtspAddress: 127.0.0.1:8554
|
|
|
|
# RTMP for OBS ingest. Localhost only.
|
|
rtmp: yes
|
|
rtmpAddress: 127.0.0.1:1935
|
|
|
|
srt: no
|
|
|
|
###############################################################################
|
|
# Paths
|
|
###############################################################################
|
|
|
|
pathDefaults:
|
|
sourceOnDemand: no
|
|
|
|
authInternalUsers:
|
|
- user: any
|
|
pass: ""
|
|
ips: [127.0.0.1/32, ::1/128]
|
|
permissions:
|
|
- action: publish
|
|
- action: api
|
|
- user: any
|
|
pass: ""
|
|
ips: []
|
|
permissions:
|
|
- action: read
|
|
|
|
paths:
|
|
# OBS publishes H264+AAC here via RTMP.
|
|
# runOnReady spawns FFmpeg which reads via RTSP (as a reader, no publisher
|
|
# conflict) and re-publishes to game-opus with audio transcoded to Opus.
|
|
game:
|
|
source: publisher
|
|
runOnReady: >-
|
|
ffmpeg
|
|
-i rtsp://127.0.0.1:8554/game
|
|
-c:v copy
|
|
-c:a libopus -b:a 128k -ar 48000 -ac 2
|
|
-f rtsp rtsp://127.0.0.1:8554/game-opus
|
|
runOnReadyRestart: yes
|
|
|
|
# Transcoded path: H264 + Opus. Viewers connect here via WHEP/HLS.
|
|
game-opus:
|
|
source: publisher
|