From 37710879b2bcf0b6f33a3343a91709972e69bf7f Mon Sep 17 00:00:00 2001 From: a-wing <1@233.email> Date: Sun, 12 Nov 2023 16:25:50 +0800 Subject: [PATCH] change default address and port --- README.md | 56 ++++++++++++++++++++++++------------------------ config-dist.toml | 11 ++++++---- src/config.rs | 4 ++-- 3 files changed, 37 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 24cbb97a..8c9b02da 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Live777 is an SFU server for real-time video streaming for the `WHIP`/`WHEP` as Live777 media server is used with [Gstreamer](https://gstreamer.freedesktop.org/), [FFmpeg](https://ffmpeg.org/), [OBS Studio](https://obsproject.com/), [VLC](https://www.videolan.org/), [WebRTC](https://webrtc.org/) and other clients to provide the ability to receive and distribute streams, and is a typical publishing (pushing) and subscription (playing) server model. -Live777 supports the conversion of audio and video protocols widely used in the Internet, such as RTP to WHIP or WHEP and other protocols. +Live777 supports the conversion of audio and video protocols widely used in the Internet, such as RTP to WHIP or WHEP and other protocols. ![live777-arch](./docs/live777-arch.excalidraw.svg#gh-light-mode-only) ![live777-arch](./docs/live777-arch.dark.svg#gh-dark-mode-only) @@ -55,11 +55,11 @@ docker run --name live777-server --rm --network host ghcr.io/binbat/live777-serv This `WHIP`/ `WHEP` plugins from [gst-plugins-rs](https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/) -> *Note: supports multiple encoding formats* +> *Note: supports multiple encoding formats* #### Video: AV1 -**Note: AV1 has a lot of problem** +**Note: AV1 has a lot of problem** - 🚧 browser whip av1 - 🚧 browser whep av1 - ✅ gstreamer whip av1 @@ -74,7 +74,7 @@ This `WHIP`/ `WHEP` plugins from [gst-plugins-rs](https://gitlab.freedesktop.org ```bash docker run --name live777-client-whip --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 videotestsrc ! av1enc usage-profile=realtime ! av1parse ! rtpav1pay ! whipsink whip-endpoint="http://localhost:3000/whip/777" +gst-launch-1.0 videotestsrc ! av1enc usage-profile=realtime ! av1parse ! rtpav1pay ! whipsink whip-endpoint="http://localhost:7777/whip/777" ``` `WHEP`: @@ -84,7 +84,7 @@ I don't know why av1 and whep error But, you can: ```bash -cargo run --package=whepfrom -- -c av1 -u http://localhost:3000/whep/777 -t 127.0.0.1:5004 +cargo run --package=whepfrom -- -c av1 -u http://localhost:7777/whep/777 -t 127.0.0.1:5004 ``` ```bash @@ -96,47 +96,47 @@ gst-launch-1.0 udpsrc port=5004 caps="application/x-rtp, media=(string)video, en #### Video: VP8 `WHIP`: - + ```bash docker run --name live777-client-whip --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 videotestsrc ! videoconvert ! vp8enc ! rtpvp8pay ! whipsink whip-endpoint="http://localhost:3000/whip/777" +gst-launch-1.0 videotestsrc ! videoconvert ! vp8enc ! rtpvp8pay ! whipsink whip-endpoint="http://localhost:7777/whip/777" ``` - + `WHEP`: - + ```bash docker run --name live777-client-whep --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=96,encoding-name=VP8,media=video,clock-rate=90000" ! rtpvp8depay ! vp8dec ! videoconvert ! aasink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=96,encoding-name=VP8,media=video,clock-rate=90000" ! rtpvp8depay ! vp8dec ! videoconvert ! aasink ``` #### Video: VP9 `WHIP`: - + ``` bash docker run --name live777-client --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 videotestsrc ! videoconvert ! vp9enc ! rtpvp9pay ! whipsink whip-endpoint="http://localhost:3000/whip/777" +gst-launch-1.0 videotestsrc ! videoconvert ! vp9enc ! rtpvp9pay ! whipsink whip-endpoint="http://localhost:7777/whip/777" ``` `WHEP`: - + ```bash docker run --name live777-client-whep --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=98,encoding-name=VP9,media=video,clock-rate=90000" ! rtpvp9depay ! vp9dec ! videoconvert ! aasink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=98,encoding-name=VP9,media=video,clock-rate=90000" ! rtpvp9depay ! vp9dec ! videoconvert ! aasink ``` #### Video: H264 `WHIP`: - + ```bash docker run --name live777-client --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 videotestsrc ! videoconvert ! x264enc ! rtph264pay ! whipsink whip-endpoint="http://localhost:3000/whip/777" +gst-launch-1.0 videotestsrc ! videoconvert ! x264enc ! rtph264pay ! whipsink whip-endpoint="http://localhost:7777/whip/777" ``` `WHEP`: @@ -144,7 +144,7 @@ gst-launch-1.0 videotestsrc ! videoconvert ! x264enc ! rtph264pay ! whipsink whi ```bash docker run --name live777-client-whep --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtph264depay ! decodebin ! videoconvert ! aasink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtph264depay ! decodebin ! videoconvert ! aasink ``` Use `libav` @@ -152,7 +152,7 @@ Use `libav` ```bash docker run --name live777-client-whep --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264 media=video,clock-rate=90000" ! rtph264depay ! avdec_h264 ! videoconvert ! aasink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264 media=video,clock-rate=90000" ! rtph264depay ! avdec_h264 ! videoconvert ! aasink ``` #### Audio: Opus @@ -162,19 +162,19 @@ gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps ```bash docker run --name live777-client --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 audiotestsrc ! audioconvert ! opusenc ! rtpopuspay ! whipsink whip-endpoint="http://localhost:3000/whip/777" +gst-launch-1.0 audiotestsrc ! audioconvert ! opusenc ! rtpopuspay ! whipsink whip-endpoint="http://localhost:7777/whip/777" ``` `WHEP`: ```bash -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! autoaudiosink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! autoaudiosink ``` Maybe you can't play audio, we can audio to video display for ascii ```bash -gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! wavescope ! videoconvert ! aasink +gst-launch-1.0 whepsrc whep-endpoint="http://localhost:7777/whep/777" audio-caps="application/x-rtp,payload=111,encoding-name=OPUS,media=audio,clock-rate=48000" video-caps="application/x-rtp,payload=102,encoding-name=H264,media=video,clock-rate=90000" ! rtpopusdepay ! opusdec ! audioconvert ! wavescope ! videoconvert ! aasink ``` #### Audio: G722 @@ -184,12 +184,12 @@ gst-launch-1.0 whepsrc whep-endpoint="http://localhost:3000/whep/777" audio-caps ```bash docker run --name live777-client --rm --network host \ ghcr.io/binbat/live777-client:latest \ -gst-launch-1.0 audiotestsrc ! audioconvert ! avenc_g722 ! rtpg722pay ! whipsink whip-endpoint="http://localhost:3000/whip/777 +gst-launch-1.0 audiotestsrc ! audioconvert ! avenc_g722 ! rtpg722pay ! whipsink whip-endpoint="http://localhost:7777/whip/777 ``` ### OBS Studio WHIP client -> Note: +> Note: > 1. OBS Studio version [**30 or higher**](https://obsproject.com/forum/threads/obs-studio-30-beta.168984/) > 2. OBS WHIP Current only support **H264** video codecs and **Opus** audio codecs @@ -197,7 +197,7 @@ gst-launch-1.0 audiotestsrc ! audioconvert ! avenc_g722 ! rtpg722pay ! whipsink #### Play stream -- open your browser, enter the URL: [`http://localhost:3000/`](http://localhost:3000/) +- open your browser, enter the URL: [`http://localhost:7777/`](http://localhost:7777/) ## Tools @@ -224,7 +224,7 @@ cargo build --package=whipinto --release ``` ```bash -whipinto -c vp8 -u http://localhost:3000/whip/777 --port 5003 +whipinto -c vp8 -u http://localhost:7777/whip/777 --port 5003 ``` Video Test Src @@ -236,7 +236,7 @@ ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -f rtp 'rtp:/ So. We support parameter `command`, You can use this: ```bash -cargo run --package=whipinto -- -c vp8 -u http://localhost:3000/whip/777 --command \ +cargo run --package=whipinto -- -c vp8 -u http://localhost:7777/whip/777 --command \ "ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -cpu-used 5 -deadline 1 -g 10 -error-resilient 1 -auto-alt-ref 1 -f rtp 'rtp://127.0.0.1:{port}?pkt_size=1200'" ``` @@ -261,7 +261,7 @@ cargo build --package=whepfrom --release Use WHEP protocol pull stream convert rtp sender ```bash -whepfrom -c vp8 -u http://localhost:3000/whep/777 -t localhost:5004 +whepfrom -c vp8 -u http://localhost:7777/whep/777 -t localhost:5004 ``` For ffplay. You Need a sdp file @@ -284,7 +284,7 @@ ffplay -protocol_whitelist rtp,file,udp -i stream.sdp So. You can use this ```bash -cargo run --package=whepfrom -- -c vp8 -u http://localhost:3000/whep/777 -t 127.0.0.1:5004 --command 'ffplay -protocol_whitelist rtp,file,udp -i stream.sdp' +cargo run --package=whepfrom -- -c vp8 -u http://localhost:7777/whep/777 -t 127.0.0.1:5004 --command 'ffplay -protocol_whitelist rtp,file,udp -i stream.sdp' ``` Use VLC player diff --git a/config-dist.toml b/config-dist.toml index 750dc7d9..2350c577 100644 --- a/config-dist.toml +++ b/config-dist.toml @@ -1,5 +1,5 @@ # Http Server Listen Address -# listen = "0.0.0.0:3000" +# listen = "[::]:7777" [[ice_servers]] urls = [ @@ -13,8 +13,11 @@ urls = [ # username = "live777" # credential = "live777" +# WHIP/WHEP auth token +# Headers["Authorization"] = "Bearer {token}" [auth] tokens = ["live777"] -[[auth.accounts]] -username = "live777" -password = "live777" + +# [[auth.accounts]] +# username = "live777" +# password = "live777" diff --git a/src/config.rs b/src/config.rs index 787c65d0..32a66dc8 100644 --- a/src/config.rs +++ b/src/config.rs @@ -29,8 +29,8 @@ pub struct Account { fn default_listen() -> String { format!( - "0.0.0.0:{}", - env::var("PORT").unwrap_or(String::from("3000")) + "[::]:{}", + env::var("PORT").unwrap_or(String::from("7777")) ) }