如何从JavaScript使用Opus编解码器 [英] How can I use Opus Codec from JavaScript
问题描述
我想看看是否有可能使用 getUserMedia
或最新浏览器中的类似内容直接访问Opus.
I would like to see if it's possible to have direct access to Opus using getUserMedia
or anything similar from the latest browsers.
我已经对此进行了很多研究,但没有取得好的结果.
I've been researching on it a lot but with no Good results.
我知道 webkitSpeechRecognition
API中实际上使用了Opus或Speex.我想做语音识别,但是要使用我自己的服务器而不是Google的服务器.
I'm aware that either Opus or Speex are actually used in webkitSpeechRecognition
API. I would like to do speech recognition but using my own server rather than Google's.
推荐答案
因此,关于Emscripten的建议很多,但没有人建议,所以我移植了编码器
So there are a lot of suggestions about Emscripten but nobody did, so I ported the encoder opus-tools to JavaScript using Emscripten. Dependent on what one has in mind, there are now the following opportunities:
- 编码FLAC,WAVE,AIFF,RAW文件 ||演示 ||Web Worker大小:1.3 MiB
- 对原始内容进行编码,无需容器即可立即处理或发送 ||演示 ||Web Worker大小:0.6 MiB
- 从
getUserMedia
流中的Ogg-Opus和WAV编码/li> - 使用Mozilla Firefox时,可以使用
MediaRecorder
,它还可以与AudioContext.decodeAudioData()
一起在支持的平台上将任意声音文件转换为Opus格式.
- Encoding FLAC, WAVE, AIFF, RAW files || demo || Web Worker size: 1.3 MiB
- Encoding raw stuff for immediately processing or sending without container || demo || Web Worker size: 0.6 MiB
- Encoding to Ogg-Opus and WAV from
getUserMedia
stream - When using Mozilla Firefox, it's possible to use a
MediaRecorder
, which would also allow to convert arbitrary sound files into Opus format on supported platforms together withAudioContext.decodeAudioData()
这篇关于如何从JavaScript使用Opus编解码器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!