Hubfly spaceDocs
Console

OBS and encoders

Every input shows its URLs under Inputs → Connection, or with hubfly stream inputs get <server> <input>. The examples below use the server acme-tv.live.hubfly.app, the input sin_cam1abcd and a stream key written as hfls_cam1abcd_…. A key works on every host of its own server, including your custom domains, and nowhere else.

Recommended settings

UseVideoAudioKeyframes
Restream 1080p30H.264 High, 6,000 kbps CBRAAC 160 kbps, 48 kHzEvery 2 s
Low latency (WebRTC playback)H.264, B-frames 0, 4,500 kbpsAAC or OpusEvery 1–2 s
Radio—MP3 or AAC 128 kbps, or Opus 96 kbps—
  • Codecs. H.264, H.265 (HEVC) and AV1 video; VP8 and VP9 over WHIP only. AAC, Opus or MP3 audio, at most two channels.
  • Size. Up to 4096×2160 and 60 fps. The keyframe interval must be 10 seconds or less; 2 seconds is best for quick starts and clean switches.
  • Bitrate. Each input has a maximum, 20 Mbps unless you change it, up to 80 Mbps and never above the server's speed. Short bursts of 20% are fine. Above that the server slows down reading so your encoder's dynamic bitrate can react, and disconnects it after 30 seconds of sustained excess (bitrate_exceeded).

B-frames and WebRTC

B-frames are accepted, but browsers cannot play them over WebRTC. With B-frames on, WebRTC viewers get the first rendition of the channel's ladder (billed as processing), or the player falls back to LL-HLS when there is no ladder. The input's health shows B-frames: yes while this applies.

OBS Studio

RTMPS (recommended)

  1. Settings → Stream: Service Custom…, Server rtmps://acme-tv.live.hubfly.app:443/live, Stream Key hfls_cam1abcd_….
  2. Settings → Output, Output Mode Advanced, Streaming tab:
    • Rate control CBR, bitrate 4,500–6,000 kbps, keyframe interval 2 s.
    • For WebRTC playback, turn B-frames off: with x264, enter bframes=0 in x264 Options; with NVENC, QuickSync or AMF, set B-Frames (or Max B-frames) to 0.
  3. Settings → Audio: 48 kHz; Output → Audio bitrate 160.
  4. Choose Start Streaming.

