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-previews

v1.0.4

Published

Make sprite sheets or gif previews of your videos using Node.js

Downloads

7

Readme

Video Preview npm Package

Make sprite sheets or gif previews of your videos using Node.js

preview

The module creates two types of previews:

  • Horizontal or vertical sprite sheet for css animation-timing-function: steps(10, end)
  • Animated gif image

API

await VideoPreview(input_file, output_file, total_frames[, options])

input_file

Type: String
Full path to source video file.

output_file

Type: String
Full path to preview file. Pay special attention to the file extension, it is here that the type of preview to be made is determined!

total_frames

Type: Number
The amount of frames in a preview file. If = 1, then would be taken frame from duration / 2 position

options.temp_dir

Type: String
Default: {INPUT FILE PATH}/temp_{UNIQ ID}/
Temporary folder for storing video frames

options.video_length

Type: Number
Default: true
If not set, then video-length module would be used to get actual video length. video-length module requires MediaInfo binary!

options.frames_format

Type: String
Default: jpg
png gives maximum quality, but jpg is faster

options.width

Type: Number | String
Output image width. Read this article for more info

options.height

Type: Number | String
Output image height. Read this article for more info

options.quality

Type: Number
Default: 75
For now it works only for gif output format

options.direction

Type: String
Default: v
Frames direction for jpg or png sprite sheets

| Key | Value | | ------ | ------ | | v | vertical direction | | h | horizontal direction |

options.fps

Type: Number
Default: 1
Gif frame rate

options.loop

Type: Boolean
Default: true
Loop gif

options.ffmpeg_bin

Type: String
Default: ffmpeg
FFmpeg binary

options.mediainfo_bin

Type: String
Default: MediaInfo
MediaInfo binary

options.convert_bin

Type: String
Default: convert
Convert binary

options.gifski_bin

Type: String
Default: gifski
Gifski binary

options.cleanup

Type: Boolean
Default: false
Remove extracted frames from temp_dir at the end

options.silent

Type: Boolean
Default: true
Enables logging stdout / stderr data

@output

Type: Object

{
   file: 'z:/preview.gif'
}

Usage

const VideoPreview = require('video-preview');

let frames = 10;
let input_file = './videos/MONICA BELLUCCI in the Matrix Sequels (HD Movie Scenes).mp4';
let output_file = './videos/preview.gif';

VideoPreview(input_file, output_file, frames, { 

   width: 320,
   quality: 50,
   fps: 1,
   
   cleanup: true,

}).then(result => {
   console.log(result);
}).catch(err => {
   console.log(err);
})

PS

  • Demo video: (c) copyright 2008, Blender Foundation / www.bigbuckbunny.org