Node.js 如何使用Fluent FFMpeg进行修剪和合并?

Node.js 如何使用Fluent FFMpeg进行修剪和合并?,node.js,video,ffmpeg,fluent-ffmpeg,Node.js,Video,Ffmpeg,Fluent Ffmpeg,下面是我想用fluent ffmpeg做的事情: 我有3个输入文件。介绍、主要和外部视频。我希望合并三个,同时修剪主视频。这是我的密码: var ffmpegCommand = ffmpeg(); ffmpegCommand.addInput(introVideo); ffmpegCommand.addInput(mainVideo).seekInput(20).duration(3); ffmpegCommand.addInput(outroVideo); ffmpegCommand.on('

下面是我想用fluent ffmpeg做的事情:

我有3个输入文件。介绍、主要和外部视频。我希望合并三个,同时修剪主视频。这是我的密码:

var ffmpegCommand = ffmpeg();
ffmpegCommand.addInput(introVideo);
ffmpegCommand.addInput(mainVideo).seekInput(20).duration(3);
ffmpegCommand.addInput(outroVideo);
ffmpegCommand.on('error', function(err, stdout, stderr){
  console.log("FAILED!\n\t"+err+"\n\t"+stdout+"\n\t"+stderr);
});
ffmpegCommand.on('end', function(){
  console.log('COMPLETE!');
});
ffmpegCommand.on('start', function(commandLine) {
  console.log('Spawned Ffmpeg with command: ' + commandLine);
});
ffmpegCommand.mergeToFile('final.mp4', './vid_files/tmp');
程序执行正常,但当我播放final.mp4时,结果是introVideo播放,然后视频似乎冻结。根据fluent ffmpeg文档,它声明“这些[Input options]方法中的每一种都适用于最后添加的输入”。所以我不明白为什么这个语法似乎不起作用

如何修剪要发送到mergeToFile的主视频

请注意,如果在第二个addInput上没有.seekinput(20).duration(3),那么这个方法可以很好地工作

哦,这是输出的命令行值:

ffmpeg -i ./vid_files/intro.mp4 -ss 20 -i ./vid_files/main.mp4 -i ./vid_files/outro.mp4 -y -filter_complex concat=n=3:v=1:a=1 -t 3 final.mp4