Skip to content

fix(vod-script): VOD track dropped when Enhanced Broadcasting is off - #69

Closed
Soulhackzlol wants to merge 1 commit into
mainfrom
fix/vod-script-plain-output
Closed

Soulhackzlol wants to merge 1 commit into
mainfrom
fix/vod-script-plain-output

Conversation

@Soulhackzlol

Copy link
Copy Markdown
Owner

Problem

A user reported no Twitch VOD audio. With verbose logging on, the script logged VOD track attached, but the post-start check said idx1 present=false ours=false, and the InstantClone trace showed a single audio track from OBS.

Cause

AdvancedOutput::StartStreaming -> SetupVodTrack -> clear_archive_encoder (same in OBS 28 through 32.2) does:

obs_encoder_t *last = obs_output_get_audio_encoder(output, 1); // borrowed, no ref
...
obs_encoder_release(last); // stray release

The script hands its create-ref to the output right away, so the output holds the only reference. The stray release brings that to zero. obs_encoder_destroy then detaches the encoder from the output before obs_output_start.

Enhanced Broadcasting was not affected. It streams through the separate rtmp multitrack video output, and clear_archive_encoder only touches the plain streamOutput. That is why EB + VOD passed the live test.

Fix

  • On OBS's plain stream outputs (adv_stream / simple_stream), the script keeps its create-reference for OBS's stray release to consume. The output ends up as the sole owner, and nothing is released after the stream starts, so the earlier crash pattern does not come back.
  • Other outputs (EB multitrack) keep the immediate release.
  • The post-start check always warns when an attached track has gone missing. It no longer needs verbose mode for that.

Test plan

  • Advanced output, EB off: the script log shows no warning, and InstantClone's trace shows two audio tracks to Twitch
  • EB on: still works as before
  • start / stop / start and close OBS mid-session: no crash
  • Twitch VOD has the track-2 audio

OBS's clear_archive_encoder (StartStreaming -> SetupVodTrack, every
version 28-32) calls obs_encoder_release() on the index-1 encoder it only
borrowed. On the plain stream outputs (adv_stream / simple_stream) that
stray release destroyed our freshly attached encoder before the stream
started, so OBS sent a single audio track and Twitch had no VOD audio.
Only Enhanced Broadcasting worked, because it streams through a separate
multitrack output that clear_archive_encoder never touches.

On plain outputs, hand our create-reference to OBS instead of releasing
it: the stray release consumes it and the output stays the sole owner.
The post-start check now always warns when an attached track went
missing, instead of only in verbose mode.
@Soulhackzlol Soulhackzlol self-assigned this Sep 29, 2026
@Soulhackzlol Soulhackzlol added the bug Something isn't working label Sep 29, 2026
@Soulhackzlol

Copy link
Copy Markdown
Owner Author

Superseded: the same fix ships in 0.1.15 as d0a360e on feature/crash-protection (first in v0.1.15-rc.1). It reaches main when 0.1.15 merges.

@Soulhackzlol
Soulhackzlol deleted the fix/vod-script-plain-output branch September 29, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant