Skip to content

Publishing

Publishing means sending live video into a stream. Nyquist takes it over two protocols today:

  • RTMP is what almost every encoder speaks, OBS, FFmpeg, hardware encoders and phone apps included. It’s the easy choice on a good network.
  • SRT handles packet loss and jitter much better, so it’s the one to pick over the internet or a shaky uplink.

Either way, the stream has to exist first, or match a template. Nyquist turns away anything else, so nobody can publish to names you didn’t plan for.

Video comes in as H.264 with AAC audio for now. Anything else gets skipped, and the log tells you about it.

An RTMP address has two parts, the server and the stream key. For the stream live/demo on a server at 192.0.2.10:

Field Value
Server rtmp://192.0.2.10/live
Stream key demo?password=YOUR_PASSWORD

The stream name is split at its last slash. Everything before it goes in the server address as the RTMP app, and the rest goes in the key. Deeper names split the same way, so events/stage_a/backstage publishes to rtmp://192.0.2.10/events/stage_a with the key backstage.

Leave out ?password=... for a stream that doesn’t have a password. Nyquist listens for RTMP on port 1935, the default port for rtmp:// addresses, so you don’t have to write it. Moved it? Add the port, like rtmp://192.0.2.10:1936/live.

A stream without a slash, like demo, publishes through a special app called static: the server is rtmp://192.0.2.10/static and the key is demo?password=YOUR_PASSWORD. Don’t like static? Pick another app name with static_app.

  1. Open Settings, then Stream.
  2. Set Service to Custom.
  3. Paste the server into Server and the stream key into Stream Key.
  4. Hit Start Streaming.

FFmpeg takes the whole thing as one URL:

Terminal window
ffmpeg -re -i input.mp4 -c:v libx264 -g 60 -c:a aac \
-f flv "rtmp://192.0.2.10/live/demo?password=YOUR_PASSWORD"

Already have H.264 and AAC? Use -c copy instead of re-encoding.

SRT uses a single address plus a stream id that says which stream you want, that you’re publishing, and the password:

srt://192.0.2.10:5090
#!::r=live/demo,m=publish,s=YOUR_PASSWORD
  • r is the stream name, slashes and all.
  • m=publish says you’re sending video. Nyquist turns away callers that don’t say so.
  • s is the stream’s password. Leave it out for a stream without one.

Nyquist listens for SRT on port 5090, you can move it in [server].

Paste the whole thing as the Server, with the stream id as a streamid parameter, and leave Stream Key empty:

srt://192.0.2.10:5090?streamid=#!::r=live/demo,m=publish,s=YOUR_PASSWORD

SRT carries MPEG-TS, so use -f mpegts:

Terminal window
ffmpeg -re -i input.mp4 -c:v libx264 -g 60 -c:a aac \
-f mpegts "srt://192.0.2.10:5090?streamid=#!::r=live/demo,m=publish,s=YOUR_PASSWORD"

SRT holds packets back for a little while so it can ask for lost ones again. That’s latency in [srt]. More of it rides out rougher networks, less of it gets the video to viewers sooner.

Each stream can have its own password, and a template can have one for every stream under its prefix. A stream you created wins over a template, so its own password is the one that counts. A stream that follows a template and has no password of its own takes the template’s password. A stream without any password takes any encoder, and the panel warns you about it.

When the password is wrong or missing, Nyquist turns the encoder away and logs why. Changing a stream’s password sends its current publisher away too, so old encoders can’t hang on with the old one.

A stream takes one publisher at a time. While somebody is publishing, anybody else trying the same stream gets turned away until the first one stops. Need to kick the current publisher? Hit the button on the stream page, or call the API:

Terminal window
curl -u admin:YOUR_PASSWORD -X DELETE http://192.0.2.10:8080/api/v1/publishers/live/demo

When an encoder disconnects or stops sending, the stream stays live for a moment, timeout in [sources], 5 seconds by default. An encoder that reconnects in that time just carries on, and viewers keep watching. Give the stream a backup in its inputs, like a second encoder’s stream as a copy:// or the built-in fake:// test card, and the backup takes over instead. Sources has the details.

The log says exactly why Nyquist turned an encoder away. Look for these:

Log message What to check
rejected a publish to an unknown stream The stream doesn’t exist and no template covers it. Check the name, slashes included.
rejected a publish with a wrong password The password in the key or the stream id doesn’t match.
rejected a publish, the stream is busy Somebody else is already publishing to it.
rejected a publish with a bad stream name The name breaks the naming rules.
rejected an SRT caller that didn’t ask to publish The stream id is missing m=publish.