Trim, resize, and re-encode a user-uploaded video entirely in the browser before sending to a server
Read metadata like duration, resolution, and audio tracks from a media file without uploading it
Convert an audio file from MP3 to FLAC or a video from MOV to MP4 on the client side
Process large video files on a Node.js or Bun server without loading them entirely into memory
No external dependencies, install via npm. WebCodecs requires a modern browser (Chrome/Edge), Node.js server use needs a companion package.
Mediabunny is a JavaScript library that lets web applications read, write, and convert video and audio files directly inside a browser, without sending anything to a server. It supports formats like MP4, WebM, MOV, MP3, FLAC, and HLS, and it can encode and decode more than 25 different video and audio codecs. The library is written in TypeScript from scratch and has no external dependencies. The main use cases are: reading metadata from a media file (duration, resolution, audio channels, tags), creating new video or audio files programmatically, and converting between formats. For example, a web app could take a video file the user selects, trim it, resize it, and export it as a different format, all without leaving the browser tab. Precision is down to the microsecond for operations like trimming. The library uses a browser API called WebCodecs for hardware-accelerated encoding and decoding, meaning it can process video efficiently on modern devices rather than doing everything in slow JavaScript. It is also tree-shakable: build tools can include only the parts your application actually uses, keeping file sizes small. The minimum footprint is around 5 kilobytes compressed. It works not just in browsers but also in server-side JavaScript runtimes such as Node, Bun, and Deno through a companion package. Reading and writing is done in a streaming fashion, which means it handles large files without loading everything into memory at once. The project is open-source under the Mozilla Public License 2.0, which allows both personal and commercial use including in closed-source products. It is maintained by a single developer and sustained through sponsorships from companies in the video tooling space.
← vanilagy on gitmyhub — every repo by this author, as a profile.
Verify against the repo before relying on details.