简体   繁体   English

将立体声音频转换为Java语言中的单声道

[英]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. 我有一个扩展名为.raw的音频文件,并以立体声录制,我需要使用Node将其转换为单声道。 I'm not able to find a example of how to do it this process or a library. 我找不到如何执行此过程或库的示例。

Any help would be great 任何帮助都会很棒

You can use the following library https://github.com/fluent-ffmpeg/node-fluent-ffmpeg to use ffmpeg on node. 您可以使用以下库https://github.com/fluent-ffmpeg/node-fluent-ffmpeg在节点上使用ffmpeg。

And following to convert to stereo to mono via ffmpeg ffmpeg -i stereo.flac -ac 1 mono.flac 然后通过ffmpeg转换为立体声到单声道ffmpeg -i stereo.flac -ac 1 mono.flac

Just pass the above options to ffmpeg via the library. 只需通过库将上述选项传递给ffmpeg即可。 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');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM