JSPM

  • Created
  • Published
  • Downloads 1028
  • Score
    100M100P100Q105306F
  • License MIT

A cross-platform npm distribution for HandbrakeCLI designed for command line or library use.

Package Exports

  • handbrake-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (handbrake-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Build Status handbrake-js

A cross-platform npm distribution for HandbrakeCLI designed for command line or library use.

Installation

$ npm install handbrake-js

On Windows and Mac OSX the above command will install handbrake-js and the correct HandbrakeCLI binary for your platform. Ubuntu users should additionally run: sh $ sudo npm -g run-script handbrake-js ubuntu-setup Use as a library

Handbrake-js has a single method: run.

handbrake.run(handbrakeOptions)

There are two ways to invoke run(), the first returns an event emitter. This approach emits output as it happens.

var handbrake = require("handbrake-js");
    
var options = {
    input: "Eight Miles High.mov",
    output: "Eight Miles High.m4v",
    preset: "Normal"
};

handbrakeCLI.run(options)
    .on("output", console.log);
    .on("progress", function(encode){
        console.log(encode.percentComplete);
    })
    .on("complete", function(){ 
        console.log("Encode complete"); 
    });

handbrake.run(handbrakeOptions, onComplete)

The second method is to pass an onComplete callback. It's more convenient for short duration tasks: javascript handbrake.run({ preset-list: true }, function(stdout, stderr){ console.log(stdout); }); Use from the command line

If you installed handbrake-js globally, using:

$ sudo npm install -g handbrake-js

then you can encode from the command line: sh $ handbrake-js --input "Ballroom Bangra.avi" --output "Ballroom Bangra.mp4" --preset Normal Help

See here for the full list of Handbrake options.