Add performance comparison

This commit is contained in:
Jerome Wu 2023-08-20 11:16:33 +08:00
parent 8e458ade72
commit a19ce28c01
4 changed files with 40 additions and 0 deletions

View File

@ -31,7 +31,9 @@
const { name } = files[0];
await ffmpeg.writeFile(name, await fetchFile(files[0]));
message.innerHTML = 'Start transcoding';
console.time('exec');
await ffmpeg.exec(['-i', name, 'output.mp4']);
console.timeEnd('exec');
message.innerHTML = 'Complete transcoding';
const data = await ffmpeg.readFile('output.mp4');

View File

@ -31,7 +31,9 @@
const { name } = files[0];
await ffmpeg.writeFile(name, await fetchFile(files[0]));
message.innerHTML = 'Start transcoding';
console.time('exec');
await ffmpeg.exec(['-i', name, 'output.mp4']);
console.timeEnd('exec');
message.innerHTML = 'Complete transcoding';
const data = await ffmpeg.readFile('output.mp4');

View File

@ -0,0 +1,35 @@
# Performance
ffmpeg.wasm uses transpiled FFmpeg C source code to WebAssembly code, it is for
certain that ffmpeg.wasm won't perform as good as FFmpeg as it is not fully
optimized at the moment. (Even in ffmpeg.wasm multithread version). In this
section we provide a short comparison, so that you can make decision based on your
needs:
## Environment
- CPU: 8 × 11th Gen Intel® Core™ i5-1135G7 @ 2.40GHz
- Memory: 15.6 GiB of RAM
- OS: Manjaro Linux 6.1.44-1-MANJARO (64-bit)
- Browser: Google Chrome Version 116.0.5845.96 (Official Build) (64-bit)
- FFmpeg: n5.1.2
## Comparison
Setup:
- Each command is executed 5 times.
- Only `ffmpeg.exec()` time is measured.
- Candidates
- FFmpeg: [native FFmpeg](https://hub.docker.com/r/linuxserver/ffmpeg),
considered as baseline.
- core: ffmpeg.wasm single thread version.
- core-mt: ffmpeg.wasm multi thread version.
### $ ffmpeg -i [input.webm](https://test-videos.co.uk/vids/bigbuckbunny/webm/vp8/720/Big_Buck_Bunny_720_10s_1MB.webm) output.mp4
| # | FFmpeg | core v0.12.2 | core-mt v0.12.2 |
| --- | ------ | ------------ | --------------- |
| Avg | 5.2 sec | 128.8 sec (0.04x) | 60.4 sec (0.08x) |
| Max | 5.3 sec | 130.7 sec | 63.9 sec |
| Min | 5.1 sec | 126.6 sec | 59 sec |

View File

@ -28,6 +28,7 @@ const sidebars = {
"getting-started/examples",
],
},
"performance",
"migration",
"faq",
{