explaingit

vanilagy/mediabunny

5,842TypeScriptAudience · developerComplexity · 2/5LicenseSetup · easy

TLDR

A JavaScript library that lets web apps read, write, and convert video and audio files entirely in the browser, no server needed, supports 25+ codecs including MP4, WebM, MP3, and FLAC.

Mindmap

mindmap
  root((mediabunny))
    What it does
      Read media metadata
      Write and encode video
      Convert file formats
      Stream large files
    Formats Supported
      MP4 WebM MOV
      MP3 FLAC HLS
      25+ codecs
    Tech Stack
      TypeScript
      WebCodecs API
      Node Bun Deno
    Key Features
      No server required
      Tree-shakable
      5kb min footprint
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Trim, resize, and re-encode a user-uploaded video entirely in the browser before sending to a server

USE CASE 2

Read metadata like duration, resolution, and audio tracks from a media file without uploading it

USE CASE 3

Convert an audio file from MP3 to FLAC or a video from MOV to MP4 on the client side

USE CASE 4

Process large video files on a Node.js or Bun server without loading them entirely into memory

Tech stack

TypeScriptWebCodecsNode.jsBunDeno

Getting it running

Difficulty · easy Time to first run · 30min

No external dependencies, install via npm. WebCodecs requires a modern browser (Chrome/Edge), Node.js server use needs a companion package.

Use freely for personal or commercial projects, including in closed-source products, share any modifications to this library's code under the same license. Mozilla Public License 2.0.

In plain English

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.

Copy-paste prompts

Prompt 1
Using the mediabunny library, write a browser JavaScript snippet that lets a user select an MP4 file, trims it to the first 10 seconds, and downloads the result as a new MP4, without any server calls.
Prompt 2
I want to use mediabunny to read the duration, resolution, and codec of a video file the user uploads in a web page. Show me the minimal JavaScript code to extract and display those metadata fields.
Prompt 3
How do I use mediabunny in a Node.js script to convert an MP3 audio file to FLAC? Show the complete script including reading the source file and writing the output.
Prompt 4
I'm building a video editor web app and want to use mediabunny for encoding. How does the WebCodecs integration work and what browsers support it? What fallback should I plan for?
Open on GitHub → Explain another repo

← vanilagy on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.