带有JavaScript的java ffmpeg缩略图
我正在使用下面的代码从视频中生成缩略图。
它会生成一幅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
];
# 1 楼答案
我得去做