rillke / opusenc.js Goto Github PK
View Code? Open in Web Editor NEWJavaScript opus encoder
Home Page: https://blog.rillke.com/opusenc.js/
License: Other
JavaScript opus encoder
Home Page: https://blog.rillke.com/opusenc.js/
License: Other
I appear to receive this error when wasm is used (it doesn't happen when using asm):
TypeError: Module.asm._malloc is undefined OpusEncoder.js line 422 > eval:1:118376
_malloc http://localhost:7711/worker/OpusEncoder.js line 422 > eval:1
getBufferFor http://localhost:7711/worker/EmsArgs.js:74
readBlobAsArrayBuffer http://localhost:7711/worker/EmsArgs.js:52
I noticed that if I remove your input disabled attribute in your example and run the encoder twice, the same thing occurs. Is this intentional?
Searching around, the only thing similar is this: emscripten-core/emscripten#6632 (comment)
So I might give that a try myself when I have time.
00 00 00 00 B7 1D C1 04 6E 3B 82 *09* D9 26 43 0D ....·.Á.n;‚.Ù&C.
00 00 00 00 B7 1D C1 04 6E 3B 82 *20* D9 26 43 0D ....·.Á.n;‚ Ù&C.
(This is the only modification.)
yielding in invalid encoded files
Diff 15: Delete 2 bytes at address 0x00009347 (first file)
Diff 16: Add 2 bytes at address 0x00009348 (second file) after address 0x0000934A (first file)
...
67 67 53 00 00 80 A9 03 00 00 00 00 00 4D BE 7A ggS..€©......M¾z
4B 06 00 00 00 64 F6 98 B8 39 FF 2E FF 04 K....dö˜¸9 ÿ.ÿ.
...
...
67 67 53 00 00 80 A9 03 00 00 00 00 00 D8 7C 81 ggS..€©......Ø|
30 06 00 00 00 AE 22 39 A3 39 FF 2E FF 04 0....®" 9£9ÿ.ÿ.
...
please can we have a proper filename.ogg instead of blob url?
blob:https%3A//rawgit.com/24d7eeb2-014d-4ba0-a6e7-392037a3311f
Do you plan on doing so? :)
First off, really neat work here with this! 👍
I came here via your post on StackOverflow, and I wanted to ask your thoughts on what would be involved in converting this to something that could accept a stream from getUserMedia. You also pointed to kazuki/opus.js-sample, however that's throwing opus_encoder_create failed
whenever I try to use it.
I ended up here after playing around with libmp3lame.js for a while, but running into some (potentially unresolvable?) issues around audible artefacts at various bitrates.
Anyway, I guess I was hoping for your thoughts on what would be involved in adding streaming support, and to inquire whether that was something you've taken a crack at. Hope that you don't mind me opening an issue for this.
Hey
In c/c++ I can use code like below
opus_encoder_ctl(enc, OPUS_SET_PACKET_LOSS_PERC(packetLossPercent));
opus_encoder_ctl(enc, OPUS_SET_INBAND_FEC( percent > 0 ? 1 : 0 ));
opus_encoder_ctl(enc, OPUS_SET_DTX(enable ? 1 : 0));
Is it possible to do same things in js?
Thank you
WASM:
XXX@XXX:~/Downloads$ opusinfo encoded.opus
Processing file "encoded.opus"...
New logical stream (#1, serial: 633146a3): type opus
Encoded with libopus 1.2.1
User comments section follows...
ENCODER=opus-tools/opusenc https://blog.rillke.com/opusenc.js/ from opus-tools 0.1.10-2-g6f67426
title=Follow me up to Carlow
artist=Christoph Nolte
album=The Rocky Road
date=2009
genre=Folk
publisher=Jamendo
copyright=2009-10-26T12:17:51+01:00 Christoph Nolte. Licensed to the public under http://creativecommons.org/licenses/by-sa/2.0/de/ verify at http://www.jamendo.com/album/54242/
encoded_by=Jamendo : http://www.jamendo.com | LAME
TRACKNUMBER=05
TDTG=2014-05-30T11:51:21
encoder=Lavf56.15.102
METADATA_BLOCK_PICTURE=3|image/jpeg||200x200x24|<5348 bytes of image data>
Opus stream 1:
Pre-skip: 312
Playback gain: 0 dB
Channels: 2
Original sample rate: 44100Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 1000.0ms (max), 999.1ms (avg), 840.0ms (min)
Total data length: 2013265 bytes (overhead: 1.17%)
Playback length: 2m:51.829s
Average bitrate: 93.73 kb/s, w/o overhead: 92.64 kb/s
Logical stream 1 ended
ASM.JS
XXX@XXX:~/Downloads$ opusinfo "encoded(1).opus"
Processing file "encoded(1).opus"...
New logical stream (#1, serial: 7eba927d): type opus
Encoded with libopus 1.2.1
User comments section follows...
ENCODER=opus-tools/opusenc https://blog.rillke.com/opusenc.js/ from opus-tools 0.1.10-2-g6f67426
title=Follow me up to Carlow
artist=Christoph Nolte
album=The Rocky Road
date=2009
genre=Folk
publisher=Jamendo
copyright=2009-10-26T12:17:51+01:00 Christoph Nolte. Licensed to the public under http://creativecommons.org/licenses/by-sa/2.0/de/ verify at http://www.jamendo.com/album/54242/
encoded_by=Jamendo : http://www.jamendo.com | LAME
TRACKNUMBER=05
TDTG=2014-05-30T11:51:21
encoder=Lavf56.15.102
METADATA_BLOCK_PICTURE=3|image/jpeg||200x200x24|<5348 bytes of image data>
Opus stream 1:
Pre-skip: 312
Playback gain: 0 dB
Channels: 2
Original sample rate: 44100Hz
Packet duration: 20.0ms (max), 20.0ms (avg), 20.0ms (min)
Page duration: 1000.0ms (max), 999.1ms (avg), 840.0ms (min)
Total data length: 1693170 bytes (overhead: 1.34%)
Playback length: 2m:51.829s
Average bitrate: 78.83 kb/s, w/o overhead: 77.77 kb/s
Logical stream 1 ended
i'm trying to use in react. but, i get this error: Error parsing input file: audio.ogg
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.