我一直在寻找一种同时从NodeJS编码多个视频的方法,但我还没有找到一个好的解决方案。
使用FFMPEG我永远不会得到100%无故障响应。视频总是破碎。
操作系统: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"
答案 0 :(得分:4)
示例编码:
var hbjs = require("handbrake-js");
hbjs.spawn({ input: "some video.avi", output: "some vide.m4v" })
.on("progress", function(progress){
console.log(
"Percent complete: %s, ETA: %s",
progress.percentComplete,
progress.eta
);
});