Josito
Josito

Reputation: 384

Convert stereo audio to mono in Javascript

I have an audio file with extension .raw and recorded in stereo, and I need to convert it to mono with Node. I'm not able to find a example of how to do it this process or a library.

Any help would be great

Upvotes: 3

Views: 2594

Answers (1)

Tanmay_vijay
Tanmay_vijay

Reputation: 619

You can use the following library https://github.com/fluent-ffmpeg/node-fluent-ffmpeg to use ffmpeg on node.

And following to convert to stereo to mono via ffmpeg ffmpeg -i stereo.flac -ac 1 mono.flac

Just pass the above options to ffmpeg via the library. Here's my code that seems to work

var FFmpeg = require('fluent-ffmpeg');

var command = FFmpeg({
    source: 'test.webm'
}).addOption('-ac', 1)
.saveToFile('out.mp3');

Upvotes: 2

Related Questions