---
title: "Mux"
description: "Mux as a planned MainSDK media driver for video transcoding and streaming - setup, main.yaml, works on files from any files driver, and swapping."
section: "integrations"
canonical: "https://mainsdk.dev/docs/integrations/mux"
updated: "2026-10-28"
---

# 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.

Canonical: https://mainsdk.dev/docs/integrations/mux · 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`](https://mainsdk.dev/docs/interfaces/media) for `media.video().transcode()`. You would pick it when video is central to your app and you want adaptive streaming.

> **Note:** `media` works on files from any [`files`](https://mainsdk.dev/docs/interfaces/files) driver (ADR-0013). Source files stay in `files`; Mux only holds the transcoded copies.

> **Note:** `media` has no spec yet. The calls and options on this page are provisional and may change when the spec lands.

## Interfaces it serves

### Images, video and audio (`media`)

- Status: Building for 0.4 · ships as a beta API
- Driver: `mux` (Mux)
- Docs: https://mainsdk.dev/docs/interfaces/media.md

```yaml
media:
  driver: mux
```

Swap to another provider: `getqr`, `cloudinary`, `ffmpeg`, `local`.

## 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

```yaml title="main.yaml"
media:
  driver: mux
```

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

## Use it

```ts title="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](https://mainsdk.dev/docs/interfaces/media).

## 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

```yaml title="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

- [Images and video](https://mainsdk.dev/docs/interfaces/media)
- [getqr.id](https://mainsdk.dev/docs/integrations/getqr-id) and [Cloudinary](https://mainsdk.dev/docs/integrations/cloudinary)
