https://github.com/alectrocute/handbrake-static
easily deploy cross-platform HandBrake 🍹binaries in your Electron app
https://github.com/alectrocute/handbrake-static
app binaries binary electron handbrake javascript transcoding video
Last synced: 7 months ago
JSON representation
easily deploy cross-platform HandBrake 🍹binaries in your Electron app
- Host: GitHub
- URL: https://github.com/alectrocute/handbrake-static
- Owner: alectrocute
- License: gpl-3.0
- Created: 2020-04-21T00:38:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-21T04:37:52.000Z (over 5 years ago)
- Last Synced: 2025-03-14T22:34:07.908Z (7 months ago)
- Topics: app, binaries, binary, electron, handbrake, javascript, transcoding, video
- Language: JavaScript
- Homepage:
- Size: 32.9 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🍹handbrake-static
[](https://badge.fury.io/js/handbrake-static)
[]( https://github.com/alectrocute/handbrake-static/issues)handbrake-static provides cross-platform [HandBrake CLI](https://handbrake.fr/) binaries in your Electron application.
## Installation
```sh
npm i handbrake-static --save
```## Usage
```js
// 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](https://www.electron.build/configuration/contents).
```json
"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 🤷♂️) -
```js
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);
}
```