Giter VIP home page Giter VIP logo

core-video-to-gif's Introduction

core-video-to-gif

A JavaScript Library To Convert Video Fragments To Gif.

中文文档

Get Started

NPM

$ npm install core-video-to-gif --save

CDN

<script src="./dist/core-video-to-gif.min.js"></script>
const v2g = new CoreVideoToGif({
    // specify the video element
    el: document.querySelector('video'),
    // video 的父容器
    parentEl: document.querySelector('.conatiner')
})
v2g.shot({
    // options,
    start: 5, // ms
    end: 8
}, (result) => {
    // ...
    image.src = result
})

Params

key Type Details Value
* el Element The video element <video ... >
workerScript String enable Web Worker Please inclued the [script](https://github.com/JackPu/core-video-to-gif/blob/master/examples/gif.worker.js), and specify the path
width Number The output git width 600(default: the video original height)
height Number The output gif image height 600(default: the video original height)
maxTime Number limit the time of gif animation 5(default: 10)
fps Number the frame per second 12(default: 6)
quality Number the quality of gif (1-10) The best is 10
onStartShot Function call when start shoting
onGifProcess Function call when making gif
onGifFinished Function call when gif output

“*” means it is required.

API

shot(params, callback)

You could use the method to get the video screenshots.

// get current screenshot
v2g.shot( (result) => {
   // ...
   image.src = result
})
// get screenshot from 5s - 8s
v2g.shot({
   // options,
   start: 5, // ms
   end: 8
}, (result) => {
   // ...
   image.src = result
})

params

key Type Details Value
start Number the screenshot start time 6(s)
end Number the screenshot end time 7(s)

upload(params, callback)

The api is still in draft. Not work!!!

Contributions

Your contributions and suggestions are welcome 😄😄😄

MIT License

core-video-to-gif's People

Contributors

jackpu avatar

Watchers

 avatar  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.