diff --git a/lib/ffmpeg.js b/lib/ffmpeg.js index a793ffb0..844fb369 100644 --- a/lib/ffmpeg.js +++ b/lib/ffmpeg.js @@ -46,7 +46,7 @@ function testUrl(url, cb, redirCount) { return cb("Too many redirects. Please provide a direct link to the " + "file"); } - return testUrl(res.headers['location'], cb, redirCount + 1); + return testUrl(res.headers["location"], cb, redirCount + 1); } if (res.statusCode !== 200) { @@ -55,8 +55,9 @@ function testUrl(url, cb, redirCount) { return cb("HTTP " + res.statusCode + " " + message); } - if (!/^audio|^video/.test(res.headers['content-type'])) { - return cb("Server did not return an audio or video file"); + if (!/^audio|^video/.test(res.headers["content-type"])) { + return cb("Server did not return an audio or video file, or sent the " + + "wrong Content-Type"); } cb(); @@ -214,10 +215,14 @@ exports.query = function (filename, cb) { return cb("Link uses a protocol unsupported by this server's " + "version of ffmpeg"); - Logger.errlog.log(err.stack || err); + // Ignore ffprobe error messages, they are common and most often + // indicate a problem with the remote file, not with this code. + if (!/(av|ff)probe/.test(String(err))) + Logger.errlog.log(err.stack || err); return cb("Unable to query file data with ffmpeg"); } else { - Logger.errlog.log(err.stack || err); + if (!/(av|ff)probe/.test(String(err))) + Logger.errlog.log(err.stack || err); return cb("Unable to query file data with ffmpeg"); } }