Skip to content
This repository was archived by the owner on Nov 17, 2017. It is now read-only.

An experiment in converting Canvas animations to video.

License

Notifications You must be signed in to change notification settings

neogeek-deprecated/CanvasToVideo

Repository files navigation

#CanvasToVideo

An experiment in converting Canvas animations to video.

##Documentation

Read Online

##Setup

var ctv = new CanvasToVideo('capture.php', document.querySelector('canvas'));

ctv.setCacheEnabled(true); // Storing frames locally instead of sending every frame.
ctv.setImageQuality(60); // Changing the quality to 60%

function draw () {
    // draw objects to canvas
    ctv.capture();
    if (!animation.finished) {
        requestAnimationFrame(draw);
    } else {
        ctv.flush(); // Send all frames at once to the server.
    }
}
requestAnimationFrame(draw);

##Converting to Movie

$ ffmpeg -i captured/screenshot_%06d.png -c:v libx264 -vf "fps=30,format=yuv420p,setpts=(1/2.5)*PTS" output.mp4

About

An experiment in converting Canvas animations to video.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published