Home / Media and Real Time / Browser Video Editor

Browser Video Editor in JavaScript, Free with Live Demo

Free browser video editor in plain JavaScript. Trim a clip, add a filter and a title, and export a real MP4 with the WebCodecs VideoEncoder. No upload.

Open live demoDownload HTML fileView code on GitHub
Browser Video Editor JavaScript project: trim a clip, add a filter and a title, and export an MP4

Runs on: WebCodecs VideoEncoder. WebCodecs: Chrome, Edge, Safari 17+ and Firefox 130+ on desktop. Audio is not included in the export in this version.

What is the Browser Video Editor?

Load a video, drag two handles to trim it, pick a color filter, add a title and export an MP4. Every frame is processed and encoded inside your browser, so the video is never uploaded.

The page plays the clip and grabs each frame, draws it on a canvas with the filter and title, and sends it to the WebCodecs VideoEncoder. The mp4-muxer library packs the encoded frames into an MP4 file.

Good for

  • Quick social clips
  • Trimming screen recordings
  • Learning WebCodecs
  • Building a custom video tool

What this project does

How it works

  1. Pick framesThe video plays from the in point to the out point. requestVideoFrameCallback hands over each frame as it is shown.
  2. Edit the frameEach frame is drawn on a canvas with the filter and title, then wrapped in a VideoFrame with its timestamp.
  3. Encode and packVideoEncoder compresses the frames. mp4-muxer puts the chunks into an MP4 file you can download.

The key JavaScript

This is the heart of the project. The full file has the rest, including the screen layout and error handling.

import { Muxer, ArrayBufferTarget } from "https://cdn.jsdelivr.net/npm/mp4-muxer@5.2.2/+esm";

const muxer = new Muxer({ target: new ArrayBufferTarget(), video: { codec: "avc", width, height }, fastStart: "in-memory" });
const encoder = new VideoEncoder({ output: (chunk, meta) => muxer.addVideoChunk(chunk, meta), error: console.error });
encoder.configure({ codec: "avc1.42001f", width, height, bitrate: 4e6, framerate: 30 });

video.requestVideoFrameCallback(function onFrame(now, info) {
  ctx.drawImage(video, 0, 0);                                   // plus filter and title
  const frame = new VideoFrame(canvas, { timestamp: (info.mediaTime - start) * 1e6 });
  encoder.encode(frame, { keyFrame: n++ % 60 === 0 }); frame.close();
  video.requestVideoFrameCallback(onFrame);
});

How to use it

  1. Click Download HTML file above.
  2. Open the file in a code editor, like VS Code.
  3. Run it from a local server with npx serve . so the camera, microphone and AI features are allowed.
  4. Change the text and colors, then upload it to GitHub Pages, Netlify or your own site. It is one file with no build step.

Questions people ask

What is WebCodecs?

It is a browser API that gives JavaScript direct access to video and audio encoders and decoders. It is much faster than older canvas recording tricks.

Is audio included in the export?

Not in this version. The video track is exported. Audio can be added with AudioEncoder in the same way.

Which codec does it use?

It picks the first your browser can encode: H.264, then VP9, then AV1.

More Media and Real Time projects