简体   繁体   English

使用 fluent-ffmpeg 处理视频 output 文件持续时间减半

[英]Video output file duration is cut in half when processed using fluent-ffmpeg

I have a node server set up and it takes a file for pre-processing.我设置了一个节点服务器,它需要一个文件进行预处理。 When using only ffmpeg library, files are processed with no problem, when using fluent-ffmpeg, if a video is 20 seconds, the output will only be the last half of the video (10 seconds).仅使用 ffmpeg 库时,文件处理没有问题,使用 fluent-ffmpeg 时,如果视频是 20 秒,output 将只是视频的后半部分(10 秒)。 I've tried multiple files of varying length and with same issue.我已经尝试了多个不同长度的文件并且存在相同的问题。 Any idea why this would happen?知道为什么会发生这种情况吗?

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'
    });

Turns out I misunderstood docs... can't incorporate both input processing and screenshots in same call... should be原来我误解了文档......不能在同一个调用中同时包含输入处理和屏幕截图......应该是

ffmpeg('video.mov').videoBitrate('512k')
    .output('./output/video.mov')
    .on('error', function(err, stdout, stderr) {
      console.log('Cannot process video: ' + err.message);
    });

and separately并分别

ffmpeg('video.mov').screenshots({
      count: 1,
      size:'640x480'
    });

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

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