You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fs.writeFileSync(outputPcmFile, pcmData); **got this error:**G:\AI\llm\xiaozhi-main\asr-server\test\opus_decode.js:15
const pcmData = decoder.decode(opusData);
^
TypeError: The compressed data passed is corrupted
at Object. (G:\AI\llm\xiaozhi-main\asr-server\test\opus_decode.js:15:25)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Issue description
try to test decode opus file, code like this:
`const fs = require('fs');
const { OpusEncoder } = require('@discordjs/opus');
const inputOpusFile = 'input.ogg'//'output.ogg'//'input.opus';
const outputPcmFile = 'output.pcm';
const decoder = new OpusEncoder(48000, 1);
const opusData = fs.readFileSync(inputOpusFile);
const pcmData = decoder.decode(opusData);
fs.writeFileSync(outputPcmFile, pcmData);
**got this error:**
G:\AI\llm\xiaozhi-main\asr-server\test\opus_decode.js:15const pcmData = decoder.decode(opusData);
^
TypeError: The compressed data passed is corrupted
at Object. (G:\AI\llm\xiaozhi-main\asr-server\test\opus_decode.js:15:25)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.12.0`
and the input.ogg file stream info (from ffprobe):
Input #0, ogg, from '.\input.ogg': Duration: 00:00:04.81, start: 0.000000, bitrate: 70 kb/s Stream #0:0: Audio: opus, 48000 Hz, mono, fltp Metadata: encoder : Lavc61.20.100 libopus [STREAM] index=0 codec_name=opus codec_long_name=Opus (Opus Interactive Audio Codec) profile=unknown codec_type=audio codec_tag_string=[0][0][0][0] codec_tag=0x0000 sample_fmt=fltp sample_rate=48000 channels=1 channel_layout=mono bits_per_sample=0 initial_padding=312 id=N/A r_frame_rate=0/0 avg_frame_rate=0/0 time_base=1/48000 start_pts=0 start_time=0.000000 duration_ts=230712 duration=4.806500 bit_rate=N/A max_bit_rate=N/A bits_per_raw_sample=N/A nb_frames=N/A nb_read_frames=N/A nb_read_packets=N/A extradata_size=19 DISPOSITION:default=0 DISPOSITION:dub=0 DISPOSITION:original=0 DISPOSITION:comment=0 DISPOSITION:lyrics=0 DISPOSITION:karaoke=0 DISPOSITION:forced=0 DISPOSITION:hearing_impaired=0 DISPOSITION:visual_impaired=0 DISPOSITION:clean_effects=0 DISPOSITION:attached_pic=0 DISPOSITION:timed_thumbnails=0 DISPOSITION:non_diegetic=0 DISPOSITION:captions=0 DISPOSITION:descriptions=0 DISPOSITION:metadata=0 DISPOSITION:dependent=0 DISPOSITION:still_image=0 DISPOSITION:multilayer=0 TAG:encoder=Lavc61.20.100 libopus
this is the code and ogg file
test.zip
Code sample
No response
Versions
discord/opus : 0.9.0
node : v18.12.0
os: windows 10
Issue priority
Medium (should be fixed soon)
The text was updated successfully, but these errors were encountered: