Skip to content

rtmp-services: Prefer RTMPS for services that support it, with fallback to RTMP #2205

Closed

Description

@rdoupe

Summary

Several built-in services accept RTMPS but OBS connects to them over plain RTMP by default. As hardening, prefer the encrypted connection wherever the service supports it, and fall back to plain RTMP with a warning when it can't connect.

Current behaviour (master, same as upstream 33.0.0)

  • Twitch: every server in services.json, "Auto (Recommended)" (rtmp-common.c) and the built-in fallback (twitch.c) are rtmp://. The ingest feed OBS already downloads (https://ingest.twitch.tv/ingests) publishes an rtmps:// url_template_secure for every ingest, and service-ingest.c parses it into rtmps_url, but the Twitch path never uses it. Amazon IVS, which uses the same feed format, already prefers rtmps_url.
  • Also accept RTMPS on their listed ingest host, but default to rtmp://: X / Twitter, Vimeo, niconico, CAM4, BoxCast. Checked with an RTMP handshake over TLS on port 443 (no stream started).
  • nanoStream Cloud / bintu lists RTMPS servers, but after the plain ones, so plain is the default.
  • Probably supported, need a manual check: Nimo TV, Bitmovin, Eventials, EventLive.pro, Kuaishou, Trovo.
  • Already RTMPS by default: YouTube - RTMPS, Facebook Live, Amazon IVS and a few others.

Scope

This change covers free streaming platforms only. Paid services (Vimeo, BoxCast, nanoStream, Bitmovin, Eventials, EventLive.pro) can follow later.

  • In: Twitch, CAM4, Nimo TV, Trovo, Kuaishou. Nimo TV, Trovo and Kuaishou are in only if every server passes the endpoint check below.
  • In if streaming from an external encoder is free: X / Twitter, niconico. Confirm before adding.

Proposal

  1. Prefer RTMPS where supported. Twitch uses the feed's secure URL for Auto, the server list and the fallback. In-scope services that support it get their rtmps:// server first (RTMPS port 443).
  2. Fall back after a short countdown. If the TLS connection fails, show a dialog saying the encrypted connection failed. It has a Proceed anyway button with a 3-second progress countdown, and a Cancel button.
    • When the countdown ends, or the user clicks Proceed anyway, OBS connects to the same server over plain RTMP. Cancel stops the stream start.
    • When nobody is at the screen (obs-websocket StartStream, --startstreaming), the same 3-second countdown runs and then OBS proceeds, so automated setups still go live.
    • Every fallback is written to stderr and to the OBS log.
    • Reconnects during a stream use the protocol the stream connected with, so no dialog appears mid-stream.
  3. Existing profiles. They pick this up without rewriting their settings. A saved built-in rtmp:// server for one of these services maps to its RTMPS counterpart at connect time, with the same fallback.
  4. Custom servers are unchanged. rtmp:// stays rtmp:// for local and self-hosted setups.
  5. No new option. It is the default behaviour.

Things to fix with it

  • Windows network optimizations: rtmp-stream.c turns off "Enable network optimizations" (and with it low-latency mode) for any rtmps:// URL ("not compatible with RTMPS"). Both are off by default, but users who enabled them would lose them silently. The new socket loop should work with TLS before the default changes.
  • Mbed TLS: RTMPS goes through the bundled Mbed TLS, so bug: bundled Mbed TLS 3.6.4 has public advisories fixed in 3.6.7 (RTMPS certificate checks) #1121 (3.6.4 → 3.6.7) should land first.

Cost

TLS is cheap at streaming bitrates. AES-GCM with hardware AES uses about 0.02% of one core at 10 Mbps (about 0.3% in pure software). Other costs are a handshake once per connect and about 0.2% extra bytes.

Testing

  • Endpoint check for every RTMPS server we add. It checks the Twitch feed's secure URLs (they aren't in services.json; OBS fetches them at runtime), the hardcoded Twitch fallback, and each new rtmps:// entry in services.json. For each one it checks DNS, a valid certificate for the hostname, the RTMP handshake over TLS, and an RTMP connect to the service's app path. A publish with a fake key must be rejected the same way as over plain RTMP. A service switches only if all of its servers pass. Rerun the check whenever these servers change.
  • RED/GREEN unit tests for the URL choice (Auto, listed server, fallback, existing profile, custom unchanged) and for the RTMPS → RTMP fallback path against a local TLS listener. Cover the countdown: proceed when it ends, proceed on click, Cancel, the stderr and log lines, and the countdown with no UI.
  • A product-level A/B: stream to a real Twitch ingest (bandwidth-test mode, so nothing goes live) over RTMP and RTMPS at the same settings, and compare dropped frames, connect time and CPU.
  • One RTMPS stream per OS (Linux, Windows, macOS), to cover the OS-specific parts: loading trusted certificates, and the Windows socket loop.

