Skip to content

Enhanced Broadcasting forces B-frames (NVENC): add a user override for low-latency/remote-desktop setups (from upstream #13933) #19

Closed

Description

@zackees

Imported from upstream obsproject/obs-studio#13933 (reported by @AscendancyDotA on 2026-09-25), which was closed as not planned upstream. The original report is quoted below, unedited.

Upstream report

OS: Windows 11 · OBS: 32.2.2 · GPU: RTX 3090, driver 610.62

Expected: an option to disable B-frames when using Twitch Enhanced Broadcasting, or it just works.

Current: with Sunshine + Moonlight remote desktop on NVENC and an OBS NVENC preset p3–p5 with B-frames enabled, there is unusable input lag and stutter. The user still wants Enhanced Broadcasting for its bitrate/HEVC benefits. Twitch's auto-config suggests B-frames on.

Steps to reproduce

  1. Run a Twitch test stream (Enhanced Broadcasting) plus a remote desktop session.
  2. Input lag is severe.
  3. Disable B-frames.
  4. Runs perfectly, even with double encode.

Log excerpt

[obs-nvenc: 'multitrack video video encoder 0'] settings:
	codec:        HEVC
	rate_control: CBR
	bitrate:      9000
	keyint:       120
	preset:       p5
	tuning:       hq
	multipass:    qres
	profile:      main
	width:        2560
	height:       1440
	b-frames:     2
	b-ref-mode:   0
	lookahead:    true (4 frames)
	aq:           true
	user opts:    lookaheadDepth=4

Upstream resolution (not planned):

  • tiberium-v: "You have to report this to twitch … OBS has no more control over the encoder settings, when enhanced broadcasting is active."
  • Fenrirthviti: "… this also feels like a problem with Sunshine/Moonlight and not OBS or Twitch in the first place."

Why it's actionable in this fork

With Enhanced Broadcasting, frontend/utility/MultitrackVideoOutput.cpp (create_video_encoder, ~line 225) builds each encoder's settings straight from the GoLive config: obs_data_create_from_json(encoder_config.settings.dump()). The only local adjustment is a VAAPI profile fix-up, so the user has no way to override bf (B-frames) or lookahead. NVENC's default is bf = 2 (plugins/obs-nvenc/nvenc-compat.c:117), and the UHQ tune forces ≥ 4 (plugins/obs-nvenc/nvenc.c:294).

Proposal (to be decided)

Add an opt-in, user-controlled override applied after the GoLive settings are loaded and before the encoder is created. For example, an advanced setting "Disable B-frames for Enhanced Broadcasting" that sets bf = 0 (and optionally turns lookahead off) on every multitrack video encoder, and logs the override.

Open questions:

  • Does Twitch's ingest accept streams whose B-frame count differs from the config it sent? Needs a test stream. If Twitch rejects or penalizes the stream, the option must say so.
  • Scope: NVENC only, or every encoder that exposes bf?
  • UI placement: Stream settings (Enhanced Broadcasting section) vs. Advanced.

Acceptance criteria

  • Repro on Windows + NVENC with Enhanced Broadcasting: b-frames: 2 in the log; with the override on, b-frames: 0 and the override is logged.
  • A test stream to Twitch with the override on is accepted (document the result).
  • Default behavior (override off) is unchanged.

Activity

  1. added
    enhancement
    on Oct 9, 2026
  2. b7216309-jpg commented on Oct 9, 2026

    @b7216309-jpg
    Contributor

    A concrete plan, so the open questions can be decided before any code is written. I can't build the frontend or run NVENC/Twitch tests on my machine, so I'd rather agree on the design first.

    Today there is no workaround for Twitch. MultitrackVideoConfigOverride (Stream settings → "config override") only takes effect for rtmp_custom services (MultitrackVideoOutput.cpp, the isCustomRtmpService branch). With Twitch, the downloaded GoLive config is used as-is.

    Proposed change

    1. Config key: Stream1 / MultitrackVideoDisableBFrames (bool, default false). This follows the existing MultitrackVideo* keys read in BasicOutputHandler.cpp, and is passed into MultitrackVideoOutput::PrepareStreaming alongside maximum_video_tracks etc.
    2. Override point: in create_video_encoder (MultitrackVideoOutput.cpp), right after encoder_settings is built from encoder_config.settings and before obs_video_encoder_create. If enabled and the encoder exposes a bf property, set bf = 0. Log a line next to the existing per-encoder logging, e.g.
      MultitrackVideoOutput: B-frames disabled by user override (encoder 0: bf 2 -> 0). The [obs-nvenc] settings: dump then shows b-frames: 0, which is the acceptance check.
    3. UI: a QCheckBox in the existing multitrackVideoGroupBox (OBSBasicSettings.ui), next to multitrackVideoStreamDumpEnable / multitrackVideoConfigOverrideEnable. Label something like "Disable B-frames (lower latency; may not match the service's recommended settings)". Hook it like the others (STREAM1_CHANGED), with a string in en-US.ini.
    4. Not touched: lookahead, the UHQ tune (which forces ≥ 4 B-frames in nvenc.c; with bf = 0 requested, we should log rather than silently fight the tune), and the GoLive POST.

    Decisions needed

    • Scope: NVENC only, or every encoder with a bf setting? Several read it: obs-nvenc, ffmpeg-nvenc, x264, QSV. I'd suggest every encoder that has the property, since the user's intent is "no B-frames" and checking obs_properties_get(props, "bf") handles it generically.
    • Lookahead: also turn off lookahead (NVENC) with the same switch? The report's log shows lookahead: true (4 frames), which also adds latency. I'd keep it separate or leave it out at first.
    • Twitch acceptance: does Twitch's ingest accept a stream whose B-frame count differs from the config it sent? This needs a real test stream (NVENC + Enhanced Broadcasting) before we ship. If Twitch rejects or degrades it, the checkbox text has to say so, or the feature isn't viable.
    • Placement: inside the Enhanced Broadcasting group (proposed), or under Advanced?

    Once these are decided, I can write the PR. Someone with an NVENC GPU will need to do the Twitch test stream from the acceptance criteria, since I can't.

  3. nathan-v commented on Oct 10, 2026

    @nathan-v
    Contributor

    Working on this now.

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

    enhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions