Skip to content

easily deploy cross-platform HandBrake 🍹binaries in your Electron app

License

Notifications You must be signed in to change notification settings

alectrocute/handbrake-static

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍹handbrake-static

npm version Issues

handbrake-static provides cross-platform HandBrake CLI binaries in your Electron application.

Installation

 npm i handbrake-static --save

Usage

// points to app.asar.unpacked
const handbrakePath = require("handbrake-static").path;

// points to node_modules
const handbrakeDevPath = require("handbrake-static").devPath;

console.log(handbrakePath, handbrakeDevPath);

Don't forget to expose the binaries in your production build! Use electron-builder's extraFiles configuration attribute.

"extraFiles": {
  "from": "node_modules/handbrake-static/bin/mac/x64/HandBrakeCLI",
  "to":
  "./resources/app.asar.unpacked/handbrake-static/bin/mac/x64/HandBrakeCLI",
}

A more general example of using the HandBrake CLI binary in your project (which isn't the scope of this package 🤷‍♂️) -

const handbrakePath = require("handbrake-static").path;
const util = require("util");
const cp = require("child_process");

function execHandbrake(inputPath, outputPath, done) {
  const cmd = util.format(
    '"%s" %s',
    handbrakePath,
    `-i ${inputPath}`,
    `-o ${outputPath}`,
    "-e x264",
    "--encoder-preset veryfast",
    "-q 17"
  );
  cp.exec(cmd, done);
}

About

easily deploy cross-platform HandBrake 🍹binaries in your Electron app

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published