Comparing version 0.0.7 to 0.0.8
{ | ||
"name": "mediaplex", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"main": "index.js", | ||
@@ -24,6 +24,7 @@ "types": "index.d.ts", | ||
"@evan/opus": "^1.0.2", | ||
"@evan/wasm": "^0.0.95", | ||
"@napi-rs/cli": "^2.16.3", | ||
"@types/node": "^20.6.0", | ||
"ava": "5.3.1", | ||
"benny": "^3.7.1", | ||
"mitata": "^0.1.6", | ||
"opusscript": "^0.1.0" | ||
@@ -67,13 +68,13 @@ }, | ||
"optionalDependencies": { | ||
"mediaplex-win32-x64-msvc": "0.0.7", | ||
"mediaplex-darwin-x64": "0.0.7", | ||
"mediaplex-linux-x64-gnu": "0.0.7", | ||
"mediaplex-darwin-arm64": "0.0.7", | ||
"mediaplex-android-arm64": "0.0.7", | ||
"mediaplex-win32-arm64-msvc": "0.0.7", | ||
"mediaplex-linux-arm-gnueabihf": "0.0.7", | ||
"mediaplex-freebsd-x64": "0.0.7", | ||
"mediaplex-win32-ia32-msvc": "0.0.7", | ||
"mediaplex-darwin-universal": "0.0.7" | ||
"mediaplex-win32-x64-msvc": "0.0.8", | ||
"mediaplex-darwin-x64": "0.0.8", | ||
"mediaplex-linux-x64-gnu": "0.0.8", | ||
"mediaplex-darwin-arm64": "0.0.8", | ||
"mediaplex-android-arm64": "0.0.8", | ||
"mediaplex-win32-arm64-msvc": "0.0.8", | ||
"mediaplex-linux-arm-gnueabihf": "0.0.8", | ||
"mediaplex-freebsd-x64": "0.0.8", | ||
"mediaplex-win32-ia32-msvc": "0.0.8", | ||
"mediaplex-darwin-universal": "0.0.8" | ||
} | ||
} |
@@ -61,3 +61,3 @@ # Mediaplex | ||
This will output an object containing information about the media file, including the number of channels, sample rate, codec, duration, and metadata. | ||
The default probe size is `10MB`, but you can adjust this as needed by passing the second argument to `probeStream`: | ||
The default probe size is `2MB`, but you can adjust this as needed by passing the second argument to `probeStream`: | ||
@@ -72,10 +72,5 @@ ```js | ||
// add a note | ||
> ⚠️ | ||
> Probing a stream is non-blocking as it is done in a worker thread. But probing a buffer is a blocking operation. | ||
## Opus Encoder | ||
Mediaplex also includes an Opus encoder/decoder. Here's an example: | ||
Mediaplex also includes an Opus encoder/decoder, which can be used as a drop-in replacement for [`@discordjs/opus`](https://github.com/discordjs/opus). Here's an example on how to use it: | ||
@@ -95,58 +90,54 @@ ```js | ||
#### Opus Benchmarks | ||
#### Opus benchmark with other equivalent libraries | ||
Mediaplex includes benchmarks for the opus encoder/decoder. Here are the results of the benchmarks on a Windows 11 machine with an i7-8700 3.2GHz processor: | ||
```js | ||
$ yarn benchmark | ||
Running "OpusEncoder Benchmark" suite... | ||
cpu: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz | ||
runtime: node v20.6.1 (x64-win32) | ||
mediaplex: | ||
3 538 ops/s, ±0.63% | 15.96% slower | ||
benchmark time (avg) (min … max) p75 p99 p995 | ||
------------------------------------------------------------ ----------------------------- | ||
• OpusEncoder | ||
------------------------------------------------------------ ----------------------------- | ||
mediaplex 522.67 µs/iter (506.8 µs … 816.2 µs) 521.5 µs 645.6 µs 726.6 µs | ||
@discordjs/opus 679.61 µs/iter (671.3 µs … 799.9 µs) 677.8 µs 750.2 µs 770.9 µs | ||
opusscript 306.86 µs/iter (281.9 µs … 894.8 µs) 299.3 µs 619.8 µs 695.5 µs | ||
opusscript (no wasm) 4.36 ms/iter (4.09 ms … 6.08 ms) 4.49 ms 4.94 ms 6.08 ms | ||
@evan/opus 494.32 µs/iter (479.6 µs … 754.2 µs) 495.2 µs 632.9 µs 694.2 µs | ||
@evan/opus (wasm) 850.82 µs/iter (800.7 µs … 1.93 ms) 841.3 µs 1.46 ms 1.61 ms | ||
@evan/wasm 869.24 µs/iter (821.7 µs … 1.61 ms) 852.4 µs 1.39 ms 1.48 ms | ||
@discordjs/opus: | ||
3 168 ops/s, ±0.53% | 24.75% slower | ||
summary for OpusEncoder | ||
opusscript | ||
1.61x faster than @evan/opus | ||
1.7x faster than mediaplex | ||
2.21x faster than @discordjs/opus | ||
2.77x faster than @evan/opus (wasm) | ||
2.83x faster than @evan/wasm | ||
14.22x faster than opusscript (no wasm) | ||
@evan/opus: | ||
3 283 ops/s, ±0.25% | 22.02% slower | ||
cpu: Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz | ||
runtime: node v20.6.1 (x64-win32) | ||
@evan/opus (wasm): | ||
2 242 ops/s, ±0.39% | 46.75% slower | ||
benchmark time (avg) (min … max) p75 p99 p995 | ||
------------------------------------------------------------ ----------------------------- | ||
• OpusDecoder | ||
------------------------------------------------------------ ----------------------------- | ||
mediaplex 57.54 µs/iter (49.6 µs … 944.4 µs) 55.3 µs 103.4 µs 116.5 µs | ||
@discordjs/opus 49.85 µs/iter (45.7 µs … 483.6 µs) 48.5 µs 134.7 µs 140.5 µs | ||
opusscript 82.25 µs/iter (75 µs … 540.6 µs) 81.1 µs 143.4 µs 157 µs | ||
opusscript (no wasm) 230.88 µs/iter (202.9 µs … 2.05 ms) 215.3 µs 532.3 µs 594.9 µs | ||
@evan/opus 49.16 µs/iter (45.7 µs … 827.6 µs) 47.7 µs 132.6 µs 137 µs | ||
@evan/opus (wasm) 71.71 µs/iter (64.5 µs … 426.9 µs) 67.6 µs 208.1 µs 230.4 µs | ||
@evan/wasm 77.3 µs/iter (71.9 µs … 383.6 µs) 74.4 µs 162.4 µs 169.4 µs | ||
opusscript: | ||
4 210 ops/s, ±0.20% | fastest | ||
opusscript (no wasm): | ||
245 ops/s, ±3.69% | slowest, 94.18% slower | ||
Finished 6 cases! | ||
Fastest: opusscript | ||
Slowest: opusscript (no wasm) | ||
Running "OpusDecoder Benchmark" suite... | ||
mediaplex: | ||
10 726 ops/s, ±0.50% | 9.42% slower | ||
@discordjs/opus: | ||
11 841 ops/s, ±0.55% | fastest | ||
@evan/opus: | ||
11 382 ops/s, ±0.46% | 3.88% slower | ||
@evan/opus (wasm): | ||
7 461 ops/s, ±0.32% | 36.99% slower | ||
opusscript: | ||
6 138 ops/s, ±0.38% | 48.16% slower | ||
opusscript (no wasm): | ||
2 252 ops/s, ±0.73% | slowest, 80.98% slower | ||
Finished 6 cases! | ||
Fastest: @discordjs/opus | ||
Slowest: opusscript (no wasm) | ||
summary for OpusDecoder | ||
@evan/opus | ||
1.01x faster than @discordjs/opus | ||
1.17x faster than mediaplex | ||
1.46x faster than @evan/opus (wasm) | ||
1.57x faster than @evan/wasm | ||
1.67x faster than opusscript | ||
4.7x faster than opusscript (no wasm) | ||
``` | ||
These benchmarks compare the performance of Mediaplex's Opus encoder/decoder to other popular Opus libraries. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
7770334
434
8
1944
141