Plain RTMP (rtmp://acme-tv.live.hubfly.app/live, TCP 1935) works too, but sends the key unencrypted. Use it only when an encoder cannot do RTMPS.

WHIP (OBS 30 and later)

WHIP sends WebRTC from OBS for the lowest delay. In Settings → Stream, choose Service WHIP, set the Server to the input's WHIP URL, and paste the stream key as the Bearer Token. The input must have WHIP among its protocols.

text
https://acme-tv.live.hubfly.app/whip/sin_cam1abcd

vMix and other RTMP encoders

In vMix, open Stream → Settings, choose Custom RTMP Server, enter rtmps://acme-tv.live.hubfly.app:443/live as the URL and the stream key as the Stream Name or Key. Any encoder that streams to YouTube or Twitch works the same way: the application is always live, and the key goes in the stream key field. Enhanced RTMP (HEVC, AV1 and Opus over RTMP) is accepted. Encoders that take a single URL can use the full form:

text
rtmps://acme-tv.live.hubfly.app:443/live/hfls_cam1abcd_…

SRT encoders

SRT copes better with lossy links such as mobile or long-distance contribution. Your encoder is the caller; the server listens on UDP 9000:

text
srt://acme-tv.live.hubfly.app:9000?streamid=publish:hfls_cam1abcd_…
  • The stream id may also use the access-control form #!::m=publish,r=hfls_cam1abcd_….
  • Latency: 2,000 ms by default; the server accepts the encoder's value from 120 to 8,000 ms.
  • Encryption: set an SRT passphrase of 10–79 characters on the input and the same passphrase in the encoder (AES-128 unless the encoder picks 256).
  • The payload is MPEG-TS. The input's health shows round-trip time, loss and retransmissions.

ffmpeg and GStreamer

bash
# Encode a file for WebRTC-friendly playback and send it over RTMPS
ffmpeg -re -i show.mp4 -c:v libx264 -preset veryfast -b:v 4500k -g 60 -bf 0 \
  -c:a aac -b:a 160k -f flv "rtmps://acme-tv.live.hubfly.app:443/live/$STREAM_KEY"

# Send an already encoded file as-is over SRT
ffmpeg -re -i show.mp4 -c copy -f mpegts \
  "srt://acme-tv.live.hubfly.app:9000?streamid=publish:$STREAM_KEY&latency=2000000"

# GStreamer: a test pattern over SRT
gst-launch-1.0 videotestsrc is-live=true ! x264enc tune=zerolatency bframes=0 key-int-max=60 ! \
  h264parse ! mpegtsmux name=mux ! srtsink uri="srt://acme-tv.live.hubfly.app:9000?streamid=publish:$STREAM_KEY" \
  audiotestsrc is-live=true ! avenc_aac ! mux.

ffmpeg's SRT latency is in microseconds. Command lines are visible to other users of the machine, so prefer hubfly stream push, which runs ffmpeg for you but carries the bytes to the server itself and never passes the key to ffmpeg:

bash
hubfly stream push acme-tv show.mp4 --input sin_cam1abcd --protocol srt --loop
hubfly stream push acme-tv /dev/video0 --bitrate 3000

Publish from a browser

A browser tab can publish a camera, a screen or a canvas over WHIP with @hubfly/streams/publish. The stream key is a publishing secret: give it only to people who may go live, for example by fetching it from your backend after they sign in.

JavaScript
import { publish } from "@hubfly/streams/publish";

const stream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
const handle = await publish({
  url: "https://acme-tv.live.hubfly.app/whip/sin_cam1abcd",
  token: streamKeyFromYourBackend,
  stream,
  maxBitrateKbps: 2500,
});
handle.addEventListener("statechange", () => console.log(handle.state)); // connecting, live, …
// Later: await handle.stop();

WebRTC uses UDP 8189, with TCP 8189 as a fallback; there is no TURN relay, so networks that block both cannot publish over WHIP. Use RTMPS there.

Pull a camera or another stream

A pull input makes the server fetch the media itself, for example from an IP camera or another streaming service. It takes an rtmp, rtmps, rtsp, rtsps, srt or https (HLS) URL, reconnects after 1, 2, 5, 10 and 30 seconds when the source drops, and dials public addresses only. Credentials in the URL are kept secret and never logged. Pulled media is ingest, so it is not billed.

bash
hubfly stream inputs create acme-tv "Lobby camera" --pull "rtsp://viewer:secret@203.0.113.7:554/stream1"

Backup encoders and failover

Create the input with a backup key (--backup-key in the CLI) and point a second encoder at the same URL with that key. While the primary publishes, channels play it. When the primary is silent for 3 seconds (the channel's failover setting, 0.5–30 s), the channel switches to the backup, then to the channel's backup source, then to the slate. With Return to primary, it switches back once the primary has been stable for 10 seconds. Switches happen on keyframes, so players keep playing.

Only one encoder may publish per key. A second one is refused unless the first has been silent for 5 seconds.

Health and refusals

While an encoder publishes, Inputs, hubfly stream live and the input.connected event show its protocol, codec, size, frame rate, bitrate, keyframe interval and whether it sends B-frames. When the server refuses an encoder:

SituationRTMPSRTWHIP and Icecast
Wrong key, unknown input, or a protocol the input does not acceptNetStream.Publish.BadNameReject 1403401
Input disabled, server stopped, or billing blockedNetStream.Publish.DeniedReject 1403403 with a reason
Another encoder is publishing with that keyNetStream.Publish.BadNameReject 1409409
Your address is not in the input's allowed networksNetStream.Publish.DeniedReject 1403403

For safety, a refusal never says whether the key or the input was wrong. Check the key, the URL and the input's protocols, then the server's state and your balance.

Something unclear or out of date? Emailsupport@hubfly.spaceBack to top