Coder Social home page Coder Social logo

cinematic.js's Introduction

Cinematic.js

Travis   npm   License MIT   Experimental

Screencap


Getting Started

Simply define your video element by adding it to the DOM as usual, and then add the data-cinematic flag:

<video data-cinematic>
    <source src="video/output.mp4" type="video/mp4">
</video>

Cinematic.js will then pick up the video and determine how to seek in the video based on the ratio to the scrollTop property and the document's height.

Note: It's entirely up to you to render the video – see using ffmpeg; any stalling in the seeking of the video is — most likely — a video encoding problem, and not a problem of the Cinematic.js module.

In the example, Cinematic.js comes with LeicesterSquareHigh.mp4 and LeicesterSquareLow.mp4 where the difference between the two in terms of file-size is significant, whereas the quality isn't too noticeable.

Happy experimenting!

Using ffmpeg

The most important aspect of the library is the video itself – it must have a generous number of keyframes, which can be defined by experimenting with the -g flag:

ffmpeg -i input.mp4 -g 10 output.mp4

Try experimenting with the -g flag to achieve a compromise between file-size and the quality. Another flag that you can experiment with is the -crf flag which relates to the video's constant rate factorthis ranges from 0 to 51. You can try changing the value to achieve a satisfying compromise:

ffmpeg -i input/mp4 -g 10 -crf 40 output.mp4

cinematic.js's People

Contributors

wildhoney avatar

Stargazers

 avatar

Watchers

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