vid2gif

Browser module for converting a video element into a GIF file.

Usage no npm install needed!

<script type="module">
  import vid2gif from 'https://cdn.skypack.dev/vid2gif';
</script>

README

vid2gif

Convert a video element to an animated GIF in the browser.

NPM

Usage

vid2gif is designed to be used with browserify. To use it, include it in a browserified module:

var vid2gif = require('vid2gif')
var NUM_FRAMES = 10

vid2gif(document.querySelector('video'), NUM_FRAMES, function(err, gifBlob) {
  if (err) {
    alert('oh no!: ' + err)
    return
  }

  var img = document.createElement('img')
  img.src = window.URL.createObjectURL(gifBlob)
  docuument.body.appendChild(img)
})

API

var vid2gif = require('vid2gif')

vid2gif(videoElement, numFrames, cb)

Convert videoElement's source (with known number of frames numFrames, assumed to be evenly distributed) to an animated GIF, calling cb when done. cb is a function(err, gifBlob).

Installation

npm install vid2gif

License

MIT