ws-apifix: one bitrate unit: every encoder's bitrate option is bit/s (MP3 now too), values below 1000 are kbit/s (the old MP3 values keep working; Opus accepts them too); the MP3 Decoder's bitrate field is bit/s as the Decoder contract says (was kbit/s)

This commit is contained in:
4DBug committed 2026-10-31 14:06:51 -05:00
1 parent 3c2a646365
commit ac47545aa3
10 files changed
+35 -14

No files matched your search

+2 -2
View File
@@ -193,7 +193,7 @@ Every call takes an optional `opts` table. The options every format understands:
| `maxPixels`, `maxBytes`, `maxFrames`, ... | size limits; going over returns `LIMIT` |
Each format adds its own options, such as `quality` for JPEG, `lossless` for WebP, `level` for PNG and zip, or
`bitrate` for MP3. The type pages list them.
`bitrate` (bits per second) for MP3 and Opus. The type pages list them.
```luau
local img = assert(F.load(pngBytes))
@@ -252,7 +252,7 @@ file instead of returning a buffer.
```luau
local webp = assert(F.convert(pngBytes, "webp", { lossless = true }))
local mp3 = assert(F.convert(wavBytes, "mp3", { bitrate = 128 }))
local mp3 = assert(F.convert(wavBytes, "mp3", { bitrate = 128000 }))
assert(F.detect(webp) == "webp" and F.detect(mp3) == "mp3")
```