我设置了一个节点服务器,它需要一个文件进行预处理。如果仅使用ffmpeg库,则可以毫无问题地处理文件;使用fluent-ffmpeg时,如果视频为20秒,则输出将仅为视频的后半部分(10秒)。我试过多个不同长度的文件,并且存在相同的问题。知道为什么会这样吗?
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffprobePath = require('@ffprobe-installer/ffprobe').path;
const ffmpeg = require('fluent-ffmpeg');
...
ffmpeg.setffmpegPath(ffmpegPath);
ffmpeg.setffprobePath(ffprobePath);
ffmpeg('video.mov').videoBitrate('512k').output('./output/video.mov')
.on('error',function(err,stdout,stderr) {
console.log('Cannot process video: ' + err.message);
}).screenshots({
count: 1,size:'640x480'
});