Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: The compressed data passed is corrupted #162

Open
mkygogo opened this issue Sep 29, 2024 · 1 comment
Open

TypeError: The compressed data passed is corrupted #162

mkygogo opened this issue Sep 29, 2024 · 1 comment
Labels
bug Something isn't working need repro

Comments

@mkygogo
Copy link

mkygogo commented Sep 29, 2024

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: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

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)

@mkygogo mkygogo added bug Something isn't working need repro labels Sep 29, 2024
@nyapat
Copy link

nyapat commented Sep 30, 2024

opus uses 2 channels, see https://github.com/discordjs/opus/blob/main/README.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro
Projects
None yet
Development

No branches or pull requests

2 participants