【问题标题】:Video output file duration is cut in half when processed using fluent-ffmpeg使用 fluent-ffmpeg 处理视频输出文件时长减半
【发布时间】:2019-11-04 19:15:02
【问题描述】:

我设置了一个节点服务器,它需要一个文件进行预处理。仅使用 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'
    });

【问题讨论】:

    标签: node.js video ffmpeg fluent-ffmpeg


    【解决方案1】:

    原来我误解了文档...不能在同一个调用中同时包含输入处理和屏幕截图...应该是

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

    分开

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

    【讨论】:

      猜你喜欢
      • 2020-05-11
      • 2014-08-01
      • 2012-09-05
      • 1970-01-01
      • 2023-01-05
      • 2015-07-09
      • 2021-03-06
      • 2023-04-02
      • 1970-01-01
      相关资源
      最近更新 更多