如何以mp3 / m4a JavaScript-recorder.js的格式录制音频 [英] How to record audio in format of mp3/m4a JavaScript- recorder.js
问题描述
在recorderjs rec.exportWAV([callback] [,type])
用于生成包含WAV格式录制音频的Blob对象。
In recorderjs rec.exportWAV([callback][, type])
is used to generate a Blob object containing the recorded audio in WAV format.
但是WAV文件占用的空间很大,30秒就大约为1mb。所以我想以mp3 / m4a的格式录制音频,占用的空间更少。
But the WAV file is taking large space, for 30sec it is approximately 1mb. So I want to record the audio in format of mp3/m4a which takes less space.
有没有办法以mp3 / m4a的格式录制音频。
Is there any way to record audio in format of mp3/m4a.
推荐答案
Recorder.js不支持将捕获的音频编码为mp3。
它只能录制16位单声道或立体声未压缩pcm作为wav。
It can only record 16 bit mono or stereo uncompressed pcm as wav.
要将音量减半,可以录制单声道而不是2频道/立体声使用 numChannels:1
在Recorder.js构造函数中,如下所示:
To halve the size you could record mono sound instead of 2 channel/stereo using numChannels:1
in the Recorder.js constructor like this:
var rec = new Recorder(来源,{numChannels:1})
numChannels
是Recorder.js的一个未记录的功能(该库不再维护)。
numChannels
is an undocumented feature of Recorder.js (the library is not maintained anymore).
来源: https://addpipe.com/blog/using-recorder-js-to-capture -wav-audio-in-your-html5-web-site /
要录制到mp3,您可以使用:
- WebAudioRecorder.js ,其中包含 asm.js 版本。 net /rel =nofollow noreferrer> LAME mp3 encoder
- vmsg ,其中包含 LAME mp3 encoder
- WebAudioRecorder.js which includes an asm.js version of the LAME mp3 encoder
- vmsg which includes a WebAssembly version of the LAME mp3 encoder
这篇关于如何以mp3 / m4a JavaScript-recorder.js的格式录制音频的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!