# Trim Video

Cut a section out of a video, optionally without re-encoding it, in the browser. Nothing is uploaded.

Runs entirely in the browser through WebCodecs and WebAssembly. No upload, no account, no size limit
imposed by a plan, no watermark — because there is no server involved.

Page: https://life2film.com/tools/video-trimmer/

## What matters

- Three modes: copy (no re-encode), re-encode (smaller file), and fit a target size.
- Copying passes the picture through untouched: measured 0.20s against 0.60s for a re-encode of the same 3 seconds.
- Playback always starts exactly where you set it, a copied cut does NOT snap to a keyframe.
- A copied mid-group cut carries frames back to the previous keyframe, so it is larger: 6.7 MB copied against 4.1 MB re-encoded on a file with keyframes 8 seconds apart.
- Re-encoding requires forceTranscode: true, or mediabunny will correctly decide the transcode is unnecessary and copy instead.
- Accepts times as 12.5, 1:04 or 1:04.5.

## From code

```js
import { Input, Output, Conversion, BlobSource, BufferTarget, Mp4OutputFormat, ALL_FORMATS } from 'mediabunny';

const input = new Input({ source: new BlobSource(file), formats: ALL_FORMATS });
const output = new Output({ format: new Mp4OutputFormat(), target: new BufferTarget() });

const conversion = await Conversion.init({
  input, output,
  trim: { start: 20, end: 35 },
  // Omit `video` entirely to copy the track through; add
  // { forceTranscode: true } to re-encode for a smaller file.
});
await conversion.execute();
```

## Questions

**Is my video uploaded?**

No. The browser decodes and re-encodes it locally through WebCodecs: the same pipeline it uses to play video. Nothing is sent anywhere, so there is no size limit imposed by a plan, no queue, and no watermark.

**Does trimming lose quality?**

Not in the default mode. "Same quality: no re-encode" passes the picture through untouched, so there is no generation loss and it finishes several times faster, measured at 0.2 seconds against 0.6 for a re-encode of the same clip. The trade is size: video is compressed in groups that begin at a keyframe, so when your in-point falls mid-group the file has to carry the frames back to the previous one. Playback still starts exactly where you set it, but the file can be larger than a re-encode of the same range.

**When should I re-encode instead?**

When you want the smallest file, or a different format. Re-encoding writes only the frames you selected, so a mid-group cut comes out considerably smaller, in testing, 4.1 MB against 6.7 MB for the same three seconds. It costs one generation of compression, which is not visible at the quality used here.

**Can it trim to a target file size?**

Yes, choose "Fit a size" and pick a limit, such as 10 MB for Discord or 25 MB for email. The needed bitrate follows from the length of your selection, so a shorter selection can hold more quality within the same limit. If the first pass misses, it corrects and re-encodes once.

**Is the audio kept?**

Yes, in sync, and trimmed to the same range. You can drop it deliberately with the "remove audio" box, useful when a clip is going somewhere the sound is not wanted, and it makes the file smaller.

**Which files work?**

MP4 and MOV with H.264, and WebM, whatever your browser can both decode and encode. Camera-native formats such as ProRes or raw usually cannot be opened by a browser at all; transcode a proxy first.

**How long can the video be?**

There is no hard cap, but everything happens in a browser tab, so memory is the real limit, the encoded result is held there before it is saved. Files up to a few hundred megabytes are comfortable on a normal laptop; very large ones are better trimmed in passes.

## Related

- [Compress Video](https://life2film.com/tools/video-compressor/): Make a file smaller and see exactly what it cost. No size limit, because there is no server.
- [Video to MP3](https://life2film.com/tools/video-to-mp3/): Pull the audio out of a video and keep it as MP3, WAV or OGG.
- [Convert Video](https://life2film.com/tools/video-converter/): MP4, WebM and MOV in any direction, or pull the audio out as WAV.
- [Video Splitter](https://life2film.com/tools/video-splitter/): Cut a long video into Reels or Shorts that start on a shot change instead of every 30 seconds, ranked by picture quality.
- [BPM Detector](https://life2film.com/tools/bpm-detector/): Find a track’s tempo and the time of every beat, then send the grid to Resolve, Premiere, Final Cut or Audacity as markers.
- [Scene Detector](https://life2film.com/tools/scene-detector/): Find every cut in a video and get the shot list with thumbnails, timecodes and quality scores.

- The engine as a package: https://life2film.com/engine/
- Site overview for agents: https://life2film.com/llms.txt
- Every tool page is available as markdown by appending `.md` to its address, or by requesting it
  with `Accept: text/markdown`.

---
Life2Film — on-device video montage. https://life2film.com/
