Skip to Content

Command line

The clipmux binary and the npx @clipmux/node commands, with every flag.

There are two command lines. clipmux is the server's own binary: it runs the server and workers, and administers an instance from its host. npx @clipmux/node runs inside your app's project, against a server.

clipmux

clipmux serve     API, dashboard, scheduler and built-in delivery
clipmux worker    run a worker (agent mode; --once for serverless)
clipmux push      upload files through the API
clipmux listen    forward webhooks to a local URL
clipmux admin     host-side administration (keys, webhooks, reset-password)
clipmux version   print the version

Every setting is an environment variable; see Environment variables.

clipmux serve

Runs the API, the dashboard, the scheduler and built-in delivery, and starts a worker as its child unless CLIPMUX_BUILTIN_WORKER=false. It takes no flags. It migrates the database on start, prints a setup token on first boot, and on a stop signal drains requests and waits for its loops before it exits.

clipmux worker

Claims and runs media jobs: a PC agent, the built-in worker, or a serverless machine.

clipmux worker --server URL              connect this PC (approve it in the dashboard)
clipmux worker --server URL --pair CODE  connect with a code from clipmux admin create-pairing
clipmux worker                           run, once this PC is connected
clipmux worker doctor [--offline]        check everything this PC needs (--offline: before pairing)
CLIPMUX_WORKER_KEY=KEY clipmux worker --server URL [--once]
FlagDefaultWhat it does
--server URLCLIPMUX_SERVER, else http://127.0.0.1:8080The server's public URL.
--pair CODEConnect this PC with a pairing code from clipmux admin create-pairing.
--name NAMEthe hostnameWhat to call this PC.
--oncefalseRun at most one job, then exit (serverless).
--work-dir DIRa clipmux-worker temporary directoryScratch space for attempts.
--encoder MODECLIPMUX_ENCODER, else autoThe first encoder to try: auto, nvenc, vaapi, cuda-decode or cpu. The CPU always backs it up.
--speech MODECLIPMUX_SPEECH, else autoTranscribe subtitles: auto (a GPU, or a CPU with 4+ cores and 6 GiB), off, cpu, vulkan or cuda.
--sandboxfalseConfine ffmpeg and the packager (Linux). Agents always do, unless --unsandboxed.
--unsandboxedfalseRun an agent's tools unconfined. It then gets only its own local jobs and the owner's uploads.
--storage-via-serverfalseFetch and upload signed storage URLs through --server, as the built-in worker does.

A connected PC keeps its server and key in agent.json under CLIPMUX_AGENT_DIR, so the key never shows in a process listing.

clipmux push

Uploads files through the API, resuming an interrupted upload. It reads the app's API key from CLIPMUX_API_KEY, never from a flag.

CLIPMUX_API_KEY=cmx_… clipmux push --server https://video.example.com lesson-42.mp4
FlagDefaultWhat it does
--server URLCLIPMUX_SERVERThe server's public URL.
--policy POLICYsignedThe playback policy: signed or public.
--passthrough REFYour own reference, returned in webhooks (one file only).
--renditions LISTevery rung up to the sourceRungs to encode, comma separated, e.g. 1080p,480p.
--waitfalseWait until each video is ready to play.
--quietfalsePrint only the asset and playback IDs.
--localfalseKeep the files on this PC: its agent encodes them and uploads only the outputs.
--upload-sourcefalseWith --local: once encoded, also upload each file, so any worker can re-encode it.

clipmux listen

Forwards the app's webhook events to a local URL while you build, signed so your handler verifies them unchanged. It reads CLIPMUX_API_KEY.

FlagDefaultWhat it does
--server URLCLIPMUX_SERVER, else CLIPMUX_URLThe server's public URL.
--forward-to URLThe local webhook URL, e.g. localhost:3000/webhooks.
--events LISTevery eventThe event types to forward, comma separated.
--since DURATIONAlso replay events from this long ago, e.g. 10m.

clipmux admin

Host-side administration, alongside the dashboard. It reads DATABASE_URL, and where it needs secrets CLIPMUX_DATA_DIR or CLIPMUX_SECRETS_KEY, the same as serve. Each command that makes a secret prints it once.

