1.下载ffmpeg
http://ffmpeg.org/
2.引入child_process模块
const exec = require('child_process').exec;
3.直接拼接音频
//nanStr=concat:./src/files/nv1/1.mp3|./src/files/nv1/1.mp3
//nanCopy=放想存的路径
exec(`ffmpeg -i "${nanStr}" -acodec copy "${nanCopy}" `, () => {
//这里放合成后做的事
tencentUpload.uploadVideo({ openid, path, pathTitle, sexual: 'nan' }).then(res => {
fs.unlink(nanCopy, (err) => { })
})
});