Skip to content

WhipSynth

whipsynth 是一个合成 WHIP 发布器。它通过 rsmpeg crate 调用 FFmpeg 在本地生成音视频测试图案,并发布到 WHIP 端点,无需外部媒体源。

使用场景

  • 快速验证 WHIP 端点是否能正常接收并转发流。
  • 对 Live777 实例进行并发发布负载测试。
  • 在不连接真实摄像头或 FFmpeg 流水线的情况下复现特定编解码器问题。

构建

bash
# 构建 whipsynth 二进制文件(需要 FFmpeg 开发库)
cargo build --bin whipsynth --features rsmpeg

用法

发布一路 640x480 的纯 VP8 视频流到 WHIP 端点:

bash
whipsynth -w http://localhost:7777/whip/live

发布 VP8 视频 + Opus 音频:

bash
whipsynth -w http://localhost:7777/whip/live --acodec opus

使用认证 token 发布 H.264,并运行 60 秒后退出:

bash
whipsynth -w http://localhost:7777/whip/live \
          -t my-token \
          --vcodec h264 \
          --duration 60

选项

选项默认值说明
-w, --whip必填WHIP 端点 URL
-t, --tokenWHIP 认证使用的 Bearer token
--vcodecvp8视频编码:vp8vp9h264h265av1
--acodec音频编码:opusg722(省略表示不发送音频)
--width640视频宽度(像素)
--height480视频高度(像素)
--fps30视频帧率
--duration运行指定秒数后退出

负载测试模式

whipsynth 可以同时启动多个并发发布者。以下选项默认在帮助信息中隐藏,主要用于测试:

bash
whipsynth -w http://localhost:7777/whip/live --count 10 --spawn-interval-ms 200

每个会话会使用独立的 URL:负载测试会自动在 URL 最后一段路径上追加索引。 例如 --count 3 且基础 URL 为 /whip/live 时,三个会话分别发布到 /whip/live-0/whip/live-1/whip/live-2

选项默认值说明
--count1并发 WHIP 会话数
--spawn-interval-ms100每个会话启动之间的间隔(毫秒)

退出码

  • 0:发布正常结束(到达 duration 或被中断)。
  • 1:发生错误,例如 WHIP 端点拒绝请求或 PeerConnection 失败。

Released under the MPL-2.0 License.