Skip to content
InstantClone

Story · Why I did X and not Y

Twitch VOD audio with Enhanced Broadcasting: why it's a script, not a plugin

Twitch streamers want two things from OBS at once: Enhanced Broadcasting, and a VOD track without the music. OBS gives the second one only to a service called Twitch. This is how InstantClone gets both.

Published

  1. 0.1.0

    2 June

    Enhanced Broadcasting and VOD audio, the first way.

  2. OBS 32.2

    Summer

    OBS locks the VOD track to Custom services. The first way breaks.

  3. 0.1.13

    1 August

    The VOD unlocker script ships.

  4. 0.1.15

    4 October

    It works with Enhanced Broadcasting off too.

The problem · The gate

One name check

The Twitch VOD track is a second audio track. Your live stream keeps the music, the VOD gets the clean track, and old streams don't get muted for copyright.

In OBS, that checkbox only works when the service in your stream settings is literally named “Twitch”. InstantClone registers its own service in OBS, so the stream can go through it. Its name is InstantClone. No VOD track.

0.1.0 had a way around it. Then OBS 32.2 limited the VOD track to Custom services, and that way stopped working.

sketch #1
OBSname =="Twitch"?VOD trackInstantClone? no VOD :(

The fork · Dead ends

Two ways that didn't work

Before the one that worked, I built and tested the first and dug through OBS's source code for the second. I also asked on OBS's GitHub.

nope

Use OBS's Custom service

Custom services do get the VOD track. But there, Enhanced Broadcasting reads a fixed block of settings pasted into OBS, so InstantClone can no longer hand OBS its settings live. One feature for another.

tested it. kills the live config

nope

Write an OBS plugin

This was the plan. Then OBS's source said no: its service list only takes OBS's own service types, and the VOD checkbox is decided by the name in the settings window. And a plugin is compiled code to rebuild for every OBS version.

the plan, until I read the source

The fork · What shipped

A small Lua script

OBS runs Lua scripts out of the box, from Tools, Scripts. The script waits for the stream to start, and in that moment adds a second audio encoder on the second track. That is exactly what OBS's own VOD Track does. It just skips the name check.

Nothing pretends to be Twitch, so nothing else in OBS that cares about the Twitch name gets confused. No compiled file, nothing to rebuild per OBS version. It shipped in 0.1.13, on 1 August.

sketch #2
OBStrack 1 · livetrack 2 · VODTwitchthe script adds this when you go live

The build · Crashes

Who owns the encoder

The first versions crashed OBS. More than once. Each time, my script kept the encoder it made and freed it later: when the stream stopped, when the next one started, when OBS closed. Each time, OBS's audio was still using it.

The fix was to stop holding on. Make the encoder, hand it to the stream, let go right away. From then on OBS owns it and cleans it up itself, the same way OBS treats its own encoders. No more crashes.

found by reading OBS's code, after guessing didn't work

After release · The report

Two more fixes, from the outside

At first, InstantClone saved the script straight into OBS's scripts folder. That broke on portable OBS, which keeps its folders somewhere else (issue #51). Since 16 August you get a normal Save window and choose the folder yourself.

Then adTexazreported on Discord that with Enhanced Broadcasting off, the VOD had no separate audio. Their logs showed why: OBS's own setup freed the script's encoder right before going live, so only one track went out. With Enhanced Broadcasting on, a different part of OBS sends the stream, so I had never seen it. Fixed on 29 September, out in 0.1.15. Thanks, adTexaz.

Today

Since 0.2.0, a step by step VOD audio guide in the dashboard walks you through it: download the script, add it in OBS under Tools, Scripts, and check that it works. Your Twitch VODs get their own audio track, with Enhanced Broadcasting on or off.

S1

Try it on your next stream.

Free and open source. Download it, run it, and the dashboard opens in your browser.

Linux buildGitHub