mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
29 lines
937 B
TypeScript
29 lines
937 B
TypeScript
|
import * as FfmpegCommand from 'fluent-ffmpeg';
|
||
|
|
||
|
|
||
|
const run = async () => {
|
||
|
|
||
|
const command = FfmpegCommand('demo/images/fulbright_mediumbr.mp4');
|
||
|
// command.setFfmpegPath('ffmpeg/ffmpeg.exe');
|
||
|
// command.setFfprobePath('ffmpeg/ffprobe.exe');
|
||
|
// command.setFlvtoolPath('ffmpeg/ffplay.exe');
|
||
|
FfmpegCommand('demo/images/fulbright_mediumbr.mp4').ffprobe((err,data) => {
|
||
|
console.log(data);
|
||
|
});
|
||
|
command // setup event handlers
|
||
|
.on('filenames', function (filenames) {
|
||
|
console.log('screenshots are ' + filenames.join(', '));
|
||
|
})
|
||
|
.on('end', function () {
|
||
|
console.log('screenshots were saved');
|
||
|
})
|
||
|
.on('error', function (err) {
|
||
|
console.log('an error happened: ' + err.message);
|
||
|
})
|
||
|
.outputOptions(['-qscale:v 4'])
|
||
|
// take 2 screenshots at predefined timemarks and size
|
||
|
.takeScreenshots({timemarks: ['10%'], size: '450x?', filename: 'thumbnail2-at-%s-seconds.jpg'});
|
||
|
};
|
||
|
|
||
|
run();
|