azulene-screenshots
v1.0.3
Published
Wrapper around ffmpeg that simplifies obtaining screenshots
Downloads
13
Readme
What is this?
A wrapper around ffmpeg that provides a small promise-based API for generating screenshots from video files. This is written in support of the Azulene library, but can happily be used on its own, and has no dependencies in production mode aside from, obviously, ffmpeg itself.
Note that ffmpeg must be available on your system.
Documentation is in the form of JSDoc comments embedded in the source; create
HTML documentation with npm run docs
. Tests are written for Mocha and Chai,
and the style guide is Airbnb's.
Usage
screenshot
Generates a JPEG screenshot of a video at a specific moment.
Takes
file
string Path of the video file to screenshotatSeconds
number Number of seconds into the video at which to take cap, eg 120
and returns a Buffer; the screenshot in binary form.
screenshots
Take a series of screenshots; just specify the number you want, and get back shots taken at evenly-spaced intervals. For example, 4 screenshots of a 60 second video gets you shots taken at 12, 24, 36, and 48 seconds.
Takes
and returns a Promise<Array<Buffer>>; a promised array of binary buffers.
writeScreenshots
Writes screenshots to the specified folder, passing in the name of the video file to draw images from, the desired filename root, the number of shots to take, and the destination folder.
Takes
filename
stringwriteName
string The prefix to be used for screenshot filenamesnumberOfShots
numberdestination
string The folder to store the screenshots in
and returns a Promise<Array<String>>; a promised array of written filenames.
License (MIT)
Copyright © 2017 Ryan Plant
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.