Streams
A stream is a named channel. One source at a time feeds it video, most of the time an encoder publishing to it, and any number of viewers watch it. Everything else in Nyquist, publishing, playback, viewer counts and charts, hangs off the stream’s name.
Stream names use letters, numbers and _, - and ., with / between parts. Some good ones:
demolive/demonews/channel_onesports/mainevents/stage_a
The slash is how you group streams. news/channel_one and news/channel_two both live in the news group, the panel lists them together and a template can cover the whole group with one rule. You can go as deep as you like, events/stage_a/backstage works too.
A few things a name can’t do:
- Start or end with a slash, or have two slashes in a row.
- Have a part that’s just
.or... - Be
adminorapi, or start withadmin/orapi/. The panel and the API live there. - Be longer than
max_stream_lengthallows, slashes included.
Names show up in every URL, so keep them short and readable. Spaces and accents aren’t allowed, they make URLs messy.
Create a stream
Section titled “Create a stream”Pick whatever suits you, they all end up in the same place, the [[stream]] entries of nyquist.toml.
- The panel: hit New stream, give it a name and save.
- The config file: add an entry and reload.
- The API:
PUT /api/v1/streams/NAME, see The API.
Here’s a stream with everything filled in:
[[stream]]name = "news/channel_one"title = "Channel One"description = "The main news channel, on air around the clock."password = "pick-something-long-and-random"Only name is required. New streams apply right away, no restart needed.
Here’s everything a [[stream]] entry takes:
| Setting | What it does |
|---|---|
name |
The stream’s name, see Names. The only one you need. |
title |
A friendly name the panel shows next to the name. |
description |
A longer note for you and your team. |
template |
A template the stream follows. It has to exist, and the stream takes its password when it has none of its own. |
inputs |
Where the video comes from, in order: the main source first, then the backups. Leave it out for ["publish://"], an encoder publishing to the stream. See Where the video comes from. |
password |
The password encoders need to publish, see Passwords. |
Titles and descriptions
Section titled “Titles and descriptions”title is a friendly name the panel shows next to the stream name, like Channel One. description is a longer note for you and your team, like who runs the encoder or what’s on air. Neither one changes how the stream works, they’re there to keep things tidy once you have a lot of streams.
Passwords
Section titled “Passwords”A stream password keeps strangers from publishing to your stream. It’s optional, but without one anybody who knows the name and your server’s address can publish to it, so set one for anything that isn’t a quick test. The panel warns you about streams like that.
A stream that follows a template and has no password of its own takes the template’s password instead. Only a stream with no password at all, and no template password either, takes any encoder.
- Encoders send the password along when they connect, Publishing shows how for RTMP and SRT.
- Changing a stream’s password sends its current publisher away, so it has to come back with the new one. The same goes for the password of the template it follows.
- Stream passwords are stored as plain text in
nyquist.toml, since your encoders need the real thing. Only admins can see them in the panel and the API.
The panel makes up a long random password for you when you create a stream. The length comes from generated_password_length.
Where the video comes from
Section titled “Where the video comes from”inputs lists where a stream gets its video, in order. The first one is the main source and the rest are backups. Leave it out and you get the most common setup, an encoder publishing to the stream:
[[stream]]name = "live/demo"inputs = ["publish://"]Add backups after it and Nyquist switches to the next one that works when the main source stops sending, then goes back once the main source is steady again. Viewers keep watching through the switch:
[[stream]]name = "sports/main"inputs = [ "publish://", "hlss://cdn.example/sports/index.m3u8", "fake://",]Every input has to be different, and publish:// can show up once. Sources explains how the switching works and the settings that tune it.
Copies
Section titled “Copies”A stream can mirror another one with copy:// and the other stream’s name. It shares the exact same frames (zero copy, promise!), but gets its own name, outputs and access rules. In the panel, pick Copy another stream when you create it.
[[stream]]name = "partners/channel_one"inputs = ["copy://news/channel_one"]A copy can have backups like any other stream, ["copy://news/channel_one", "copy://news/channel_two"] copies news/channel_one and falls back to news/channel_two. Streams can’t copy themselves or go around in a circle, Nyquist tells you if you try.
Other sources
Section titled “Other sources”Streams can also pull their video from somewhere else, or make some up:
| Input | Where the video comes from |
|---|---|
rtmp://HOST[:PORT]/APP/NAME |
Another RTMP server. |
srt://HOST:PORT |
An SRT listener, with optional streamid, passphrase and latency. |
hls://HOST/PATH or hlss:// |
A live HLS playlist over HTTP or HTTPS. |
tshttp://HOST/PATH or tshttps:// |
An endless MPEG-TS stream over HTTP or HTTPS. |
udp://[SOURCE@]ADDRESS:PORT |
MPEG-TS over UDP, multicast or unicast. |
fake:// |
A built-in test card with a tone. |
Inputs Nyquist can’t use get refused with the exact line and column, before anything gets saved. Sources has every option and example.
Templates
Section titled “Templates”You don’t have to create every stream by hand. A template lets every stream under a prefix, like events/, publish with the template’s password. Those streams show up in the panel and the API while they’re live.
A stream you created can follow a template too. Set its template to the name of a template that exists, and without a password of its own the stream takes the template’s password:
[[stream]]name = "events/stage_a"title = "Stage A"template = "events"Rename or remove a stream
Section titled “Rename or remove a stream”You can change anything about a stream from its Settings tab in the panel, its name included. Removing it sits safely at the bottom of the same tab. Removing a stream takes it out of nyquist.toml and sends its publisher away. Its viewers and history go with it.
Renaming a stream moves its entry in nyquist.toml and keeps everything else about it. Streams that copy it follow along, their copy:// inputs get the new name. Whatever feeds the stream gets disconnected and comes back under the new name: pulls reconnect on their own, while encoders need the new stream key. A name that’s already taken, by another stream or by one that’s live through a template, gets turned down.
Over the API, PATCH /api/v1/streams/NAME changes only the settings you send, takes out the ones you send as null and renames the stream when you send a new name. DELETE /api/v1/streams/NAME removes it. The API has examples.