npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

video-thumb-grid

v0.3.0

Published

Generates a sprite grid of video thumbnails using `ffmpeg`.

Downloads

3

Readme

video-thumb-grid

Generates a sprite grid of video thumbnails using ffmpeg.

How to use

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);
});

API

Grid(Stream input)

Constructs a new Grid with the given input Readable stream.

Grid(String input)

Constructs a new Grid with the given input fs path.

Grid#count()

Returns the number of thumbnails to generate. Defaults to 100.

Grid#count(Number count)

  • Sets the number of thumbnails to generate to count.
  • Returns the Grid instance object.

Grid#rows()

Returns the number of rows in the grid. Defaults to the creating a "square" by calculating the square root of count.

Grid#rows(Number count)

  • Sets the number of thumbnails to generate to count.
  • Returns the Grid instance object.

Grid#interval()

Returns how many seconds to wait between thumbs. Defaults to 1.

Grid#interval(Number int)

  • Sets how many seconds to wait between thumbs to int.
  • Returns the Grid instance object.

Grid#start()

Returns the number of seconds at which we start capturing thumbs. Defaults to 0.

Grid#start(Number secs)

  • Sets how many seconds to seek to.
  • Returns the grid instance object.

Grid#width()

Returns the width of each individual thumb in the grid. Defaults to 192.

Grid#width(Number w)

  • Sets width of each individual thumb to w.
  • Returns the Grid instance object.

Grid#height()

Returns the height of each individual thumb in the grid. Defaults to 144.

Grid#height(Number h)

  • Sets height of each individual thumb to h.
  • Returns the Grid instance object.

Grid#quality()

Returns the quality of the resulting JPEG. Defaults to 50.

Grid#quality(Number q)

  • Sets the quality of the resulting JPEG to q.
  • Returns the Grid instance object.

Grid#vquality()

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.

Grid#vquality(Number q)

  • Sets the ffmpeg video quality.
  • Returns the Grid instance object.

Grid#debugprefix()

Returns the prefix used for debug messages. Defaults to an empty string.

Grid#debugprefix(String prefix)

  • Sets the prefix for dedugging to prefix.
  • Returns the Grid instance object.

Grid#render(Function fn)

  • Triggers the thumbnailing process
  • Calls fn with err, buf, buf being the resulting JPEG grid.
  • Can be aborted by calling Grid#abort.
  • Returns the Grid instance object.

Grid#abort

  • Aborts the ffmpeg process, if ongoing, or the grid composition.
  • Returns the Grid instance object.

Grid#cmd()

Returns the program that will be called. Defaults to ffmpeg.

Grid#cmd(String cmd)

  • Sets the program that will be run to cmd.
  • Returns the Grid instance object.

Grid#proc

  • Property that holds the ffmpeg ChildProcess.

Grid#debug(String msg, String type)

  • Outputs the debugging msg to stdout when DEBUG is enabled. The type can be info or ffmpeg which helps separate the noise.

Notes:

  • If the interval and start combination can't possibly meet count due to the length of the video, the grid will be populated with empty spaces.

Requirements

  • ffmpeg must be installed an available in $PATH
  • libjpeg needs to be installed for the picha dependency to build

Authors

License

MIT – Copyright (c) 2014 Automattic, Inc.