Giter Site home page Giter Site logo

video-to-frames's Introduction

video-to-frames

Extract video frames from an html5 video and return them as an array of imageData

How to use:

Include the index.js file in your html page

<script src="index.js"></script>

Call the video-to-frames function:

VideoToFrames.getFrames('bunny.mp4', 30, VideoToFramesMethod.totalFrames).then(function (frames) {

    /*
    Do something with the frame data: eg: output them as canvasses to the DOM
    frames.forEach(function (frame) {
        var canvas = document.createElement('canvas');
        canvas.width = frame.width;
        canvas.height = frame.height;
        canvas.getContext('2d').putImageData(frame, 0, 0);
        document.getElementsByTagName('body')[0].appendChild(canvas);
    });
    */

});

Performance

For a video file (bunny.mp4) which is 1280x720 and comes in at 5MB

Desktop (windows i7)
  • Getting 5 frames takes about 0.7 seconds
  • Getting 30 frames takes about 2 seconds
  • Getting 60 frames takes about 4 seconds
  • Getting 120 frames takes about 8 seconds
phone (Nexus 5)
  • Getting 5 frames takes about 4 seconds
  • Getting 30 frames takes about 32 seconds

video-to-frames's People

Contributors

bertyhell avatar

Stargazers

Nguyễn Nhựt avatar Bruce avatar Asen Mitrev avatar bluewayg avatar  avatar Jyrone Parker avatar mulyan avatar Mahmoud Farah avatar Sérgio Alexandre Conceição da Silva avatar Raphael Abreu avatar Bugrahan Donmez avatar Katherine Martinez avatar Todor Imreorov avatar Claudiu Cojocaru avatar Johnson avatar Adam Pietrasiak avatar Sheng-Chi Liu avatar Jeff Carpenter avatar Iftimie Florentin Alexandru avatar Aiden Gardner avatar Franklin Kemta avatar  avatar Andrew Corbin avatar Juan Carlos Arbelaez avatar Max H avatar Han Sheng avatar Piotr Kawa avatar Stan Lei avatar SMITH Emmanuel avatar Valentin Saugnier avatar Raphael Kieling avatar  avatar Future Infinity avatar Lex avatar Leon Koole avatar Med0paW avatar Andrew MacDonald avatar Joshua Byrd avatar

Watchers

James Cloos avatar  avatar Adewole Adeniran Olamilekan avatar  avatar

video-to-frames's Issues

How to use this on typescript?

hey i found that this is what i need, can this be used on typescript?

Also i got this error after tying to import it to angular

Type 'CanvasRenderingContext2D | null' is not assignable to type 'CanvasRenderingContext2D'.
  Type 'null' is not assignable to type 'CanvasRenderingContext2D'.

How to contribute?

Thanks to your repo, I finish my task to render frames from user video. I need to change a couple lines of you code to make it work on angular, or any Typescript programs. I'd like to make a PR for videotoframe.ts also I'd like to add an instruction how to use that on others project. How could I contribute? what's the rule?

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.