MainSDK
Search⌘K
Integrations

Mux

Mux as a planned MainSDK media driver for video transcoding and streaming - setup, main.yaml, works on files from any files driver, and swapping.

1 interface1 driverWritten guide
Updated 2026-10-28

Mux is a hosted video service that transcodes uploads and streams them to any screen. It is listed as a planned driver behind media for media.video().transcode(). You would pick it when video is central to your app and you want adaptive streaming.

Interfaces it serves

Pick Mux in main.yaml for any of these. Your calls stay the same, and you can swap later.

Before you start

  1. Create a Mux account and an environment for development and one for production.
  2. Create an access token for server calls and store it in your secrets manager.

Configure

main.yaml
media:
  driver: mux

How the driver takes its access token (as a secret: reference) is not defined yet.

Use it

lib/proof-video.ts
import { media } from "mainsdk/media";

export async function prepareVideo(videoId: string) {
  return media.video(videoId).transcode();   // videoId from files.upload()
}

Local development and testing

media ships in phase 2; its fake for createTestApp() from @mainsdk/testing and chaos.on("media", { outage: true }) arrive with its spec. Mux's separate environments keep test videos apart from production.

What MainSDK adds on top

  • Location data stripped from video.
  • Source videos stay in files, owner-scoped, scanned and stored by your files driver.

See Images and video.

Limits and notes

  • Planned driver, not in the spec yet; media is phase 2.
  • Works on files from any files driver (ADR-0013). Whether Mux stays as a media driver is not decided, because media has no spec.
  • Check where Mux processes video against your MainSDK data region (US, EU or India).

Swap to or from it

main.yaml
media:
  driver: mux   # was getqr

Originals stay in files; transcoded copies held by Mux stay behind when you switch away.

FAQ

Can users upload video straight to Mux? No. Uploads go through files to the store you chose; importing a storage SDK in route code fails mainsdk check with MAIN-FILES-0010.

Should I use Mux today? media is phase 2 and has no spec, so the driver does not exist yet. Use the default getqr driver until it does.

Next

Open questions

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet