From bc1b619dee35b59ebd8675c8de5723a9f99d24fd Mon Sep 17 00:00:00 2001 From: crosstyan Date: Wed, 11 Mar 2026 15:11:41 +0800 Subject: [PATCH] docs(smoke): add srs whep setup guide --- docs/smoke/srs.local.conf | 57 +++++++++++++++++++++++++++++++++++++++ docs/smoke/srs.md | 49 +++++++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) create mode 100644 docs/smoke/srs.local.conf diff --git a/docs/smoke/srs.local.conf b/docs/smoke/srs.local.conf new file mode 100644 index 0000000..165b691 --- /dev/null +++ b/docs/smoke/srs.local.conf @@ -0,0 +1,57 @@ +# Local SRS config for manual RTMP and WHEP testing with cvmmap-streamer. +# Start with: +# cd ~/Code/srs/trunk +# ./objs/srs -c /home/crosstyan/Code/cvmmap-streamer-ffmpeg-mcap/docs/smoke/srs.local.conf +# +# If WebRTC/WHEP is consumed from another host and SRS chooses the wrong NIC, +# replace `candidate *;` with the reachable host IP. + +max_connections 64; +daemon off; +srs_log_tank console; + +rtmp { + listen 1935; +} + +http_api { + enabled on; + listen 1985; +} + +http_server { + enabled on; + listen 8080; + dir ./objs/nginx/html; +} + +stats { + network 0; +} + +rtc_server { + enabled on; + listen 8000; # UDP port + candidate *; +} + +vhost __defaultVhost__ { + hls { + enabled on; + } + + http_remux { + enabled on; + mount [vhost]/[app]/[stream].flv; + } + + rtc { + enabled on; + rtmp_to_rtc on; + rtc_to_rtmp off; + } + + play { + gop_cache_max_frames 2500; + } +} diff --git a/docs/smoke/srs.md b/docs/smoke/srs.md index 5eaac4b..762f5c9 100644 --- a/docs/smoke/srs.md +++ b/docs/smoke/srs.md @@ -10,6 +10,7 @@ Use these checks when you want to verify RTMP interoperability or a real cvmmap- - Synthetic RTMP smoke using `rtmp_output_tester` - Live cvmmap ingest -> FFmpeg encoder -> RTMP -> SRS HTTP-FLV forward +- Live cvmmap ingest -> FFmpeg encoder -> RTMP -> SRS WHEP/WebRTC playback ## Prerequisites @@ -94,6 +95,54 @@ Expected success signals: The HTTP-FLV probe is the authoritative pass/fail signal. The optional `ffmpeg` decode sample is best-effort because a very short bounded publish can disappear before the second client attaches. +## Manual Test: WHEP / WebRTC + +SRS supports WHEP playback, and it is the better path when RTMP or HTTP-FLV playback feels too slow. + +This repo includes a local SRS config copy at [srs.local.conf](/home/crosstyan/Code/cvmmap-streamer-ffmpeg-mcap/docs/smoke/srs.local.conf). It enables: + +- RTMP publish on `:1935` +- HTTP API on `:1985` +- HTTP player pages on `:8080` +- WebRTC UDP on `:8000` +- `rtmp_to_rtc on` + +Start SRS with that config: + +```bash +cd ~/Code/srs/trunk +./objs/srs -t -c /home/crosstyan/Code/cvmmap-streamer-ffmpeg-mcap/docs/smoke/srs.local.conf +./objs/srs -c /home/crosstyan/Code/cvmmap-streamer-ffmpeg-mcap/docs/smoke/srs.local.conf +``` + +Publish from the streamer: + +```bash +cd ~/Code/cvmmap-streamer-ffmpeg-mcap +./build/cvmmap_streamer \ + --run-mode pipeline \ + --input-uri 'cvmmap://zed@/tmp/cvmmap' \ + --codec h264 \ + --encoder-backend ffmpeg \ + --encoder-device nvidia \ + --rtmp \ + --rtmp-url 'rtmp://127.0.0.1/live/zed_live' \ + --rtmp-transport libavformat \ + --rtmp-mode enhanced +``` + +Open the WHEP player page in a browser: + +- Player page: `http://127.0.0.1:8080/players/whep.html` +- WHEP API URL: `http://127.0.0.1:1985/rtc/v1/whep/?app=live&stream=zed_live` + +Notes: + +- VLC is not the right client for WHEP. Use a browser or another WebRTC/WHEP-capable player. +- Keep the stream codec on `h264` for browser compatibility. +- If the browser runs on another host and SRS picks the wrong NIC, replace `candidate *;` in [srs.local.conf](/home/crosstyan/Code/cvmmap-streamer-ffmpeg-mcap/docs/smoke/srs.local.conf) with the reachable host IP. +- On this machine, likely candidates are `192.168.2.13` or `192.168.2.184`. + ## Example Live Result For a ZED source running at `cvmmap://zed@/tmp/cvmmap`, the successful forward probe looked like: