GithubHelp home page GithubHelp logo

scriptorian / cinecodernodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cinegy/cinecodernodejs

0.0 1.0 0.0 25.28 MB

Node JS module wrapping Cinecoder, thanks to our friends @StrmPunkd

License: Apache License 2.0

Python 0.14% C++ 94.81% C 4.36% PowerShell 0.08% JavaScript 0.62%

cinecodernodejs's Introduction

CinecoderNodeJs

CinecoderNodeJs is a Node.js addon using Javascript and C++ to implement async processing for media encoding, decoding and processing. All the node wrapping and testing functions were made by the nice folks at StreamPunk Media, and passed to Cinegy for us to add our interfaces to get the Cinecoder binary to work with the addon. Complain to Cinegy first if we break something going forward before bothering the StreamPunk team!

Installation

Install Node.js for your platform. This software has been developed against the long term stable (LTS) 6.11.x release.

This module has native C++ files that are compiled with node-gyp. To use the module, you many need to install a C++ compiler and python v2.x on your system. On Windows, compilation has been tested using the community edition of Microsoft Visual Studio 2015. On Windows, node may need to be configured with:

npm config set msvs_version 2015 --global

CinecoderNodeJs is designed to be required to use from your own application to provide async processing.

npm install --save cinecodernodejs

Node.js addons use libuv which by default supports up to 4 async threads in a threadpool for activities such as file I/O. These same threads are used by cinecoder and if you wish to use a number of the functions in one Node.js process then you will need to set the environment variable UV_THREADPOOL_SIZE to a suitable number before the first use of the libuv threadpool.

Using cinecodernodejs

To use cinecoder in your own application, require the module then create and use workers as required. The processing functions follow a standard pattern as shown in the example code below.

let cinecoder = require('cinecodernodejs');

let encoder = new cinecoder.Encoder(() => {
  // encoder has successfully exited
});
encoder.on('error', err => {
  // handle error
});

// send the parameters for the function (these differ by function), return value is suggested result buffer size
let dstBufLen = encoder.setInfo(srcTags, dstTags, duration, encodeTags);

// async request for processing to be done.
encoder.encode(srcBuf, Buffer.alloc(dstBufLen), (err, result) => {
  if (err) {
    // handle error
  } else if (result) {
    // result is a JS buffer containing the encoded data. Note it may be a different size to dstBuf
  }
});

// async request for the processing thread to quit when it has finished the latest request
encoder.quit(() => {
});

Status, support and further development

We use AppVeyor to run integration tests, you can see the results of the last master branch build below:

Build status

See the project on AppVeyor here: https://ci.appveyor.com/project/cinegy/cinecodernodejs

License

This software is released under the Apache 2.0 license.

Copyright 2016 Streampunk Media Ltd. Copyright 2017 Cinegy GmbH.

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.