2023-09-15 19:06:28 +00:00
|
|
|
<p align="center">
|
2023-09-18 05:43:22 +00:00
|
|
|
<img height="128px" src="https://github.com/kixelated/moq-rs/blob/main/.github/logo.svg" alt="Media over QUIC">
|
2023-09-15 19:06:28 +00:00
|
|
|
</p>
|
|
|
|
|
2023-05-24 20:29:18 +00:00
|
|
|
Media over QUIC (MoQ) is a live media delivery protocol utilizing QUIC streams.
|
2023-09-18 05:43:05 +00:00
|
|
|
See [quic.video](https://quic.video) for more information.
|
2023-08-25 23:36:06 +00:00
|
|
|
|
2023-09-18 05:43:05 +00:00
|
|
|
This repository contains a few crates:
|
2023-08-25 23:36:06 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
- **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.
|
|
|
|
- **moq-api**: A HTTP API server that stores the origin for each broadcast, backed by redis.
|
2022-06-29 16:17:02 +00:00
|
|
|
|
2023-10-12 04:13:45 +00:00
|
|
|
There's currently no way to view media with this repo; you'll need to use [moq-js](https://github.com/kixelated/moq-js) for that.
|
2022-06-30 20:23:33 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
## Development
|
2023-05-24 20:29:18 +00:00
|
|
|
|
2023-10-12 04:13:45 +00:00
|
|
|
Use the [dev helper scripts](dev/README.md) for local development.
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-05-25 00:20:44 +00:00
|
|
|
## Usage
|
2022-06-29 16:17:02 +00:00
|
|
|
|
2023-09-15 19:06:28 +00:00
|
|
|
### 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.
|
2023-10-12 04:13:45 +00:00
|
|
|
The relays register themselves via the [moq-api](moq-api) endpoints, which is used to discover other relays and share broadcasts.
|
2023-09-15 19:06:28 +00:00
|
|
|
|
|
|
|
Notable arguments:
|
|
|
|
|
2023-10-12 04:13:45 +00:00
|
|
|
- `--listen <ADDR>` Listen on this address, default: `[::]:4443`
|
2023-10-17 05:50:17 +00:00
|
|
|
- `--tls-cert <CERT>` Use the certificate file at this path
|
|
|
|
- `--tls-key <KEY>` Use the private key at this path
|
2023-10-16 05:31:12 +00:00
|
|
|
- `--dev` Listen via HTTPS as well, serving the `/fingerprint` of the self-signed certificate. (dev only)
|
2023-09-15 19:06:28 +00:00
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
### 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.
|
|
|
|
|
|
|
|
Notable arguments:
|
|
|
|
|
2023-10-12 04:13:45 +00:00
|
|
|
- `<URL>` connect to the given address, which must start with `https://` for WebTransport.
|
2023-10-12 04:09:32 +00:00
|
|
|
|
2023-10-12 04:14:56 +00:00
|
|
|
**NOTE**: We're very particular about the fMP4 ingested. See [this script](dev/pub) for the required ffmpeg flags.
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
### moq-transport
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-10-12 04:13:45 +00:00
|
|
|
A media-agnostic library used by [moq-relay](moq-relay) and [moq-pub](moq-pub) to serve the underlying subscriptions.
|
2023-10-12 04:09:32 +00:00
|
|
|
It has caching/deduplication built-in, so your application is oblivious to the number of connections under the hood.
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
See the published [crate](https://crates.io/crates/moq-transport) and [documentation](https://docs.rs/moq-transport/latest/moq_transport/).
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
### moq-api
|
2023-09-15 19:06:28 +00:00
|
|
|
|
2023-10-12 04:09:32 +00:00
|
|
|
This is a API server that exposes a REST API.
|
|
|
|
It's used by relays to inserts themselves as origins when publishing, and to find the origin when subscribing.
|
2023-10-12 04:13:45 +00:00
|
|
|
It's basically just a thin wrapper around redis that is only needed to run multiple relays in a (simple) cluster.
|
2023-07-05 21:55:40 +00:00
|
|
|
|
|
|
|
## License
|
|
|
|
|
2023-07-22 04:03:09 +00:00
|
|
|
Licensed under either:
|
2023-07-05 21:55:40 +00:00
|
|
|
|
2023-07-22 04:03:09 +00:00
|
|
|
- Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
|
|
- MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT)
|