Published
What moves, and what does not
Fileboy handles on-demand video: you upload a file, it encodes it for streaming, and you play it with a player, an iframe or a link. It does not do live streaming or DRM, streams up to 1080p, and has less detailed playback analytics than Mux. The Fileboy and Mux comparison goes through the differences. If you depend on any of those, stay on Mux for them.
Moving needs each video's file back out of Mux, uploading it to Fileboy (which encodes it again), and swapping the player and anything that stores a Mux ID.
uploadFileFromUrl is for files and images. Videos go up with the Node library's uploadVideoFromPath, which is what the script below uses. Check your video count and storage against the plan first: the plan's video allowance is a guide that never stops an upload, but storage and file limits do.
1. Map your addresses
https://stream.mux.com/PLAYBACK_ID.m3u8becomeshttps://api.fileboy.io/videos/VIDEO_ID/manifest?type=hls.https://image.mux.com/PLAYBACK_ID/thumbnail.jpgbecomeshttps://api.fileboy.io/videos/VIDEO_ID/poster. Roughly: Fileboy picks the poster frame for you, or you can upload your own.- A Mux Player or an HLS player with the playback ID becomes
<fileboy-player video-id="VIDEO_ID">, or the iframe athttps://fileboy.io/video/embed/VIDEO_ID. - The
video.asset.readywebhook becomesvideo.ready. Roughly: the payloads differ, so check yours against the webhook docs.
Playback IDs and video IDs are different things, so you need a map from each Mux asset to its new Fileboy video ID. Signed playback maps onto Fileboy's signed URLs, which you sign differently.
2. Get a downloadable file for each video
Fileboy needs the video file. Mux stores streaming renditions, so for each asset you need a downloadable MP4. How you get one depends on how the asset was created and on Mux's current options, so check Mux's documentation for MP4 support (it has used the names static renditions and MP4 support) and make sure it is on for the assets you want to move.
If you still have the original files you uploaded to Mux, use those instead: they are the best quality, and you skip this step.
3. Import with the HTTP API
The script lists your Mux assets, downloads each MP4 to a temporary file (so a long video is not held in memory), and uploads it with uploadVideoFromPath and the private key. Files of 50 MiB and up go in parts, each retried. The answer holds the new video's id, and encoding then runs in the background. The map is written after every video, and assets already in it are skipped, so you can run the script again after it stops.
import fs from "node:fs"
import os from "node:os"
import path from "node:path"
import { Readable } from "node:stream"
import { pipeline } from "node:stream/promises"
import Mux from "@mux/mux-node"
import { Fileboy } from "@cd2/fileboy-node"
const mux = new Mux() // reads MUX_TOKEN_ID and MUX_TOKEN_SECRET from the environment
// The private key: uploads from a server send no Origin, so they need it
const fileboy = Fileboy({
publicKey: process.env.FILEBOY_PUBLIC_KEY,
privateKey: process.env.FILEBOY_PRIVATE_KEY,
})
// Carry on from an earlier run: assets already in the map are skipped
const map = fs.existsSync("mux-map.json") ? JSON.parse(fs.readFileSync("mux-map.json", "utf8")) : {}
const failed = []
for await (const asset of mux.video.assets.list()) {
const playbackId = asset.playback_ids?.[0]?.id
if (!playbackId || map[asset.id]) continue
const tmp = path.join(os.tmpdir(), asset.id + ".mp4")
try {
// Needs MP4 support turned on for the asset in Mux
const source = await fetch("https://stream.mux.com/" + playbackId + "/highest.mp4")
if (!source.ok) throw new Error("No MP4 (" + source.status + ")")
await pipeline(Readable.fromWeb(source.body), fs.createWriteStream(tmp))
const video = await fileboy.uploadVideoFromPath(tmp, {
name: asset.id,
metadata: { muxAssetId: asset.id },
resumable: true,
})
map[asset.id] = video.id
fs.writeFileSync("mux-map.json", JSON.stringify(map, null, 2))
console.log(asset.id + " -> " + video.id)
} catch (error) {
failed.push(asset.id)
console.error(asset.id, error.message)
} finally {
fs.rmSync(tmp, { force: true })
}
}
console.log("Failed: " + failed.length, failed)A sketch to adapt. The Fileboy calls are the library's. The Mux SDK call and the highest.mp4 address are Mux's, so check its documentation for the current names and for signed playback IDs, which need a token. It runs one video at a time: try it on two or three first. The upload size limit is 5 GB.
Each video also keeps its Mux ID in its metadata, so if mux-map.json is lost you can still find which Mux assets are already in. The management guide shows listing and deleting videos from your server.
4. Check the import
A video exists as soon as the upload completes, but it is encoded in the background. Poll GET /videos/{id}/data until extractionStatus is done. That endpoint needs no key.
import { readFileSync } from "node:fs"
const map = JSON.parse(readFileSync("mux-map.json", "utf8"))
for (const [muxId, videoId] of Object.entries(map)) {
const res = await fetch("https://api.fileboy.io/videos/" + videoId + "/data")
const { data } = await res.json()
console.log(muxId, data.extractionStatus, data.duration)
}- Count: the map should have one entry per Mux asset you meant to move.
- Status: every video should reach
done. If one showserror, itsstatusMessagesays why, and you can retry it from your server withretryVideo. - Duration: compare each
durationwith the asset's duration in Mux. A big difference means a bad download. - Playback: play a sample in
<fileboy-player>on a phone and a computer, with captions, if you had them.
5. Cut over
- Add a column for the Fileboy video ID, and fill it from
mux-map.json. Keep the Mux ID until you have finished. - Set the privacy of the new videos to match the old (public, or signed URLs), and set your embed domains.
- Swap the player:
<fileboy-player video-id="VIDEO_ID">or the iframe embed, on one page first. - Point your webhook handler at Fileboy's
video.ready, and verify the signature of every request. - Send new uploads to Fileboy before you re-run the import for the last few.
- Keep Mux for a few weeks and check your player logs for traffic still using it. Then delete assets in Mux, last, and keep a copy of the map.
Checked against the current libraries in November 2026. Found something that no longer works? Tell us.