Media over QUIC (MoQ) is a next-generation live media delivery protocol that provides real-time latency at massive scale. Built on modern web technologies like WebTransport and WebCodecs, MoQ delivers WebRTC-like latency with CDN-like distribution.
Key Features:
- π Real-time latency via QUIC stream priotization and partial reliability.
- π Massive scale via edge caching, fanout, and multi-region clustering.
- π Browser support via WebTransport and WebCodecs.
- π§ Generic transport for any live data, not just media
- π― Simple API with both Rust and TypeScript implementations
Note: This project is a fork of the IETF MoQ specification. The focus is narrower, focusing on simplicity and deployability.
This repository is split into multiple binaries and libraries across different languages. It can get overwhelming, so there's an included demo with some examples.
Note: this demo uses an insecure HTTP fetch intended for local development only. In production, you'll need a proper domain and a matching TLS certificate via LetsEncrypt or similar.
Requirements:
# Runs a relay, demo media, and the web server
nix shell -c just all
Then visit https://localhost:8080 to see the demo. Note that this uses an insecure HTTP fetch for local development only; in production you'll need a proper domain + TLS certificate.
TIP: If you've installed nix-direnv, then only just all
is required.
If you don't like Nix, or just want things install globally, then you can install dependencies manually.
Requirements:
Run it:
# Install some more dependencies
just setup
# Runs a relay, demo media, and the web server
just all
Then visit https://localhost:8080 to see the demo.
MoQ is designed as a layered protocol stack.
Rule 1: The CDN MUST NOT know anything about your application, media codecs, or even the available tracks. Everything could be fully E2EE and the CDN wouldn't care. No business logic allowed.
Instead, moq-relay
operates on rules encoded in the moq-lite
header.
These rules are based on video encoding but are generic enough to be used for any live data.
The goal is to keep the server as dumb as possible while supporting a wide range of use-cases.
The media logic is split into another protocol called hang
.
It's pretty simple and only intended to be used by clients or media servers.
If you want to do something more custom, then you can always extend it or replace it entirely.
Think of hang
as like HLS/DASH, while moq-lite
is like HTTP.
βββββββββββββββββββ
β Application β π’ Your business logic
β β - authentication, non-media tracks, etc.
βββββββββββββββββββ€
β hang β π¬ Media-specific encoding/streaming
β β - codecs, containers, catalog
βββββββββββββββββββ
β moq-lite β π Generic pub/sub transport
β β - broadcasts, tracks, groups, frames
βββββββββββββββββββ€
β WebTransport β π Browser-compatible QUIC
β QUIC β - HTTP/3 handshake, multiplexing, etc.
βββββββββββββββββββ
This repository provides both Rust and TypeScript libraries with similar APIs but language-specific optimizations.
Crate | Description | Docs |
---|---|---|
moq-lite | The core pub/sub transport protocol. Has built-in concurrency and deduplication. | |
moq-relay | A clusterable relay server. This relay performs fan-out connecting multiple clients and servers together. | |
moq-token | An authentication scheme supported by moq-relay . Can be used as a library or as a CLI to authenticate sessions. |
|
moq-native | Opinionated helpers to configure a Quinn QUIC endpoint. It's harder than it should be. | |
hang | Media-specific encoding/streaming layered on top of moq-lite . Can be used as a library or a CLI. |
|
hang-gst | A simple gstreamer plugin for publishing or consuming hang broadcasts. | |
hang-wasm | A deprecated web player using WASM. Use the Typescript implementation instead. |
Package | Description | NPM |
---|---|---|
@kixelated/moq | The core pub/sub transport protocol. Has built-in concurrency and deduplication. | |
@kixelated/hang | Media-specific encoding/streaming layered on top of moq-lite . Provides both a Javascript API and Web Components. |
|
@kixelated/hang-demo | Examples using @kixelated/hang . |
Read the specifications:
# See all available commands
just
# Build everything
just build
# Run tests and linting
just check
# Automatically fix some linting errors
just fix
# Run the demo manually
just relay # Terminal 1: Start relay server
just pub tos # Terminal 2: Publish a demo video using ffmpeg
just web # Terminal 3: Start web server
There are more commands: check out the Justfile, rs/Justfile, and js/Justfile.
Licensed under either:
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)