Merge Multiple Videos using node fluent ffmpeg

后端 未结 1 725
死守一世寂寞
死守一世寂寞 2021-01-02 23:38

requirement is to read all the files in the directory and merge them. I am using node fluent-ffmpeg to achieve this. First of all reading all the files in th

1条回答
  •  时光说笑
    2021-01-03 00:13

    Try this

    var fluent_ffmpeg = require("fluent-ffmpeg");
    
    var mergedVideo = fluent_ffmpeg();
    var videoNames = ['./video1.mp4', './video2.mp4'];
    
    videoNames.forEach(function(videoName){
        mergedVideo = mergedVideo.addInput(videoName);
    });
    
    mergedVideo.mergeToFile('./mergedVideo.mp4', './tmp/')
    .on('error', function(err) {
        console.log('Error ' + err.message);
    })
    .on('end', function() {
        console.log('Finished!');
    });
    

    0 讨论(0)
提交回复
热议问题