Gofilord
Gofilord

Reputation: 6641

Converting video to .mp4 with Node.js

I want to be able to do something like this:

var converter = require('converter');

converter.convert({
  from: 'avi',
  to: 'mp4',
  path: '/myvideo.avi',
  newPath: '/newvideo.mp4',
  error: function(err) {},
  success: function() {
    console.log('success!');
  }
});

Thanks!

Upvotes: 0

Views: 13665

Answers (2)

Nilesh Patel
Nilesh Patel

Reputation: 587

FFMPEG is good thing for play with video.

Try this command.

exec("ffmpeg -i filePath/fileName.ext filePath/newFileName.mp4");

You can set your other preset also.

Upvotes: 1

Josh C.
Josh C.

Reputation: 4363

Well, for one converter converts between xml, json, and yaml. So, you won't be able to convert an avi to an mp4 with that.

However, I have used node to spawn a child ffmpeg process for this very thing. Just an fyi, if you do choose to use ffmpeg via a child process and want to watch the log for progress and debugging, you will need to watch stderr. Ffmpeg reserves stdout to optionally stream the output of the conversion.

Upvotes: 5

Related Questions