8000 GitHub - mwkirk/betamax: Record a WebRTC (WHEP) stream to fMP4, HLS, or RTMP. Source-available, in Go on pion. · GitHub
[go: up one dir, main page]

Skip to content
mwkirkPublic

About

Record a WebRTC (WHEP) stream to fMP4, HLS, or RTMP. Source-available, in Go on pion.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

betamax

Record a live WebRTC stream — subscribed over WHEP — to fragmented MP4 or HLS, restream it over RTMP/RTMPS, and optionally mirror to S3-compatible storage. Run as a one-shot CLI (betamax record) or a small HTTP service (betamax serve). Written in Go on pion.

WHEP source → ingest → conform to H.264/AAC → A/V sync → mux → fMP4 · HLS · RTMP/RTMPS   (+ optional S3 mirror)

Status: v0.1.0 — early release. The code is tested end-to-end (soak + real-world), but the public interface (CLI flags, serve API, config keys, webhook payloads) may still change before v1.0. Pin a tagged version if you integrate.

Features

  • WHEP ingest — subscribe to any WebRTC source (VP8 / VP9 / H.264 video + Opus audio).
  • Outputs — fragmented MP4, HLS (CMAF), RTMP/RTMPS, and/or an S3 mirror — always conformed to H.264/AAC (H.264 that already fits is passed through without re-encoding).
  • Accurate A/V sync — common wall-clock timeline from RTCP sender reports cross-checked against packet-arrival timing, with clock-drift correction for long recordings.
  • Server mode — start recordings over an HTTP API with admission control, bearer auth, live /status, Prometheus /metrics, and signed webhooks.

Quick start

Build from source (Go 1.25+), or use the container:

make build      # → ./bin/betamax
make docker     # → betamax:latest  (bundles ffmpeg)

betamax execs ffmpeg at runtime (transcode/conform), so it must be on PATH when you run the binary. The Docker image already includes it.

Record or restream a WHEP source — the output type follows --out:

# restream to an RTMPS ingest (e.g. a live CDN)
betamax record --whep-url <WHEP-URL> --out rtmps://host:443/live/<STREAM-KEY>

# record to a fragmented MP4 file
betamax record --whep-url <WHEP-URL> --out ./recording.mp4

# record to HLS (CMAF) — playlist + segments written into ./hls/
betamax record --whep-url <WHEP-URL> --out ./hls/stream.m3u8

Add an s3://bucket/… output to mirror to object storage, or run betamax serve to drive recordings over HTTP. No WHEP source handy? deploy/mediamtx/ runs one locally, no account needed.

Documentation

Full documentation lives in docs/:

  • Recording — betamax record CLI, outputs, S3 mirroring, buffering
  • Server mode — betamax serve HTTP API, auth, admission, observability, webhooks
  • Configuration — CLI flags, TOML config, per-request JSON
  • Deployment examples — Docker image, docker compose, MediaMTX, Cloudflare

Contributing

Issues and questions are welcome, but code contributions aren't accepted at this time. This repository is a read-only mirror of development that happens privately, so pull requests can't be merged. See CONTRIBUTING.md.

License

betamax is source-available, not open source — free for noncommercial use, licensed for commercial use, with AI-training rights reserved. See LICENSING.md for the overview, or LICENSE.md, LICENSE-COMMERCIAL.md, and AI-TRAINING-ADDENDUM.md.

About

Record a WebRTC (WHEP) stream to fMP4, HLS, or RTMP. Source-available, in Go on pion.

Topics

Resources

Contributing

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0