简体   繁体   中英

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!

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM