Rust library for Media over QUIC
Go to file
Luke Curley 5e4eb420c0 Bump webtransport-proto to fix Chrome 117 2023-09-27 07:03:14 +09:00
.github I think this token be missing. 2023-09-18 23:07:34 -07:00
.vscode Add vscode recommendations. 2023-07-10 10:08:00 -07:00
dev Revert "Bump golang.org/x/text from 0.3.7 to 0.3.8 in /dev (#70)" 2023-09-19 10:11:33 -07:00
moq-pub Implement prioritization in moq-pub (#74) 2023-09-19 10:01:26 -07:00
moq-relay Revert "Enable tracing to debug. (#80)" 2023-09-19 14:49:02 -07:00
moq-transport Bump webtransport-proto to fix Chrome 117 2023-09-27 07:03:14 +09:00
.dockerignore Major moq-transport API simplification (#68) 2023-09-15 12:06:28 -07:00
.editorconfig Tabs not spaces u nerds. (#18) 2023-05-23 12:04:27 -07:00
.gitignore Split the web player into it's own repo. 2023-05-24 13:29:18 -07:00
.rustfmt.toml Serve the certificate fingerprint over HTTP (#20) 2023-05-24 17:20:44 -07:00
Cargo.lock Bump webtransport-proto to fix Chrome 117 2023-09-27 07:03:14 +09:00
Cargo.toml Major moq-transport API simplification (#68) 2023-09-15 12:06:28 -07:00
Dockerfile Why bother test. 2023-09-17 00:22:57 -07:00
LICENSE-APACHE Dual license (#40) 2023-07-05 14:55:40 -07:00
LICENSE-MIT Dual license (#40) 2023-07-05 14:55:40 -07:00
README.md Update README.md 2023-09-17 22:43:22 -07:00
fly-relay.sh Update fly.io deployment (#71) 2023-09-15 16:10:13 -04:00
fly.toml Update fly.io deployment (#71) 2023-09-15 16:10:13 -04:00

README.md

Media over QUIC

Media over QUIC (MoQ) is a live media delivery protocol utilizing QUIC streams. See quic.video for more information.

This repository contains a few crates:

  • moq-relay: A relay server, accepting content from publishers and fanning it out to subscribers.
  • moq-pub: A publish client, accepting media from stdin (ex. via ffmpeg) and sending it to a remote server.
  • moq-transport: An async implementation of the underlying MoQ protocol.

There's currently no way to actually view content with moq-rs; you'll need to use moq-js for that.

Setup

Certificates

Unfortunately, QUIC mandates TLS and makes local development difficult. If you have a valid certificate you can use it instead of self-signing.

Use mkcert to generate a self-signed certificate. Unfortunately, this currently requires Go in order to fork the tool.

./dev/cert

Unfortunately, WebTransport in Chrome currently (May 2023) doesn't verify certificates using the root CA. The workaround is to use the serverFingerprints options, which requires the certificate MUST be only valid for at most 14 days. This is also why we're using a fork of mkcert, because it generates certificates valid for years by default. This limitation will be removed once Chrome uses the system CA for WebTransport.

Media

If you're using moq-pub then you'll want some test footage to broadcast.

mkdir media
wget http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4 -O dev/source.mp4

Usage

moq-relay

moq-relay is a server that forwards subscriptions from publishers to subscribers, caching and deduplicating along the way. It's designed to be run in a datacenter, relaying media across multiple hops to deduplicate and improve QoS.

You can run the development server with the following command, automatically using the self-signed certificate generated earlier:

./dev/relay

Notable arguments:

  • --bind <ADDR> Listen on this address [default: [::]:4443]
  • --cert <CERT> Use the certificate file at this path
  • --key <KEY> Use the private key at this path

This listens for WebTransport connections on UDP https://localhost:4443 by default. You need a client to connect to that address, to both publish and consume media.

The server also listens on TCP localhost:4443 when in development mode. This is exclusively to serve a /fingerprint endpoint via HTTPS for self-signed certificates, which are not needed in production.

moq-pub

This is a client that publishes a fMP4 stream from stdin over MoQ. This can be combined with ffmpeg (and other tools) to produce a live stream.

The following command runs a development instance, broadcasing dev/source.mp4 to localhost:4443:

./dev/pub

Notable arguments:

  • <URI> connect to the given address, which must start with moq://.

moq-js

There's currently no way to consume broadcasts with moq-rs, at least until somebody writes moq-sub. Until then, you can use moq.js both watch broadcasts and publish broadcasts.

There's a hosted version available at quic.video. There's a secret ?server parameter that can be used to connect to a different address.

  • Publish to localhost: https://quic.video/publish/?server=localhost:4443
  • Watch from localhost: https://quic.video/watch/<name>/?server=localhost:4443

Note that self-signed certificates are ONLY supported if the server name starts with localhost. You'll need to add an entry to /etc/hosts if you want to use a self-signed certs and an IP address.

License

Licensed under either: