4

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"
aschmid00
  • 7,038
  • 2
  • 47
  • 66
sebastiannm
  • 565
  • 1
  • 5
  • 14
  • 1
    FFmpeg is by far the most reliable way to encode video. If you're getting broken videos, something is wrong. I don't know what module you're using to interface with FFmpeg, but I suggest trying a different one. I also suggest telling us exactly what the errors are that you're getting, and show the full FFmpeg command (assuming this module isn't binding directly to the libraries). – Brad Mar 24 '14 at 23:08

1 Answers1

4

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}`
  })
Lloyd
  • 8,204
  • 2
  • 38
  • 53