Skip to content

Instantly share code, notes, and snippets.

@tejasrsuthar
Last active May 23, 2017 06:24
Show Gist options
  • Save tejasrsuthar/9e47d689fec92f6301fca024fe8828e3 to your computer and use it in GitHub Desktop.
Save tejasrsuthar/9e47d689fec92f6301fca024fe8828e3 to your computer and use it in GitHub Desktop.
📹 Video encoding / transcoding / converting with node.js - Awesomeness
// Load handbrake library for transcoding
var transcoder = require('handbrake-js');
transcoder.spawn({ input: 'spiderman.avi', output: 'spiderman.mkv' })
.on('error', function(err){
if(err)
throw err
// Invalid user input data, no video data found
})
.on('progress', function(progress){
// Log Percentage completion and ETA
// Do your loading bar with percentage processing here
console.log(
'Percent completion: %s, EstimatedTimeAmount: %s',
progress.percentComplete,progress.eta
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment