Recorderjs
Recorderjs copied to clipboard
How to Reduce wav File-size created by Recorder.js
I am using recorder.js to upload user's audio files on our server. This is working in chrome and firefox both..But our audio file will be around 1 minute and for 1 minute audio file its generating approx 8 MB file which is too large to upload on server..
I have tried to update recorderWorker.js file:
Updated interleave method as
function interleave(inputL, inputR) { var result = new Float32Array(inputL.length); for (var i = 0; i < inputL.length; ++i) result[i] = 0.5 * (inputL[i] + inputR[i]); return result; }
and set channel-count as
/* channel count */ view.setUint16(22, 1, true);
By this above code my file was created in just half size ie of 4 MB. when I play this file in chrome it is working but when I try this file in firefox and windows media player..This is not working..In firefox its giving failed to load and in windows media player giving "Windows Media Player encountered a problem while playing the file." message.
I have created 2 samples:
http://216.245.194.124/recorduploadsample.com/ http://216.245.194.124/recorduploadsample2.com/
First sample will work in both chrome and firefox and after record anything we can play the recorded sound..(This is original code with large file size)
Second sample is working only in chrome not in firefox (Updated above code to reduce the file size)
I need to reduce the file size by changing resolution of the audio file and that should work in chrome, firefox both...Can anyone suggest the solution for this?
Thanks in Advance
Please suggest to reduce wav file size..
I have a similar requirement: Asterisk needs 8Khz wav files. So it would be nice if I could configure the sample rate.
Sorry for not addressing this earlier. Will take a look tomorrow and see what I can do. On May 2, 2014 12:18 AM, "naftoligug" [email protected] wrote:
I have a similar requirement: Asterisk needs 8Khz wav files. So it would be nice if I could configure the sample rate.
— Reply to this email directly or view it on GitHubhttps://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-41997891 .
@mattdiamond Any development on this issue?
Thanks
@mattdiamond Any Development on this issue ?? Also any method of exporting wav to mp3 or ogg ?? that would be a good addition.. If not possible, what would be the problems of doing such a thing ?
There is no practical way I've seen to do what you ask at this point.
I've messed around with cross compiling libvorbis and libogg using asm. It isn't pretty. You end up with a large javascript library that has to be uploaded to the user.
I personally think browser developers will have to include support for different audio formats directly into the browser itself. But then there are legal issues surrounding such library licenses.
Sorry if this isn't more helpful.
On Fri, Jun 27, 2014 at 6:39 AM, S.Ramaseshan [email protected] wrote:
@mattdiamond https://github.com/mattdiamond Any Development on this issue ?? Also any method of exporting wav to mp3 or ogg ?? that would be a good addition.. If not possible, what would be the problems of doing such a thing ?
— Reply to this email directly or view it on GitHub https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47344275 .
s/asm/emscripten/g
On Fri, Jun 27, 2014 at 10:30 AM, Jared Folkins [email protected] wrote:
There is no practical way I've seen to do what you ask at this point.
I've messed around with cross compiling libvorbis and libogg using asm. It isn't pretty. You end up with a large javascript library that has to be uploaded to the user.
I personally think browser developers will have to include support for different audio formats directly into the browser itself. But then there are legal issues surrounding such library licenses.
Sorry if this isn't more helpful.
On Fri, Jun 27, 2014 at 6:39 AM, S.Ramaseshan [email protected] wrote:
@mattdiamond https://github.com/mattdiamond Any Development on this issue ?? Also any method of exporting wav to mp3 or ogg ?? that would be a good addition.. If not possible, what would be the problems of doing such a thing ?
— Reply to this email directly or view it on GitHub https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47344275 .
"I've messed around with cross compiling libvorbis and libogg using asm."
you sir are a hero.
Is that referring to sampling rate, or just mp3/ogg? On Jun 27, 2014 1:30 PM, "Jared Folkins" [email protected] wrote:
There is no practical way I've seen to do what you ask at this point.
I've messed around with cross compiling libvorbis and libogg using asm. It isn't pretty. You end up with a large javascript library that has to be uploaded to the user.
I personally think browser developers will have to include support for different audio formats directly into the browser itself. But then there are legal issues surrounding such library licenses.
Sorry if this isn't more helpful.
On Fri, Jun 27, 2014 at 6:39 AM, S.Ramaseshan [email protected] wrote:
@mattdiamond https://github.com/mattdiamond Any Development on this issue ?? Also any method of exporting wav to mp3 or ogg ?? that would be a good addition.. If not possible, what would be the problems of doing such a thing ?
Reply to this email directly or view it on GitHub < https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47344275>
.
Reply to this email directly or view it on GitHub https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47377674 .
https://www.webrtc-experiment.com/ffmpeg/wav-to-ogg.html
Looks like someone else has produced an experiment. If you are looking to transcode (not down sample) then this will give you some ideas.
Jared On Jun 29, 2014 5:41 PM, "naftoligug" [email protected] wrote:
Is that referring to sampling rate, or just mp3/ogg? On Jun 27, 2014 1:30 PM, "Jared Folkins" [email protected] wrote:
There is no practical way I've seen to do what you ask at this point.
I've messed around with cross compiling libvorbis and libogg using asm. It isn't pretty. You end up with a large javascript library that has to be uploaded to the user.
I personally think browser developers will have to include support for different audio formats directly into the browser itself. But then there are legal issues surrounding such library licenses.
Sorry if this isn't more helpful.
On Fri, Jun 27, 2014 at 6:39 AM, S.Ramaseshan [email protected] wrote:
@mattdiamond https://github.com/mattdiamond Any Development on this issue ?? Also any method of exporting wav to mp3 or ogg ?? that would be a good addition.. If not possible, what would be the problems of doing such a thing ?
Reply to this email directly or view it on GitHub <
https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47344275>
.
Reply to this email directly or view it on GitHub < https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47377674> .
— Reply to this email directly or view it on GitHub https://github.com/mattdiamond/Recorderjs/issues/53#issuecomment-47486657 .
The asm ffmpeg solution is intriguing, although perhaps I'll have to research using ffmpeg to do direct high-quality wav to a lower bitrate mono wav if it is possible. When recording audio for telephony use you only need 8k sample rate mono, which should cut these files down to a tenth of their size for bandwidth and storage.
Is there a smaller library than ffmpeg to try to use? ffmpeg will take a while to download to the client on their first use.
This answer worked for me: http://stackoverflow.com/questions/16296645/decrease-bitrate-on-wav-file-created-with-recorderjs/26245260#26245260
This works for me. It reduces recorded wav file data by converting to mp3 format. http://audior.ec/recordmp3js/
Here is a guide to help us compress WAV at: http://www.faasoft.com/articles/wav-compressor-mac-and-windows.html
It also helps compress almost all kinds of audio files like MP3, AAC, AC3, M4A, M4B, etc.
Recording Mono using this lib is pretty simple, just set the number of channels to 1, like so:
this.audioRecorder = new Recorder( inputPoint, {numChannels:1} );
If you change nothing more, the result will not play in some players, this is because there is a tiny error in the WAV encoder. To fix this change the following line in recorderWorker.js:
view.setUint32(28, sampleRate * 4, true);
to:
view.setUint32(28, sampleRate * numChannels * 2, true);
Now you're ready to record Mono ;-).
You may try use iDealshare VideoGo to convert the unsupported FLAC, AAC, AC3, MP4, MOV, VOB, FLV, etc to Windows Media Player supported formats.