-
Notifications
You must be signed in to change notification settings - Fork 32
Decoder crashs when using files encoded by opus-recorder #16
Comments
Can you provide a sample file if you got one? |
I've attached a test file. It has to be renamed before because of the file type restrictions. |
Btw. I tested in on Linux (Ubuntu 14.04) and it also crashed node (4.4.4). |
After some investigation I noticed that the libopus version of node-opus is pretty old (1.1 Beta from 2014). If you use the opusinfo command line tool you can also see those 44100Hz. By the way opusdec tool plays the ogg-opus file successfully but it also shows several errors before ("Error playing audio"). Now I try to debug node-opus in Visual Studio. Using the problematic file I get an exception because it tries to access a reference to the decoder which doesn't exist (dec is null): |
Ok, the print of the 44100Hz is not so weird because it's the original input frequency that is preserved in the opus header as metadata, independent from the encoding frequency. |
I've found the issue. Btw. this output frequency is totally independent from any original or encoding frequency. So if you e.g. encoded a 44100Hz source at full band with 48000Hz you can still set the decoding freq. to 16000Hz if required. That's why your assumption in the sample code: |
Took me ages to get back to this. Was under allergies the week this was reported and then I kept pushing it away. I updated opus to 1.1.2 and added some error checks for encoder/decoder creation and the opus _ctl function return value. This shouldn't "fix" the issue of the encoder not working with bad bitrates but it should maybe give better error message and not crash. Sorry for the delays. 😒 |
Apparently even if you specified the decode frequency, it wasn't used. 😥 #21 should fix this as well. |
Hello,
I am trying to decode ogg-opus files encoded by opus-recorder (a RecorderJS fork by Chris-Rudmin) with the help of node-opus. Unfortunately it crashes node. The output of the format event seems also to be weird because it's always showing 44100Hz independent from my chosen encoder settings on the client, which isn't a valid rate for opus at all.
The files created by opus-recorder work fine in the browser and also in VLC.
Btw. ogg-opus doesn't crash on all files. So e.g. the included 'input.opus' works as expected.
I have no idea where to look for the problem. The native binaries are gyp-compiled on Windows using the version delivered.
It can be easily tested using opus-recorder's decoder example that does some microphone recording and stores it to a blob that can be saved to a file. Using this file with the alsa example (or a modified version that puts all data to a file stream) on node leads to the crash.
Thanks,
Robbson
The text was updated successfully, but these errors were encountered: