How to use handbrake-js - 2 common examples

To help you get started, we’ve selected a few handbrake-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creativechain / creativechain-universe / js / upload.js View on Github external
function compressVideo(videoPath, outputPath, cback) {
  console.log(videoPath, outputPath);
  hbjs.spawn({
    input: videoPath,
    output: outputPath,
    preset: 'Very Fast 480p30'
  })
    .on('error', function(err){
      // invalid user input, no video found etc
      console.log("error", err);
      cback(err);
    })
    .on('progress', function(progress){
      console.log(
        'Percent complete: %s, ETA: %s',
        progress.percentComplete,
        progress.eta
      );
    })
github Dudemullet / tenna / lib / encoder.js View on Github external
var id = uid(24);
        var ext = path.extname(input);
        var filename = path.basename(input, ext);

        var vid = encodeStates[id] = {
            id: id,
            input: input,
            output: path.normalize(outputDir + path.sep + filename + ".mp4")
        };
        
        var encOptions = _.extend({}, this.fileEncodeOptions, {
            input: vid.input,
            output: vid.output
        });

        var handle = handbrake.spawn(encOptions)
            .on('error', function (err) {
                console.log('Error while encoding ', vid, ': ', err);
                delete encodeStates[id];
            })
            .on('progress', function (progress) {
                vid.progress = progress;
            })
            .on("complete", function(params) {
                vid.progress = 'complete';
                delete encodeStates[id];
            });
        handle.vid = vid;

        return handle;
    }
});

handbrake-js

Handbrake for node.js. Brings video encoding.

MIT
Latest version published 4 months ago

Package Health Score

56 / 100
Full package analysis

Popular handbrake-js functions