热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

使用fluentffmpeg

我设置了一个节点服务器,它需要一个文件进行预处理。如果仅使用ffmpeg库,则

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


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

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

推荐阅读
author-avatar
nuabolalalala4_135
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有