admin管理员组文章数量:1431918
In recorderjs rec.exportWAV([callback][, type])
is used to generate a Blob object containing the recorded audio in WAV format.
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.
Is there any way to record audio in format of mp3/m4a.
In recorderjs rec.exportWAV([callback][, type])
is used to generate a Blob object containing the recorded audio in WAV format.
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.
Is there any way to record audio in format of mp3/m4a.
Share Improve this question edited Aug 21, 2015 at 11:18 Manohar Gunturu asked Aug 21, 2015 at 11:13 Manohar GunturuManohar Gunturu 6961 gold badge10 silver badges23 bronze badges 1- please to feedback on this – Adib Aroui Commented Jun 27, 2016 at 19:15
3 Answers
Reset to default 2Recorder.js does NOT support encoding captured audio as mp3.
It can only record 16 bit mono or stereo unpressed pcm as wav.
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(source,{numChannels:1})
numChannels
is an undocumented feature of Recorder.js (the library is not maintained anymore).
Source: https://blog.addpipe./using-recorder-js-to-capture-wav-audio-in-your-html5-web-site/
To record to mp3 you can use:
- WebAudioRecorder.js which includes an asm.js version of the LAME mp3 encoder
- vmsg which includes a WebAssembly version of the LAME mp3 encoder
i think you should check this link : HTML5 record audio to file
here u can change the audio type like this : type = type || config.type || 'audio/wav';
You can change the format of the recording by mentioning the format in exportWAV function, as follows:
recorder.exportWAV(function (blob) {
callback(blob);
// create WAV download link using audio data blob
// createDownloadLink();
// Clear the Recorder to start again !
recorder.clear();
}, "audio/mp3");
I have came to the above solution for the following link.
本文标签: How to record audio in format of mp3m4a JavaScript recorderjsStack Overflow
版权声明:本文标题:How to record audio in format of mp3m4a JavaScript- recorder.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745581834a2664666.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论