Activity

  1. rdoupe commented on Oct 24, 2026

    @rdoupe
    CollaboratorAuthor

    Claiming: this issue.

    1. An endpoint check that needs no account runs against every server of every RTMP service (free and paid) and Twitch's ingest feed. Only services whose RTMPS servers all pass switch. The rest go to a follow-up issue as untested.
    2. RED: unit tests for the server choice (Auto, listed server, fallback, existing profile, custom unchanged) and for the RTMPS → RTMP fallback with the countdown.
    3. GREEN: RTMPS by default for the passing services, plus the 3-second "Proceed anyway" fallback logged to stderr.
  2. added
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 24, 2026
  3. vpacher commented on Oct 24, 2026

    @vpacher
    Member

    One detail for the fallback: fall back only when the TLS connection can't be made (timeout, refused, reset, handshake failure). When the handshake completes but the certificate doesn't verify (MBEDTLS_ERR_X509_CERT_VERIFY_FAILED, or a wrong host name), stop the stream start and log why. That case isn't a network or performance problem: someone presented a certificate the service wouldn't, and falling back would send the stream key to them in clear text. A test with a local TLS listener that presents a certificate for another host covers it.

  4. added a commit that references this issue on Oct 24, 2026
    9e0c8cc
  5. vpacher commented on Oct 24, 2026

    @vpacher
    Member

    Heads-up for step 2 (the fallback dialog): the shared warning that #1092's decision asks for is in progress in #2218, draft PR #2238. It's a dialog with a 3-second progress countdown that auto-accepts "Accept anyway", an optional Cancel, the error on stderr and in the log, once per session, and only logging when no window is visible. The Rust core and the frontend staticlib are in the PR; the Qt dialog and the API come next.

    The planned call is obs_frontend_warn_fallback(id, title, message, can_cancel, callback, param). For the RTMPS fallback, can_cancel = true, so Cancel stops the stream start, and the callback gets whether to continue over RTMP. If that fits, the RTMPS fallback could use it instead of its own dialog. Comments on the API shape are welcome on #2218.

  6. moved this from In progress to In review in obs-rust Multiviewon Oct 25, 2026
  7. added
    readyMeets the definition of Ready; claimable
    and removed
    claimedAn agent or person has claimed this; check the claim comment before starting
    on Oct 25, 2026
  8. vpacher commented on Oct 25, 2026

    @vpacher
    Member

    The shared fallback warning from #2218 is merged in #2238, so #2219 can use it instead of OBSRtmpsFallback:

    obs_frontend_warn_fallback("rtmp.unencrypted", title, message, true /* can_cancel */, cb, param);

    It logs the line at error level at once (also on stderr), shows the dialog with the 3-second countdown, and calls cb(param, accepted) once on the UI thread: true for the countdown and "Accept anyway", false for Cancel or a closed dialog. The rules, the standard wording and an example are in docs/fallback-warning.md. For RTMP that is the title "Streaming unencrypted (RTMP)", the term "unencrypted", the buttons "Accept anyway" and "Cancel", and the message in the order: what failed, what OBS does instead, what the user can do.

    Two differences from OBSRtmpsFallback to decide before switching:

    1. Once per session. The helper shows the dialog once per id in an OBS session; the same id again only logs and accepts. rtmp-services: Stream over RTMPS where the ingest server accepts it #2219 asks on every failed start. If RTMPS should ask each time, we can add that to the API (for example a flag), or the id can include the server. Which do you prefer?
    2. Hidden main window. The helper logs and accepts at once (no dialog nobody sees). rtmp-services: Stream over RTMPS where the ingest server accepts it #2219 runs the countdown with a tray notice.

    It also waits while another modal dialog is open, and pauses its countdown when one opens over it, so it never accepts unseen.

    And the point from my earlier comment, which #2219 doesn't cover yet: the fallback runs on any OBS_OUTPUT_CONNECT_FAILED, and a certificate that doesn't verify ends there too. Please keep the fallback to connection failures (timeout, refused, reset, or a handshake failure other than certificate verification) and stop the start with the reason in the log when the certificate doesn't verify.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestreadyMeets the definition of Ready; claimable

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions