简体   繁体   English

合并后流利的ffmpeg框架消失

[英]fluent-ffmpeg frames disappear after the merge

I have a problem with the function mergeToFile() of the library fluent-ffmpeg . 我对fluent-ffmpeg库的功能mergeToFile()有问题。 If you use the mergeToFile function several times, then in the merged video, the frames are lost. 如果您多次使用mergeToFile函数,则在合并的视频中,帧会丢失。 Sometimes the video is cut off for a few seconds. 有时视频会被切断几秒钟。

fluent_ffmpeg()
  .addInput('video1.webm')
  .addInput('video2.webm')
  .on('end', function() {
    console.log('Success!');
  })
  .on('error', function(err) {
    console.error('Error: ' + err.message);
  })
  .mergeToFile('result.webm');

I've tried other additional options, but they didn't help. 我尝试了其他附加选项,但它们没有帮助。

I've found a decision, maybe it will be useful. 我发现了一个决定,也许会有用。 The function mergeToFile() works correctly only for the first time. 函数mergeToFile()仅在第一次正确运行。 However, if you write the result of merge in the file and delete the file specified in arguments of function .mergeToFile(), it will work. 但是,如果您在文件中写入合并结果并删除在函数.mergeToFile()的参数中指定的文件,则它将起作用。

 fluent_ffmpeg() .addInput('video1.webm') .addInput('video2.webm') .on('end', function() { var writeStream = fs.createWriteStream('video1.webm', {encoding: 'binary'}); writeStream.on('close', function() { fs.unlinkSync('result.webm'); }); fs.createReadStream('result.webm').pipe(writeStream); }) .mergeToFile('result.webm'); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM