How does it compress without a server?
Browsers have a feature called WebCodecs that lets a web page call the device’s video decoder and encoder directly. This tool works in the following order.
- It reads the sample tables from the MP4/MOV header (moov) to find where each frame sits in the file.
- It decodes the frames and, if you asked for it, shrinks the resolution on a canvas.
- It re-encodes them to H.264 with VideoEncoder, giving the encoder an average bitrate as the target (a variable-bitrate approach).
- If the audio is AAC, it is copied as is without re-encoding, and everything is packed into a new MP4 for saving.
The input and output of this process both live in this tab’s memory and are saved through a Blob URL. The page is built not to send any request to a server while compressing. The measured values used for the quality conversion are already built into the page, so the tool does not download any extra data while you use it.
How to check that nothing is uploaded
- With this page open, press F12 to open the developer tools and open the Network tab. Clear the recorded list once.
- Pick a video and compress it. While it compresses, no request the size of your video (a POST or PUT, or a large transfer) should appear in the list.
- For a stricter check, turn on ‘Offline’ in the Network tab after opening the page, then compress. A tool that needs no server should run to the end.
You can check any other site the same way. What this method verifies is ‘the traffic happening in your browser right now’, which is different from reading the site operator’s promise.
How were the preset qualities chosen?
From the x264 medium results in Measured file size and quality by CRF (four 10-second 1080p25 clips, six CRF steps each), we read, for each clip, the bitrate at which VMAF reaches the target value by connecting the measured points. We convert the bitrate to bits per pixel (bpp = bitrate ÷ width × height × fps) and multiply it by your video’s size and fps to get the target bitrate. Converted at 1080p25, the values are as follows (kbps; ‘–’ means outside the measured range).
| Clip | High quality (VMAF 95) | Balanced (VMAF 90) | Small (VMAF 85) | Very small (VMAF 80) |
|---|
| blue_sky | 1,522 | 1,240 | 1,017 | 880 |
| pedestrian_area | 3,945 | 2,735 | 2,112 | 1,697 |
| riverbed | 15,069 | 12,148 | 10,382 | 9,007 |
| rush_hour | 7,234 | 3,480 | 2,309 | 1,764 |
Even for the same ‘Balanced’ (VMAF 90) target, the bitrate needed differs by up to about 9.8x depending on the clip. That is why this tool does not fix the value from a single preset and instead lets you pick the clip most like your own video. If you are not sure, compare the sizes calculated for a few candidate clips, check the result by eye, and then adjust the preset one step at a time.
How to use it
- Messaging and email attachments: enter a ‘Target size’ a little below the limit. It may not hit the target exactly, so check the output size and, if it is over, lower the value and run it again.
- Shrinking archive footage: run it with ‘High quality’ or ‘Balanced’. If the estimated size is equal to or larger than the source, that video is already compressed enough and is better left alone.
- Reducing resolution: scaling down by the short side lowers the bitrate needed for the same quality target (assuming it scales with the pixel count).
- Checking the result: play the preview to the end and compare the same-timestamp frame with the original in the quality comparison slider. If you need a score, measure it yourself with the VMAF measurement command builder.
- Finer control: if you need presets, CRF or 2-pass, the FFmpeg command builder is the right tool. To only calculate a target size, use the video size and bitrate calculator.
Limits worth knowing
- The VMAF shown is measured on x264 medium, not on this browser’s encoder. Depending on the device and browser, the WebCodecs encoder may be a hardware encoder, and it is known to tend to give lower quality than x264 medium at the same bitrate (How it differs from software). This site has never measured the VMAF of a browser encoder.
- The measurements are from four 10-second 1080p25 8-bit clips, one PC, in CRF mode. Converting to other resolutions and fps assumes ‘the same bits per pixel’, and if you reduce the resolution, VMAF against the original may be lower than this table shows.
- Because it targets an average bitrate, the size may be close while quality drops in high-motion sections. The actual average bitrate can differ from the target, so it is shown separately after completion.
- The input is H.264 or HEVC in a non-fragmented MP4 or MOV. MKV, WebM and fragmented MP4 can’t be read. HEVC works only if this browser can decode it (Codec support check).
- The output is 8-bit H.264 + AAC (copied). HDR and 10-bit sources can look washed out, so files flagged as HDR are blocked. Audio that isn’t AAC is not included.
- Metadata such as shooting location and device info, subtitles, chapters and color tags are not carried over. The rotation info of portrait video is carried over.
- This tool’s encoder may fail to save on devices that use B-frames. For long videos the whole output file is gathered in memory, so results over 4 GB are not saved.
- Speed depends heavily on the device and the encoder (whether it is hardware). The ‘Time taken’ on the completion screen is the value for your device. It may slow down if the browser tab goes to the background.
- This code has not been tested on every device and browser. Be sure to check that the preview plays correctly, and don’t delete the original until you have confirmed it.
Learn more
Why the same quality needs a different bitrate for each clip is covered in Measured CRF by video content, and the basic relationship between bitrate and quality is covered in the course.