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
Grid
instance 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
Grid
instance object.
Returns how many seconds to wait between thumbs. Defaults to 1
.
- Sets how many seconds to wait between thumbs to
int
. - Returns the
Grid
instance 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
Grid
instance object.
Returns the height of each individual thumb in the grid.
Defaults to 144
.
- Sets height of each individual thumb to
h
. - Returns the
Grid
instance object.
Returns the quality of the resulting JPEG. Defaults to 50
.
- Sets the quality of the resulting JPEG to
q
. - Returns the
Grid
instance 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
ffmpeg
video quality. - Returns the
Grid
instance object.
Returns the prefix used for debug messages. Defaults to an empty string.
- Sets the prefix for dedugging to
prefix
. - Returns the
Grid
instance object.
- Triggers the thumbnailing process
- Calls
fn
witherr, buf
,buf
being the resulting JPEG grid. - Can be aborted by calling
Grid#abort
. - Returns the
Grid
instance object.
- Aborts the
ffmpeg
process, if ongoing, or the grid composition. - Returns the
Grid
instance object.
Returns the program that will be called. Defaults to ffmpeg
.
- Sets the program that will be run to
cmd
. - Returns the
Grid
instance object.
- Property that holds the
ffmpeg
ChildProcess
.
- Outputs the debugging
msg
tostdout
whenDEBUG
is enabled. Thetype
can beinfo
orffmpeg
which helps separate the noise.
- If the
interval
andstart
combination can't possibly meetcount
due to the length of the video, the grid will be populated with empty spaces.
ffmpeg
must be installed an available in$PATH
libjpeg
needs to be installed for the picha dependency to build
- Nick Momrik (@nickmomrik)
- Guillermo Rauch (@guille)
MIT – Copyright (c) 2014 Automattic, Inc.