GithubHelp home page GithubHelp logo

isabella232 / video-thumb-grid Goto Github PK

View Code? Open in Web Editor NEW

This project forked from automattic/video-thumb-grid

0.0 0.0 0.0 7.71 MB

Utility to generate thumb grid spritesheets from videos

JavaScript 100.00%

video-thumb-grid's Introduction

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.

video-thumb-grid's People

Contributors

jgcaruso avatar nickmomrik avatar rauchg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.