Generates a sprite grid of video thumbnails using ffmpeg.
var fs = require('fs');
var thumbs = require('video-thumb-grid');
var grid = thumbs(fs.createReadStream('video.mov'));
grid.count(100);
grid.interval(4);
grid.start(0);
grid.render(function(err, buf){
if (err) throw err;
fs.writeFileSync('grid.jpg', buf);
});Constructs a new Grid with the given input Readable stream.
Constructs a new Grid with the given input fs path.
Returns the number of thumbnails to generate. Defaults to 100.
- Sets the number of thumbnails to generate to
count. - Returns the
Gridinstance object.
Returns the number of rows in the grid. Defaults to the creating a
"square" by calculating the square root of count.
- Sets the number of thumbnails to generate to
count. - Returns the
Gridinstance object.
Returns how many seconds to wait between thumbs. Defaults to 1.
- Sets how many seconds to wait between thumbs to
int. - Returns the
Gridinstance object.
Returns the number of seconds at which we start capturing thumbs.
Defaults to 0.
- Sets how many seconds to seek to.
- Returns the grid instance object.
Returns the width of each individual thumb in the grid.
Defaults to 192.
- Sets width of each individual thumb to
w. - Returns the
Gridinstance object.
Returns the height of each individual thumb in the grid.
Defaults to 144.
- Sets height of each individual thumb to
h. - Returns the
Gridinstance object.
Returns the quality of the resulting JPEG. Defaults to 50.
- Sets the quality of the resulting JPEG to
q. - Returns the
Gridinstance object.
Returns the quality of frames returned by ffmpeg. This corresponds to
the q option, which takes a value from 1 (highest) to 31 (lowest).
Defaults to 1.
- Sets the
ffmpegvideo quality. - Returns the
Gridinstance object.
Returns the prefix used for debug messages. Defaults to an empty string.
- Sets the prefix for dedugging to
prefix. - Returns the
Gridinstance object.
- Triggers the thumbnailing process
- Calls
fnwitherr, buf,bufbeing the resulting JPEG grid. - Can be aborted by calling
Grid#abort. - Returns the
Gridinstance object.
- Aborts the
ffmpegprocess, if ongoing, or the grid composition. - Returns the
Gridinstance object.
Returns the program that will be called. Defaults to ffmpeg.
- Sets the program that will be run to
cmd. - Returns the
Gridinstance object.
- Property that holds the
ffmpegChildProcess.
- Outputs the debugging
msgtostdoutwhenDEBUGis enabled. Thetypecan beinfoorffmpegwhich helps separate the noise.
- If the
intervalandstartcombination can't possibly meetcountdue to the length of the video, the grid will be populated with empty spaces.
ffmpegmust be installed an available in$PATHlibjpegneeds to be installed for the picha dependency to build
- Nick Momrik (@nickmomrik)
- Guillermo Rauch (@guille)
MIT – Copyright (c) 2014 Automattic, Inc.