Reputation: 565
I have been looking for a way to encode multiple videos simultaneously from NodeJS but I haven't find a good solution for it yet.
Using FFMPEG I never get a 100% fail free response. There is always a broken video.
OS: Ubuntu 12.04
size = "#{options.maxWidth}x#{options.maxHeight}"
proc = new ffmpeg({
source: options.input
}).withVideoCodec(options.encoder).withSize(size).keepPixelAspect(true).withStrictExperimental()
proc.onProgress (progress) ->
console.log "progress: " + progress.percent
proc.saveToFile options.output, (stdout, stderr) ->
console.log "file has been converted succesfully"
Upvotes: 4
Views: 3624
Reputation: 8406
Have you considered handbrake-js?
An example encode:
const hbjs = require('handbrake-js')
hbjs.spawn({ input: 'video.avi', output: 'video.m4v' })
.on('progress', progress => {
const { percentComplete, eta } = progress
console.log(`Percent complete: ${percentComplete}, ETA: ${eta}`
})
Upvotes: 4