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:
1 parent
3c2a646365
commit
ac47545aa3
10 files changed
+35
-14
No files matched your search
+1
-2
@@ -22,8 +22,7 @@ print(string.format("edited: %d frames, %.2f s, peak %.2f", both.frames, both.fr
|
||||
-- 3. encode: lossless and lossy
|
||||
for _, fmt in { "wav", "flac", "mp3", "vorbis", "opus" } do
|
||||
local opts = { format = fmt }
|
||||
if fmt == "mp3" then opts.bitrate = 128 end -- kbit/s
|
||||
if fmt == "opus" then opts.bitrate = 64000 end -- bit/s
|
||||
if fmt == "mp3" or fmt == "opus" then opts.bitrate = 128000 end -- bit/s (values below 1000: kbit/s)
|
||||
local bytes = assert(F.save(both, nil, opts))
|
||||
local dec = assert(F.audio.open(bytes))
|
||||
print(string.format("%-6s %6d bytes %5d Hz %d ch %.2f s title=%s", fmt, buffer.len(bytes), dec.sampleRate, dec.channels,
|
||||
|
||||
Reference in new issue
Block a user