muaz-khan / RecordRTC

RecordRTC is WebRTC JavaScript library for audio/video as well as screen activity recording. It supports Chrome, Firefox, Opera, Android, and Microsoft Edge. Platforms: Linux, Mac and Windows.
https://www.webrtc-experiment.com/RecordRTC/
MIT License
6.54k stars 1.75k forks source link

Wrong RIFF/WAVE chunk size, RIFF validators complain #401

Open jasonlo87 opened 6 years ago

jasonlo87 commented 6 years ago

In mergeLeftRightBuffers():

// create wav file var resultingBufferLength = 44 + interleavedLength * 2; var buffer = new ArrayBuffer(resultingBufferLength); var view = new DataView(buffer);

// RIFF chunk descriptor/identifier writeUTFBytes(view, 0, 'RIFF');

// RIFF chunk length

!!! should not be 44, should be 36. The length of the RIFF chunk doesn't include the RIFF label or the 4 size bytes... !!! view.setUint32(4, 44 + interleavedLength * 2, true);

lmmProject commented 5 years ago

captureMicrophone(function(microphone) { recorder = RecordRTC(microphone, { type: 'audio', recorderType: StereoAudioRecorder, desiredSampRate: 16000, // bits-per-sample * 1000 numberOfAudioChannels : 1, mimeType: 'audio/wav', sampleBits: 16, disableLogs: true }); recorder.startRecording(); // release microphone on stopRecording recorder.microphone = microphone; });

wavfile -> Unexpected end of file

lmmProject commented 5 years ago

I tried. really should be 36 This should be a bug. view.setUint32(4, 44 + interleavedLength 2, true); ->view.setUint32(4, 36 + interleavedLength 2, true);

lerudiconsulting commented 4 years ago

Hi guys! Any takers on this? I am experiencing issues with Wav-files with header issues. Am trying to process the wav-file with SOX noise reduction, but to no avail due to the RIFF header issue from having recorded using recordRTC...