abswitchA/B composition switcher for mimoLive 7

Status: v0.2.0, a working proof, not a product. Tested on mimoLive 7.0b3 (build 30982) with NDI test sources on one Mac. Bench tests 3, 4 and 7 (real cameras, real audio, glass-to-glass latency) have not been run yet. The source-tally item (9 in CHANGES.md: a source's tally stuck at program on 7.0b3) is open. PUSH, steps and history are a forum user's ideas. MIT licensed (LICENSE; mimoLive's own layer files inside documents/*.tvshow are Boinx's, see Files). Every claim is backed by a test in test/, and test/falsify/ shows each check failing where it should.

Two mimoLive documents compose independently and alternate PGM/PVW roles. A third document owns the only on-air output and performs the TAKE with its Video Switcher layer. takectl is the brain: it knows which document is on air, fires the transition, verifies it against the switcher's own live slot, lights tally in A and B, and gives Companion/Stream Deck one button to press.

   cameras / Keynote / MyLowerThird  (NDI, shared)
              │              │
        ┌─────▼─────┐  ┌─────▼─────┐
        │  PH-A     │  │  PH-B     │   composition documents
        │  layers   │  │  layers   │   (video-only NDI out, TALLY layer on top)
        └─────┬─────┘  └─────┬─────┘
          NDI "PH-A"     NDI "PH-B"
              │              │
        ┌─────▼──────────────▼─────┐
        │  PH-MASTER               │   Video Switcher: slot1=PH-A slot2=PH-B
        │  audio from interface    │   program audio lives HERE only
        │  record / stream / NDI   │
        └─────────────▲────────────┘
                      │ HTTP API :8989  (signals, tally, datastore, websocket)
                ┌─────┴─────┐
                │  takectl  │ :8991   /take /push /cut /undo /mirror /panic /state
                └─────▲─────┘
                      │ HTTP
               Companion / Stream Deck

Everything takectl does is in the public mimoLive 7.0b3 HTTP API (https://mimolive.com/user-manual/remote-control-automation/http-api/endpoints/):

takectl actionmimoLive API used
discover docs/layers/sourcesGET /documents, /layers, /sources, /output-destinations
TAKE / CUTGET /documents/{M}/layers/{switcher}/signals/tvGroup_Control__Dis_n_TypeSignal (or Cut_n)
who is on air (ground truth)GET /documents/{M}/layers/{switcher} → input-values.tvGroup_Hidden_Inputs__currentLiveSource (+ per-slot codes in output-values)
cross-check only (witness)GET /documents/{M}/sources/{ndiA} → attributes.tally-state
tally lights in A/BGET /documents/{A}/layers/{TALLY}/setLive / setOff
persist role statePUT /documents/{M}/datastores/abswitch-state
mirror PGM look into PVWGET /documents/{PVW}/layer-sets/{id}/recall
PUSH a look onto Program; stepsGET /documents/{PGM}/layer-sets/{id}/recall
stinger; hooksGET /documents/{M}/layers/{STINGER}/setLive / setOff; hooks switch layers or recall sets the same way
history, steps lists, hooksPUT /documents/{M}/datastores/abswitch-history / abswitch-steps / abswitch-hooks
catch changes made outside takectlws://host:8989/api/v1/socket → sources changed

Build the three documents

Design rule: where a layer lives.

PH-A.tvshow and PH-B.tvshow (identical; build one, Save As the other)

  1. Show Settings: same size and frame rate as MASTER (1920×1080, 30 or 60 — pick one and match everywhere).
  2. Add your NDI cameras, Keynote NDI, MyLowerThird browser source, etc.
  3. Build the layer stack you want to switch between. Create Layer Sets for your standard looks (e.g. Speaker Wide, Two Shot, Slides PiP, Full Slides). Use identical Layer Set names in A and B — /mirror relies on that. Leave TALLY out of every Layer Set ("No Action", never recorded as Off), or a recall fights takectl over tally.
  4. Top of the stack: a Box/Placer layer named exactly TALLY — a 24-px red border frame, or a solid red bar across the top, whatever you can see from across the room. Leave it off. takectl turns it on when that document is PGM. You will crop it out in MASTER (step 3 below), so the audience never sees it.
  5. Output Destinations: add NDI Output, name it PH-A (PH-B), Audio: none / muted, Start with show ✓. On 7.0b3 the NDI sender drops the hyphens: PH-A advertises as (PHA). Remove or disable every other output destination.
  6. Do not put program audio in these documents. If a camera source carries audio, mute it in the layer.
  7. Enable Settings → Remote Control → Allow Remote Control Access (no password, or set apiPasswordSha256).

PH-MASTER.tvshow

  1. Same size/frame rate.
  2. Sources: NDI PH-A, NDI PH-B (name them NDI PH-A, NDI PH-B to match the config), and the audio interface as an Audio Device source.
  3. Layer stack, bottom to top:
    • Video Switcher, name it AB Switcher. Source Count = 4 (7.0b3 offers only 4 or 9). Slot 1 = NDI PH-A, Slot 2 = NDI PH-B. Transition Duration = 0.5 s (7.0b3 caps a dissolve at 5 s). The switcher has no audio path on 7.0b3, so there is no audio-follow-video to disable.
    • Crop the TALLY bar on the two sources, not the switcher (it has no zoom): give NDI PH-A and NDI PH-B each a Scale & Transform filter at Mode Custom, 1920 × 1080, Zoom 105. That takes about 27 px off the top and bottom and 48 px off each side. A 2.5 % zoom takes only ~13 px and does not hide a 24 px bar.
    • Audio Only layer fed by the audio interface — this is program audio.
    • Persistent graphics (bug, clock, anything that must survive a TAKE) go here, above AB Switcher.
    • Optional: a MASTER TALLY text layer that shows "A" / "B" (takectl can be extended to set its text).
  4. Output Destinations: File Recording, Live Streaming, and/or NDI PH-PGM to the streaming Mac. Start with show ✓.
  5. Right-click the switcher's "Cut 1" button → Copy URL to Trigger Button. Paste it in a browser. If it switches, the API is alive and takectl will find the same signal key automatically.

Run

Double-click start.command. It checks for Node.js 22 or later and says what to install if it is missing, starts takectl and opens the operator page. The first time, macOS may refuse a file downloaded from the internet: right-click start.command, choose Open, then Open again.

First run: setup. With no takectl.config.json, takectl starts in setup mode and the page opens at /setup.

  1. Choose the three documents from dropdowns. They can be on one Mac or on three: each has its own "mimoLive at" address.
  2. Choose the two NDI sources and the switcher layer in MASTER. When the names match (PH-A, NDI PH-A, AB Switcher …) they are chosen for you.
  3. Choose the safe source PANIC cuts to (optional; see "Safe source" below). A source sitting in a switcher slot of its own is chosen for you; "None" keeps PANIC on A.
  4. Save writes the config and takectl starts running.

Anyone on the network can look at /setup, but Save and Start Over work only from the Mac running takectl. Once set up, /setup shows the saved choices, and Start Over (on that Mac, with the master's show stopped) keeps the old config as a dated backup and opens setup again.

Doctor. /doctor shows every check as a green or red light, each red one with a one-sentence fix. The operator page's status strip turns red and links there when any check fails. The same list from a terminal: node takectl.mjs doctor, which exits 1 when anything is red. If mimoLive or a document is not open yet, or goes away later, takectl keeps its pages up and tries again every 3 s, then reads who is on air from the switcher. PANIC keeps working meanwhile as long as the master document can be reached. Layer Set names that exist in only one document are a warning, not a failure: their buttons stay greyed.

By hand, without the launcher:

cp takectl.config.example.json takectl.config.json   # edit hosts / names (or use /setup)
node takectl.mjs doctor      # the checklist; exits non-zero on problems
node takectl.mjs             # runs the controller on :8991

doctor prints the signal keys it found. If dis is empty, your beta's Video Switcher uses different input keys — copy the URL from the right-click menu and set the key names in the config (open an issue; the regex in Master.discover() is the only place to touch).

Endpoints (all GET, all return JSON):

/the operator page (HTML; see "Operator page" below). Before setup it sends you to /setup
/setupchoose the documents, sources and switcher; Save writes the config (only while there is none)
/doctorthe checklist as green and red lights with fixes; /doctor.json is the same as data
/takedissolve PVW → PGM, flip roles. Refused if busy or preflight fails.
/cutsame, as a bare cut: never the stinger (as on an ATEM); its hooks still run
/mirrorrecall PVW's Layer Set with the same name as PGM's active set (start the next look from the current one)
/pvw/layer-set/<name>recall the Layer Set <name> in whichever document is PVW (green) now. Refused if PVW has no set of that name, while a transition is busy or in flight, or if the switcher says PVW is on air
/pushrecall PVW's active Layer Set on PGM, live (the look changes on air; the documents keep their roles). Refused while busy or in flight, when PVW has no active set, or when PGM has no set of that name
/undotake back to the previous look. Only after a TAKE or CUT, and only while nothing has been sent to PVW since (/state.undo.why says why not)
/steps/add, /steps/clear, /steps/record?on=1|0build a list of looks: add PVW's active set, clear, or record every PVW recall as a step
/steps/push?pace=instant|originalpush the steps onto PGM in order: each as soon as the last has landed, or at the recorded pace (gaps capped at 10 s). With the stinger on, an instant run goes under one stinger (only the last step's post-hooks run, after the reveal); at the recorded pace the stinger covers the first step only
/steps/save?name=, /steps/load?name=, /steps/delete?name=, /stepsnamed lists, kept in MASTER
/history, /history/reset?confirm=1which looks followed which (the page shows it as emphasis)
/stinger?on=1|0cover TAKE, CUT, PUSH and steps with MASTER's STINGER layer (see "Stinger and hooks")
/transition?mode=mix|stinger, /rate?s=the transition selector; the switcher's dissolve length (0.1–5 s)
/ftb?on=1|0, /dsk?label=<label>&on=1|0fade to black (video only) and the downstream keys. Not commits: they work mid-transition and in SAFE, and are not logged
/pvw/layer-set?name=, /thumb?name=the query forms of the look routes (any name, including "." and ".."); /thumb serves a look's still
/hooks, /hooks/rehearsethe hooks in use; run the post-hooks of a take to PVW's look, in PVW. POST /hooks (from the takectl Mac only) saves hooks in MASTER
/paniccut to the safe source (or to A when none is set up), then read the switcher and cut again while it is not there (at most 3 rounds). Wins over a TAKE in progress. Cancels pending hooks and steps and switches the stinger off; leaves FTB as it is. Answers once the switcher confirms; with the safe source already on air it answers at once, without a cut
/safe/target?doc=A|Bwhile SAFE (or another slot) is on air: which document a TAKE or CUT goes to. It is Preview: /state.pvw names it
/watch?on=1|0, /watch/dismissWATCH PGM on or off (runtime only); accept a change made in mimoLive's window to Program (see "Working live"). /watch alone is the watch state, also in /state.watch
/resyncre-read the switcher's live slot and re-apply roles
/statepgm, pvw, busy, switcher slot + per-slot codes + inFlight, source tally, warning, last take, last error, Layer Set names, document ids, recent events

Preflight before every transition checks:

A failed preflight returns ok:false with the reason and does not touch MASTER. doctor runs the same checks. "preflight": false in the config disables all of them, the COUNTER check included.

Safe source

PANIC needs somewhere to go that is always fine to show. With a safe source set up, PANIC cuts the master's switcher to it instead of to document A.

Downstream keys and fade to black

Downstream keys: every layer in MASTER named DSK <label> that sits above the AB Switcher becomes a toggle labelled <label>.

FTB: MASTER's FTB layer, at the very top, fades program to black in 0.5 s and back.

Stinger and hooks

Stinger. documents/build-documents.mjs gives MASTER a STINGER layer above the switcher: the default stinger, a slate box that wipes in from the left and out to the right in 0.4 s.

With the stinger on ("stinger": true in the config, or the page's STINGER key), every TAKE, PUSH and step (never a CUT, which is always bare):

  1. sets STINGER live;
  2. waits stingerCoverMs (500: the wipe is fully closed by ~420 ms);
  3. cuts underneath;
  4. switches STINGER off stingerOffMs (120) later.

Your own stinger media: put it on the STINGER layer (or a layer named in stingerLayerName), then run node test/stinger-cover.mjs --write. It measures the cover window on MASTER's program output and sets both values; the defaults fit only the slate wipe. Run it again after any change of media or of network (documents on other Macs add delay to every command). The default leaves the cut about 84 ms inside full cover, which is thin across Macs.

A missing STINGER layer means the TAKE goes ahead without it, with a warning. A STINGER already live, or stuck in shutdown, refuses the TAKE: PANIC switches it off.

Hooks fire extra actions around a TAKE, CUT, PUSH or step (never on their own):

Key them by the Layer Set you take to, or by a pair "From -> To", which wins:

"hooks": {
  "Interview":            { "post": [ { "layer": "Lower Third", "set": "live", "delayMs": 300 } ] },
  "Interview -> Slides":  { "pre":  [ { "layer": "Lower Third", "set": "off" } ], "waitMs": 400 },
  "Wide":                 { "post": [ { "layerSet": "Wide Cams" }, { "layer": "Applause", "set": "live", "in": "master" } ] }
}

TALLY during a transition:

Operator panel

Open http://<takectl-host>:8991/ on an iPad in landscape, or any browser, on the show network. It is one self-contained file, operator.html, served by takectl: no build step, no CDN, no internet needed. It fits one screen with no scrolling at 1440×900 and on an iPad in landscape, and every control is a real button of at least 44 px. Keys never move: nothing on the panel changes place when the state changes.

Operator panel at 1440×900: Program (document A) left, Preview (document B) right, look keys with thumbnails, transition block
Operator panel at 1440×900: Program (document A) left, Preview (document B) right, look keys with thumbnails, transition block
The same panel on an iPad in landscape (1180×820)
The same panel on an iPad in landscape (1180×820)

Pictures across origins. The page comes from takectl (:8991); the pictures come straight from each document's mimoLive (:8989, or another host). That is fine for <img>: no CORS involved.

Working live

Everything is meant to go through takectl, but mimoLive's own window is always there, and a show is sometimes fixed in it by hand. takectl listens to mimoLive's event socket (/api/v1/socket, the one mimoLive's own remote tools use) for both documents, and says when the one on air was changed there.

Program changed in mimoLive. If someone changes the on-air document in mimoLive's window, Program's header strip turns amber: CHANGED IN MIMOLIVE and what changed ("Lower Third on", "Lower Third: Title", "Layer Set "Wide" edited"). The readout's WARNING line says the same.

CHANGED IN MIMOLIVE on Program's header strip after the Lower Third was switched on in mimoLive's window (iPad, 1180×820)
CHANGED IN MIMOLIVE on Program's header strip after the Lower Third was switched on in mimoLive's window (iPad, 1180×820)

NOT WATCHED on the strip: the event socket is down. takectl reconnects every 2 s; when it is back, it reads both documents again and flags what changed meanwhile ("…, while not watched").

Preview changed in mimoLive. No warning: composing Preview by hand is normal. But UNDO goes off ("Preview changed"), since it could no longer put back what was on air, and about 1 s after Preview settles, the thumbnail of the look it then shows is taken again.

Known limits

Companion page

Use the Generic HTTP module pointed at http://<takectl-host>:8991, plus Companion's HTTP API (Settings → HTTP → enable) so takectl can push custom variables ab_pgm, ab_pvw, ab_error.

KeyActionFeedback
TAKE (big, red)GET /taketext $(custom:ab_pvw) → PGM; flash while /state.busy
PUSHGET /push
CUTGET /cut
UNDOGET /undo
MIRRORGET /mirror
Anone (label only)background red if $(custom:ab_pgm) == A, green if == B (ab_pgm reads SAFE, or OTHER, while the safe source or another slot is on air)
Bnoneinverse
PANICGET /panichold-to-press
ERRnonetext $(custom:ab_error), red when non-empty

Operator rule printed on the deck: compose only in the GREEN document. Rest of the deck: Layer Set recall buttons that target both A and B (Companion mimoLive module, one connection per document) — the one that's PGM gets ignored by convention; or better, route them through takectl so they only hit PVW: GET /pvw/layer-set/<name>.

Why this shape and not the alternatives

Bench protocol — do these before trusting it in a show

  1. Independence. Hide/minimize PH-A's window behind PH-MASTER. Confirm NDI PH-A keeps updating in MASTER's multiview (mimoLive renders when a document is live regardless of window state; verify on this beta).
  2. Signal control. node takectl.mjs doctor shows cut/dis keys for slots 1 and 2. curl :8991/cut twice; watch MASTER.
  3. Frame-cleanliness. Put a frame counter into both A and B. The release ships without one; add the bench stopwatch back:

    • By script: BENCH_COUNTER=1 node documents/build-documents.mjs (documents open in mimoLive).
    • By hand: in PH-A and PH-B, a Stopwatch layer named exactly COUNTER, counting up, Start on Live, 1/100 s, and left out of every Layer Set ("No Action"; never recorded as off).
    • takectl refuses every TAKE and CUT while COUNTER is live, so record this test with "preflight": false in a temporary config (test/record-take.mjs does exactly that). Delete COUNTER in both and save afterwards.

    Record MASTER. Scrub the dissolve: one source should fade to the other with no black, no freeze, and identical counter values at the midpoint (proves A and B latency is symmetric). If the counters differ by a frame, one NDI receiver is on a different bandwidth/latency setting — match them.

  4. Audio. Play tone through the interface. TAKE ten times. Record. Spectrogram should be flat through every transition. Any dip/comb = audio leaked into A or B's NDI.
  5. Desync recovery. While takectl runs, click "Dis 1" in MASTER's UI. Within ~0.5 s /state should show PGM=A and the TALLY layers should have flipped. Then kill takectl, TAKE manually, restart takectl — it must start with the correct PGM from the switcher, not from the stale datastore (scripted: node test/bench5-check.mjs).
  6. Load. All three documents on one Mac, 1080p60, five NDI cams in each of A and B. Watch Status display → render time in each document. If MASTER drops frames, move A and B to the AV Mac (change host in the config; takectl doesn't care where documents live).
  7. Latency budget. Camera → A → NDI → MASTER → NDI → streaming Mac is three NDI hops (~2–3 frames each). Measure glass-to-glass with a clapper. Fine for stream; if there's room video from MASTER, know the number.

Before a live show

  1. No COUNTER layer in PH-A or PH-B. The package ships without it. If you added it back for bench test 3, delete it in both and save: it goes to air, no Layer Set switches it off, takectl refuses every TAKE and CUT while it is live, and pack.sh's saved-files check refuses a package that has one.
  2. node takectl.mjs doctor exits 0.
  3. MASTER crops the TALLY bar. NDI PH-A and NDI PH-B each carry Scale & Transform at Custom, 1920 × 1080, Zoom 105 (see documents/README.md). Both TALLYs are lit through every dissolve, so the crop is what keeps them off air.
  4. One real TAKE, recorded and scrubbed: no TALLY edge and no black or freeze through the fade.
  5. The operator page works from the operator's device: open http://<takectl-host>:8991/, both pictures move, the green border is on PVW.
  6. No witness warning, both ways. With A on air and again with B on air, curl :8991/resync must show "warning": null. takectl no longer trusts source tally, but a warning means mimoLive's own tally is wrong (CHANGES.md, item 9): capture the log line for Boinx. Re-check after any edit to MASTER's sources.

Files

This page is the package’s README.md, v0.2.0. Download · Source on GitHub · User’s guide · Tools