我正在使用 fluent-ffmpeg调整视频大小。
我无法弄清楚发生了什么。我有 2 个视频文件,一个有效,另一个无效。我一直在淘mediainfo
两个文件的输出,检查差异但不是 filesize
, duration
等没有区别(相同的 codec
, format
, width
/height
, frame rate
等)
Here's两个文件的链接。
我一直在使用输入流将这些视频文件读入 fluent-ffmpeg,如下所示:
await new Promise((resolve, reject) => {
ffmpeg(file.stream)
.output(path)
.size('426x240')
.on('start', function() {
console.log('started');
})
.on('error', function(err) {
console.log('An error occurred: ' + err.message);
})
.on('progress', function(progress) {
console.log('... frames: ' + progress.frames);
})
.on('end', function() {
console.log('Finished processing');
resolve();
})
.run();
});
工作文件打印:
started
... frames: 86
... frames: 107
Finished processing
但非工作文件似乎没有任何框架,并打印:
started
... frames: 0
Finished processing
知道有什么问题吗?
正在执行的 ffmpeg 命令:
ffmpeg -i pipe:0 -y -filter:v scale=w=426:h=240 uploads/works.mp4
最佳答案
I've been scouring the mediainfo outputs of both files, checking for discrepancies but other than filesize, duration etc. there's no difference
确实如此,但仅限于完整模式。试试
mediainfo -f
在文件上,您会看到:IsStreamable : Yes
对于工作文件,以及
IsStreamable : No
对于非工作文件。
此处的“否”表示输入需要支持查找(标题在末尾,播放器需要查找结束以解析标题,然后返回开始以解析数据)。
关于ffmpeg - 这两个视频有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52689718/