作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用下面的代码从视频中生成缩略图。
它生成一张 4 帧的图像。问题是它不在帧之间寻找,所以 4 帧是相同的。我想我必须使用 select
而不是 -ss
但我不知道怎么做。
// - inPath: path to video file
// - outPath: path to thumbnail, no thumbnail will be generated when absent
// - count: number of thumbs to generate
self.exec = function (inPath, outPath, count, handler) {
var args = outPath ? [
'-i', inPath ,
'-f', 'image2',
'-vframes', count || 1,
'-aspect', '4:3',
'-filter:vf', 'scale=\'if(gt(a,4/3),128,-1)\':' +
'\'if(gt(a,4/3),-1,96)\',' +
'pad=w=128:h=97:x=(ow-iw)/2:y=(oh-ih)/2:color=black,tile=4x1',
'-y',
'-ss', '15',
outPath
] : [
'-i', inPath
];
最佳答案
我有这个工作。
mdata = ffprobe(function(metadata){ },inPath)
var parts = mdata['duration'].split(":");
var hours = parts[0];
var minutes = parts[1];
var seconds = parts[2];
var durationSec = 3600 * parseFloat(hours) + 60 * parseFloat(minutes) + parseFloat(seconds);
var distance = Math.round(durationSec/5);
var args = outPath ? [
'-ss', distance ,
'-i', inPath ,
'-f', 'image2',
'-vframes', count || 1,
'-aspect', '4:3',
'-filter:vf', 'select=\'isnan(prev_selected_t)+gte(t-prev_selected_t\\,'+ distance +')\',' + 'scale=\'if(gt(a,4/3),206,-1)\':' +
'\'if(gt(a,4/3),-1,154)\',' +
'pad=w=206:h=155:x=(ow-iw)/2:y=(oh-ih)/2:color=black,tile=4x1',
'-y',
outPath
] : [
'-i', inPath
];
关于javascript - 带有 JavaScript 的 ffmpeg 缩略图,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43948389/
我有一个具有可变数量子元素的固定大小的 div。我不知道 children 的大小。目标是缩小它们以适合父级。 例子: .parent { width: 100px; height: 100p
我是一名优秀的程序员,十分优秀!