Skip to content

开发者 ​

依赖:

可选依赖:

二进制包和源码对应关系 ​

BinaryPackageComment
live777liveion核心服务 SFU Server
livemanlivemanLive777 集群控制器
whipintolivetwortp, rtsp to whip
whepfromlivetwowhep ro rtp, rtsp
livenillivenil集群启动器,主要用在开发和测试环境

Release build ​

bash
# Build Web UI
pnpm install
pnpm -r build

# Live777 Core (SFU Server)
cargo build --release

# Live777 Manager
cargo build --release --bin=liveman

# whipinto / whepfrom
cargo build --release --bin=whipinto
cargo build --release --bin=whepfrom

特性标记 ​

Live777 支持以下 Cargo feature 来定制构建:

特性所属包说明
webuiliveion启用 Web UI(嵌入前端资源)
cascadeliveion启用服务间级联推拉流
recorderliveion启用录制功能(H264/H265)
sourceliveion启用源拉取(RTSP, WHEP, SDP)
source-sdpliveion通过 SDP 拉取源
source-rtspliveion通过 RTSP 拉取源
source-whepliveion通过 WHEP 拉取源(静态 cascade-pull)
target-whipliveion通过 WHIP 推送目标(静态 cascade-push)
target-rtpliveion以纯 RTP/UDP 发送目标(组播发送端)
target-rtspliveion通过 RTSP 推送目标(ANNOUNCE/RECORD 客户端)
net4mqttliveion启用 MQTT 隧道代理

构建时启用特性:

bash
cargo build --release --features "cascade,recorder"

默认构建不包含任何可选特性。使用 --all-features 启用全部:

bash
cargo build --release --all-features

如果你需要配置,使用配置文件

bash
cp conf/live777.toml live777.toml
cp conf/liveman.toml liveman.toml

自定义日志 ​

可以使用 RUST_LOG 环境变量来设置日志分模块输出

比如 live777, 目前模块日志输出为:

bash
RUST_LOG=live777=<cfg.log.level>,net4mqtt=<cfg.log.level>,http_log=<cfg.log.level>,webrtc=error",

我们可以用这个变量覆盖默认的日志输出方案

bash
RUST_LOG=live777=error,net4mqtt=debug,webrtc=error",

以开发模式运行 ​

WebUI ​

bash
pnpm install

# live777 debugger
pnpm --filter debugger dev

# live777 webui
pnpm --filter liveion dev

# liveman webui
pnpm --filter liveman dev

Live777 ​

bash
cargo run -- -c conf/live777.toml

LiveMan ​

bash
cargo run --bin=liveman -- -c conf/liveman.toml

LiveNil ​

如果你想开发或测试集群的一些功能,很明显手动依次启动不是一个明智的选择

可以使用这个工具批量启动一个 liveman 和 N 个 live777 实例

bash
cargo run --bin=livenil -- -c conf/livenil

边缘-云端级联演示 ​

conf/livenil/edge-cloud/ 是一个预制拓扑:两个边缘节点模拟摄像头 (各预置一路流,通过 liveman 的 [[node_rules]] glob 规则—— pattern = "edge*"、sub_max = 1——限制只允许一个直连观众), 一个云端节点作为中心 SFU,全部由一个 liveman 管理:

bash
just run-edge-cloud

摄像头推流时钉到各自的边缘节点,观众都连接 liveman (http://127.0.0.1:8890/whep/cam0)。每路流的第一个观众会被直接代理到 边缘节点;第二个观众到来时边缘已满,liveman 会把流级联到云端节点 (pull 模式:云端主动向边缘 WHEP 拉流),并踢掉边缘上的直连观众 (close_other_sub = true),其播放器重连后落到云端。边缘始终只向外 发送一路流,节省边缘上行带宽。完整流程见 conf/livenil/edge-cloud/ 里的注释。

whipinto && whepfrom ​

bash
cargo run --bin=whipinto
cargo run --bin=whepfrom

因此,我们支持参数 command, 你可以这样使用:

bash
cargo run --bin=whipinto -- -i input.sdp -w http://localhost:7777/whip/777 --command \
"ffmpeg -re -f lavfi -i testsrc=size=640x480:rate=30 -vcodec libvpx -f rtp 'rtp://127.0.0.1:5002' -sdp_file input.sdp"
bash
cargo run --bin=whepfrom -- -o output.sdp -w http://localhost:7777/whep/777 --command \
'ffplay -protocol_whitelist rtp,file,udp -i output.sdp'

浏览器 WebRTC 调试工具 ​

大部份浏览器内置了 WebRTC 调试工具

FirefoxChromeEdge
about:webrtcchrome://webrtc-internals/edge://webrtc-internals/
chrome://webrtc-logs/edge://webrtc-logs/

Released under the MPL-2.0 License.