用Nodejs作影音轉檔 ,我使用 FFmpeg + fluent-ffmpeg (2.0.1)
遇到某些檔案會有以下錯誤,導致轉檔錯誤
TypeError: Object.keys called on non-object
at Function.keys (native)
at e:\Mercurial\nodejs\iflicks\node_modules\fluent-ffmpeg\lib\ffprobe.js:153:42
at Array.forEach (native)
at handleExit (e:\Mercurial\nodejs\iflicks\node_modules\fluent-ffmpeg\lib\ffprobe.js:152:46)
at ChildProcess. (e:\Mercurial\nodejs\iflicks\node_modules\fluent-ffmpeg\lib\ffprobe.js:191:11)
at ChildProcess.emit (events.js:110:17)
at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
6 Jul 16:07:44 - [nodemon] app crashed - waiting for file changes before starting...
如果遇到這種問題,救急方法可以先去node_modules\fluent-ffmpeg\lib修正 ffprobe.js
約第15行加上
function parseFfprobeOutput(out) {
var lines = out.split(/\r\n|\r|\n/);
var data = {
streams: []
};
lines = lines.filter(Boolean); // <== 加上這行
目前官方沒有更新這個錯誤,只好先暫時修正錯誤
沒有留言:
張貼留言