Last active
May 23, 2017 06:24
-
-
Save tejasrsuthar/9e47d689fec92f6301fca024fe8828e3 to your computer and use it in GitHub Desktop.
📹 Video encoding / transcoding / converting with node.js - Awesomeness
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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