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-gif-converter

v1.0.1

Published

Video to GIF and viceversa converter using ffmpeg and gifski

Downloads

68

Readme

Video-GIF Converter

Video to GIF and viceversa converter

NPM

NPM Version license Donate to this project using Paypal

It uses ffmpeg and gifski under the hood. They are both installed automatically as dependencies by this package.

Getting started

To get started with this library, you need to install it and add it to your project.

Installation

# npm
npm install video-gif-converter --save

# yarn
yarn add video-gif-converter

Library Usage

API Reference available at https://pichillilorenzo.github.io/video-gif-converter/.

import * as path from 'path';
import {VideoGifConverter} from 'video-gif-converter';
// or
const path = require('path');
const {VideoGifConverter} = require('video-gif-converter');

const command = new VideoGifConverter({
  convertTo: VideoGifConverterConvertType.gif,
  output: path.join(__dirname, 'test', 'output'),
  gifski: true,
  quality: 100,
  startTime: 3,
  fps: 15,
  size: '640x?'
});
command.on('progress', progress => {
  console.log(progress);
});
// glob pattern
const files = path.join(__dirname, 'test', '**', '*.mp4');
const result = await command.run(files);

CLI Usage

<pattern> represents a glob pattern used to specify input files to convert. Surround the glob pattern with quotes (example './test/**/*.mp4').

Usage: video-gif-converter [options] <pattern>

Examples: 
  video-gif-converter --gifski -q 100 -o './test/output' './test/video.mp4'
  video-gif-converter --use-palette -o './test/output' './test/video.mp4'
  video-gif-converter --fps 10 './test/**/*.mp4'
  video-gif-converter --convert-to video --format mp4 'test/**/*.gif'

Arguments:
  pattern                         Glob pattern of input files. Surround the glob pattern with quotes (example './test/**/*.mp4').

Options:
  -ct, --convert-to <type>        Convert to gif or video. (choices: "gif", "video", default: "gif")
  -o, --output <path>             Output folder path.
  -f, --format <format>           Output video format. Used and required only if --convert-to is video.
  -r, --fps <fps>                 Output framerate.
  -s, --size <size>               Output frame size (examples: 640x480, 640x?, 50%).
  -a, --aspect <aspect>           Output frame aspect ratio (examples: 4:3, 16:9).
  -g, --gifski                    Use gifski to generate GIF
  -q, --quality <1-100>           GIF output quality used by gifski
  -df, --delete-frames            Delete generated frames used by gifski (default: true)
  -vc, --video-codec <codec>      Video codec (examples: mpeg4, libx264).
  -vb, --video-bitrate <bitrate>  Sets the target video bitrate in kbps. The bitrate argument may be a number or a string with an optional k suffix.
  -vbk, --video-bitrate-constant  The constant argument specifies whether a constant bitrate should be enforced. (default: false)
  -d, --duration <seconds>        Forces ffmpeg to stop transcoding after a specific output duration. The time parameter may be a number (in seconds) or a timestamp string (with format [[hh:]mm:]ss[.xxx]).
  -st, --start-time <seconds>     Seeks an input and only start decoding at given time offset. The time argument may be a number (in seconds) or a timestamp string (with format [[hh:]mm:]ss[.xxx]).
  -l, --loop <times>              Set the number of times to loop the output. Use -1 for no loop, 0 for looping indefinitely (default).
  -up, --use-palette              Use ffmpeg palettegen and paletteuse filters to generate high quality GIF without gifski.
  -h, --help                      display help for command

CLI Usage Example

video-gif-converter --gifski -q 100 -o './test/output' './test/**/*.mp4'

This code snippet shows how to put into action video-gif-converter to convert all .mp4 video files into high quality GIFs using the gifski encoder.

Contributors

Any contribution is appreciated. You can get started with the steps below:

  1. Fork this repository (learn how to do this here).

  2. Clone the forked repository.

  3. Make your changes and create a pull request (learn how to do this).

  4. I will attend to your pull request and provide some feedback.

License

This repository is licensed under the ISC License.