Skip to content

moq-dev/moq

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

1,524 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Media over QUIC

License Discord Crates.io npm

Media over QUIC

Media over QUIC (MoQ) is a next-generation live media protocol that provides real-time latency at massive scale. Built using modern web technologies, MoQ delivers WebRTC-like latency without the constraints of WebRTC. The core networking is delegated to a QUIC library but the rest is in application-space, giving you full control over your media pipeline.

Key Features:

  • πŸš€ Real-time latency using QUIC for prioritization and partial reliability.
  • πŸ“ˆ Massive scale designed for fan-out and supports cross-region clustering.
  • 🌐 Modern Web using WebTransport, WebCodecs, and WebAudio.
  • 🎯 Multi-language with both Rust (native) and TypeScript (web) libraries.
  • πŸ”§ Generic for any live data, not just media. Includes text chat as both an example and a core feature.

Note: This project implements moq-lite, a forwards-compatible subset of the IETF moq-transport draft. moq-lite works with any moq-transport CDN (ex. Cloudflare). The focus is narrower, prioritizing simplicity and deployability.

Getting Started

Full documentation lives at doc.moq.dev.

  • Run the demo - try MoQ locally with a relay, demo media, and the web UI.
  • Linux packages - install the relay and GStreamer plugin from apt.moq.dev / rpm.moq.dev.
  • Production setup - deploy a relay with a real domain and TLS.

The quickest way to see it in action (requires Nix with flakes):

# Runs a relay, demo media, and the web server
nix develop -c just

Then visit https://localhost:8080. Don't have Nix? See the demo guide for manual setup.

Architecture

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-net 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.
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Libraries

This repository provides both Rust and TypeScript libraries with similar APIs but language-specific optimizations.

Rust

Crate Description Docs
moq-net The networking layer: real-time pub/sub with built-in caching, fan-out, and prioritization. Negotiates either the moq-lite or moq-transport wire protocol. docs.rs
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. docs.rs
libmoq C bindings for moq-net. docs.rs
hang Media-specific encoding/streaming layered on top of moq-net. Can be used as a library. docs.rs
moq-cli A CLI for publishing media to MoQ relays.
moq-mux Media muxers and demuxers (fMP4/CMAF, HLS) for importing content into MoQ broadcasts. docs.rs
moq-gst A GStreamer plugin for publishing or consuming MoQ broadcasts. Not built by default; requires GStreamer dev libraries.

TypeScript

Package Description NPM
@moq/net The networking layer: real-time pub/sub with built-in caching, fan-out, and prioritization. Negotiates either the moq-lite or moq-transport wire protocol. Intended for browsers, runs server-side with a WebTransport polyfill. npm
@moq/token Authentication library & CLI for JS/TS environments (see Authentication) npm
@moq/hang Core media library: catalog, container, and support. Shared by @moq/watch and @moq/publish. npm
@moq/demo Examples using @moq/hang.
@moq/watch Subscribe to and render MoQ broadcasts (Web Component + JS API). npm
@moq/publish Publish media to MoQ broadcasts (Web Component + JS API). npm
@moq/ui-core Shared UI components (Button, Icon, Stats, CSS theme) used by @moq/watch/ui and @moq/publish/ui. npm

Protocol

Read the specifications:

Development

# See all available commands
just

# Build everything
just build

# Run tests and linting
just check

# Automatically fix some linting errors
just fix

See the development guide and the justfile for more.

License

Licensed under either:

About

Media over QUIC: Real-time latency at massive scale

Topics

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Contributors