CommandWhat it does
clipmux admin create-key --app NAME [--name KEY_NAME] [--scopes …] [--allow-loopback]Create an API key for the app (and the app, if it doesn't exist).
clipmux admin create-signing-key --app NAMECreate a signing key and print its private key; only the public key is kept.
clipmux admin create-webhook --app NAME --url URLAdd a webhook endpoint and print its secret.
clipmux admin create-integration --app NAME [--webhook-url URL] [--allow-loopback]All three at once, printed as a .env block to append to the backend's env file.
clipmux admin create-pairing [--app PC-NAME]Make a code for clipmux worker --pair.
clipmux admin rotate-signing-key --app NAMECreate a new signing key and retire the others once the longest token they may have signed has expired.
clipmux admin list-keys --app NAMEList the app's API and signing keys.
clipmux admin revoke-key IDEnd an API key (cmx_… ID) or a signing key (kid_…) at once.
clipmux admin setup-test [--wait] [--timeout 20m]Put the sample through the configured path; with --wait, print the checks and exit 1 unless they all pass.
clipmux admin reset-password < new-password.txtSet the owner's password from stdin and end every dashboard session.
clipmux admin reset-totpTurn off the owner's second factor, for an owner who lost the authenticator and the recovery codes.
clipmux admin migrate status | up | down-to VERSION --yesShow, apply or roll back database migrations.
clipmux admin prune [--dry-run] [--files]Delete rows past their retention windows now; --files also deletes stored files past theirs.
clipmux admin reseal-secretsSeal every stored secret with the current secrets key, when rotating it.
clipmux admin outbox [--retry ID]List side effects still pending after an hour; --retry makes one due at once.
clipmux admin restore [--list] [--latest | --id ID | --file PATH] --yesReplace the database with a backup: the newest, one by ID, or a dump file on this host. Refuses while a serve runs, and a backup that is damaged, newer than this binary or that this install's secrets key doesn't open. Backs up the database it replaces first (kind pre_restore), migrates the restored one and raises the restore fence. Without --yes it only names the backup; --list shows what the target holds.
clipmux admin restore reportList what storage holds that the database doesn't know (route records, output prefixes, sources), and whether the restore fence is up.
clipmux admin restore finish --yesLift the restore fence and stamp every store as this install's. Serve then deletes what the database doesn't know. Read the report first.
clipmux admin backup nowBack up the database now, without migrating it first. Prints the backup's ID, where it went and its SHA-256.
clipmux admin backup listList the backups on the target, read from their manifests, so it works on a host with no database.
clipmux admin backup checkProve the target can be written, read and listed, say whether it refuses deletes, and show the latest backup. Exits 1 when the target doesn't work.
clipmux admin backup verify [--id ID]Verify the newest backup by default or select one by ID. Checks its hash, decrypts it, restores it into a scratch database, and checks the secrets key, content keys and row counts. Records the result and exits 1 if the backup fails.
clipmux admin backup restore-sources --asset ID | --allAfter a store lost files: copy mirrored sources back to the stores they belong on and queue a re-encode for each asset whose source was restored or whose encoded files are gone, through the usual job path. Skips assets deleted after the backup (they have a tombstone); running it again restores nothing twice.
clipmux admin backup prune-sources [--older-than DURATION]Delete the mirrored copies of assets deleted at least that long ago (default 720h), and their tombstones. Needs a backup key that may delete; on an immutable target the bucket's lifecycle rules do this.
clipmux admin backup identityPrint the age identities that open the backups, derived from the secrets key. They are secret: age -d -i <(clipmux admin backup identity) FILE opens a backup without ClipMux.

create-key and create-integration refuse while the public URL is loopback, because signed upload URLs and base_url would point at the server's own machine; --allow-loopback is for local development.

npx @clipmux/node

The SDK's command line, run in your app's project. Every command takes --env-file FILE.

CommandWhat it does
npx @clipmux/node initConnect this app to a server: the owner approves it in the dashboard, and the credentials go to an env file without being printed.
npx @clipmux/node doctorCheck the env file: the server, the API key, the signing key and the webhook secret.
npx @clipmux/node listenForward this app's webhook events to a local URL, signed with CLIPMUX_WEBHOOK_SECRET.
npx @clipmux/node upload FILEUpload a file.
FlagCommandWhat it does
--server URLinitThe server's public URL (default CLIPMUX_URL).
--env-file FILEevery commandWhere to read and write (default .env.local, or .env if it exists).
--name NAMEinitThe name the owner sees (default package.json's name).
--no-openinitPrint the approval URL instead of opening a browser.
--forward-to URLlistenThe local URL, e.g. localhost:3000/api/clipmux/webhook.
--events LISTlistenOnly these event types, comma separated.
--since DURATIONlistenAlso replay events from this long ago, e.g. 10m.
--passthrough REFuploadYour own reference.
--title TITLEuploadThe video's title.
--renditions LISTuploadRungs to encode, e.g. 1080p,480p.
--publicuploadMake a public playback ID instead of a signed one.
--waituploadWait until the video is ready.

On this page