admin管理员组文章数量:1305140
I want to trim and concat several audio files in Node.js. I found FFmpeg
and it looks like it does what I need, but I don't know how to use it in Node since the installation is through apt-get
. Theoretically, I can use what's called child_process
to execute several mands from bash, but I'm not sure if this is performant.
I want to trim and concat several audio files in Node.js. I found FFmpeg
and it looks like it does what I need, but I don't know how to use it in Node since the installation is through apt-get
. Theoretically, I can use what's called child_process
to execute several mands from bash, but I'm not sure if this is performant.
- Possible duplicate of Audio manipulation using node.js – AP. Commented Feb 20, 2018 at 20:04
- 2 Not exactly. That thread is 4 years old and has 2 answers while in JS you get new framework every week :P – feerlay Commented Feb 20, 2018 at 20:07
1 Answer
Reset to default 8Of course you can do this by spawning a child_process and use ffmpeg this way. This should perfectly works without any noticeable performance problem.
However there is a fluent-ffmpeg package that you could use for more convenience.
For example you can trim a file with the -t duration
option and concat files with -f concat
option. You can also use the builtin method mergeToFile()
.
Example:
// trim file
ffmpeg('input.wav')
.inputOptions('-t 2') // 2s
.output('output.wav')
.run()
// merge file
ffmpeg('input.wav')
.input('input2.wav')
.mergeToFile('merged.wav')
本文标签: javascripttrim and concat audio files in NodejsStack Overflow
版权声明:本文标题:javascript - trim and concat audio files in Node.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741773084a2396870.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论