Tests
WebCodecs vs. ffmpeg.wasm: How Long Does It Take to Shrink a Video in the Browser?
VeryEasyTools · 4 min read
How this was measured
- Devices
- Mac (Chrome); iPhone 17 (Safari, Chrome and the in-app browser of KakaoTalk, a Korean messaging app)
- Files
- 1080p H.264, 60 s, 85 MB; 1080p HEVC, 61 s, 66 MB; 4K H.264 and HEVC, 77 s, 238 MB and 468 MB
- Method
- Time to shrink the same file so its short side is 720 pixels. Ranges come from repeated runs.
- Measured
- October 21, 2026
To shrink or convert a video inside a web page, the browser has to decode it, resize it and encode it again. There’s nothing to install, which is convenient, but it raises an obvious worry: won’t it be slow? Before building the video compressor on this site, I measured how long it takes.
Two ways to process video in a browser
ffmpeg.wasm is ffmpeg, the workhorse of video software, compiled to run in a browser. It opens almost any format, but it does all the work in software on the CPU. It can’t use the dedicated video chip in your phone or laptop.
WebCodecs is a browser feature that lends the device’s video hardware (its hardware decoder and encoder) to a web page. The same chip a phone uses to record and play 4K becomes available to the page. The catch is that it only handles formats the device and browser support. This site uses Mediabunny, an open-source library that makes WebCodecs easier to work with.
On the Mac, WebCodecs was about 5 to 16 times faster
Mac, Chrome · 1080p H.264, 60 s
iPhone, Safari · 1080p HEVC, 61 s
iPhone, Chrome · 4K HEVC, 77 s
Shrinking a 1-minute 1080p video on the Mac took ffmpeg.wasm 95 seconds, 1.6 times the length of the video. WebCodecs took 6–20 seconds, or 10–33% of its length. A 1080p video shot on the iPhone (61 seconds) took 21 seconds with WebCodecs, about a third of its length.
All results
| Device | Video | WebCodecs | ffmpeg.wasm |
|---|---|---|---|
| Mac, Chrome | 1080p H.264, 60 s, 85 MB | 6–20 s (0.1–0.33×) | 95 s (1.59×) |
| iPhone, Safari | 1080p HEVC, 61 s, 66 MB | 21 s (0.35×) | 65 s (1.06×) |
| iPhone, Safari/Chrome | 4K H.264, 77 s, 238 MB | 146–149 s (1.9×) | 220–235 s (2.8–3.0×) |
| iPhone, Chrome | 4K HEVC, 77 s, 468 MB | 148–162 s (1.9–2.1×) | 360 s (4.65×) |
| iPhone, KakaoTalk | 4K H.264, 77 s, 238 MB | 147–175 s | 217 s |
The figure in parentheses is the time as a multiple of the video’s length. Below 1× means it finished faster than the video plays.
Why 4K is so much slower
Even with WebCodecs, 4K video took about twice its own length. One 4K frame is four times the size of a 1080p frame, yet the time grew by more than that. The video chip decodes quickly, but scaling each decoded frame down to 720p gets heavy at large sizes. Millions of pixels have to be recalculated for every frame, so the bigger the picture, the more time this step eats.
So a video shot on an iPhone at the default 1080p is done in about 20 seconds per minute of footage, while a 4K video keeps you waiting for minutes. If you have a lot of 4K clips, recording at 1080p saves both storage and time when you shrink them later.
Before you read too much into these numbers
- Devices differ. WebCodecs uses the device’s video chip, so two iPhones with different chip generations will get different results. Android varies even more by maker and chip. The numbers above are from the devices tested.
- Why the Mac results vary so much. WebCodecs on the Mac varied from 6 to 20 seconds. The likely reasons are that the first run spends time setting up the video chip, and that other tabs or apps using the chip slow it down. So the figure is a range across several runs.
- Quality isn’t identical either. Hardware encoders give up some compression efficiency for speed. At the same file size, ffmpeg.wasm (x264) is often a little cleaner. This site narrows the gap by setting the bitrate directly to hit the target size.
What I learned from using it
- The iPhone converts your video before you even start. When you pick a video from the photo library, by default the iPhone converts HEVC to H.264 before handing it to the web page. That’s what the progress circle in the picker is doing. In the picker, tap ⋯ → Options → Current (if there’s no ⋯, tap Options) to hand over the original and skip that wait.
- Switching apps interrupts the work. The iPhone takes back the video chip from a page that is no longer on screen. Opening another app partway through stopped the job with a “Decoder failure” error.
- The same quality setting gives different sizes. With the same medium setting, a hardware encoder produced 7 MB, a software encoder 11 MB and ffmpeg.wasm 6 MB. Each encoder interprets the setting its own way, so hitting a target size meant setting the bitrate (data per second) directly.
What I decided
The video compressor tries WebCodecs first, tries once more if that fails, and only then falls back to ffmpeg.wasm. Formats the browser can’t open, such as AVI, go to ffmpeg.wasm from the start. If the job stopped because you left the page, it doesn’t switch to the slower path; it asks you to start again.
I keep both a fast path and a dependable one because browsers still differ in how well they support WebCodecs. Results varied a little between browsers on the same iPhone, and the page opened inside KakaoTalk was the least consistent with WebCodecs, at 147–175 seconds.
Open Compress Video with ?engine=ffmpeg added to the address and it uses ffmpeg.wasm from the start, so you can compare the two on your own videos.