Giter Club home page Giter Club logo

vsjs's Introduction

#vsjs VapourSynth for JavaScript.

##Documentation

Vapoursynth Object

Constructor

This module allows you to create Vapoursynth objects with the following syntax:

let clip = vsjs.Vapoursynth(scriptContents, [scriptFilename]);

scriptContents is the actual contents of the script (as a buffer) which should be evaluated.

scriptFilename is the path of the script being evaluated. This is optional. See the vapoursynth C documentation for more information on vapoursynth's behavior if no filename is specified.

getInfo()

clip.getInfo();

Which returns some useful information about the clip:

{
  "height": 480,
  "width": 640,
  "numFrames": 1000,
  "fps": {
    "numerator": 24000,
    "denominator": 1001
  },
  "frameSize": 460800
}

frameSize indicates how large the buffer must be to fetch frames from this clip.

getFrame()

clip.getFrame(frameNumber, frameBuffer, callback);

frameNumber is the desired frame.

frameBuffer is the destination buffer. If no error occurs it will be populated with the frame data.

callback will be called when the frame data has been fetched with the following arguments:

callback(error, frameNumber, frameBuffer);

error is any exception encountered while getting the frame. If no exception was encountered it will be null.

frameNumber is the number of the fetched frame.

frameBuffer is the same buffer which was originally provided, but now with populated with frame data.

##Example

const fs = require('fs');
const vsjs = require('vsjs');

const pathToScript = 'C:\\VapourSynth\\example.vpy';
const clip = vsjs.Vapoursynth(fs.readFileSync(pathToScript), pathToScript);

console.log(clip.getInfo());

clip.getFrame(0, Buffer.alloc(clip.getInfo().frameSize), (err, frameNumber, buffer) => {
    if (err) {
        console.log(err);
    } else {
        console.log(`buffer now contains frame ${frameNumber}`);
    }
});

##Build Install our dependencies:

> npm install

Then we go through the normal node-gyp process:

> node-gyp configure [--VS_SDK="C:/Vapoursynth/Install/sdk"]
> node-gyp build

To be honest I'm not sure if I've followed all the best practices for gyp builds or if the build will work on non-windows systems. If you have trouble building please try editing the binding.gyp or open an issue.

vsjs's People

Contributors

mgroshans avatar

Stargazers

 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.