Resize / crop video
Resize and/or crop a video, in the browser only, like video-convert (src/tools/video-convert.ts), because mediabunny decodes and re-encodes through WebCodecs, which Node has no equivalent of. Always outputs MP4. Nothing is uploaded.
Runs on your device. The file is never uploaded.
Resize / crop video rescales or crops a clip and writes MP4 with a -resized.mp4 ending. Set width or height alone and the other follows the source aspect; set both and the fit option decides, contain by default. Leaving every field blank is refused, and re-encoding needs WebCodecs, which Node lacks, so this one works on the page only.
Questions
Does resizing re-encode the video?
Yes. Changing the picture size means decoding every frame, scaling or cropping it and encoding it again, all through WebCodecs. That costs one generation of quality and takes real time on long files. There is no way to resize without re-encoding, which is why this tool is browser only while Trim, Merge and Rotate are not.
How do the width, height and fit options work together?
Set width alone or height alone and the other dimension follows the source aspect ratio. Set both and the fit option decides the rest: contain (the default) fits inside the box, cover fills it, fill stretches. Every value is in pixels and must be a positive number. Leave both blank and only the crop region is applied.
How do I crop a region?
Fill in cropWidth and cropHeight, plus cropX and cropY for the left and top offsets, which default to 0. cropWidth and cropHeight must be set together, and the tool says "cropWidth and cropHeight must be set together" if only one is filled in. You can crop and resize in the same run: the crop is applied first, then the target size.
Why did it say there is nothing to resize or crop?
Because you left every field blank. The tool refuses with "specify at least a width, a height, or a crop region" rather than spending minutes re-encoding a file into an identical copy. Fill in at least one of width, height, or a crop region and run it again.
What format do I get out?
Always MP4. The output format is fixed, so a WebM or MOV input comes back as MP4, named after your input with -resized.mp4 on the end. Both a resize and a crop produce that same single file. Because the frames are re-encoded, the video codec is whatever your browser can encode into MP4, not necessarily the one the source used.
Why does the command line refuse it?
Because it decodes and re-encodes through WebCodecs, which Node has no equivalent of. The CLI and MCP surfaces stop it up front with "video-resize-crop needs a browser (OffscreenCanvas). Use it at /video/video-resize-crop instead." On that page the work happens in a Web Worker in your tab, and the file is never uploaded.