const mergeProc = ffmpeg()
.on('start', () => {
console.log('Start merging' );
})
.on('end', () => {
streams.forEach(({recordPath}) => {
fs.unlinkSync(recordPath);
})
console.log('Merge end. You can play ' );
});
audioPathArr.forEach((recordPath) => {
mergeProc.addInput(recordPath)
});
mergeProc.mergeToFile(VIDEO_OUTPUT_FILE)
.on('error', function(err) {
console.log('Error ' + err.message);
})
.on('end', function() {
console.log('Finished!');
});