diff --git a/lib/capabilities.js b/lib/capabilities.js index 1c89c02f..26dd610a 100644 --- a/lib/capabilities.js +++ b/lib/capabilities.js @@ -31,6 +31,10 @@ module.exports = function(proto) { * @return FfmpegCommand */ proto.setFfmpegPath = function(ffmpegPath) { + delete cache.codecs; + delete cache.encoders; + delete cache.filters; + delete cache.formats; cache.ffmpegPath = ffmpegPath; return this; }; diff --git a/test/processor.test.js b/test/processor.test.js index 6b0f7a3a..e97e5b9d 100644 --- a/test/processor.test.js +++ b/test/processor.test.js @@ -1239,5 +1239,35 @@ describe('Processor', function() { }) .saveToFile('/will/not/be/created/anyway'); }); + + it('should report ffmpeg errors when converting after changing ffmpeg path after successful conversion', function(done) { + var testFile = path.join(__dirname, 'assets', 'testConvertToFile.avi'); + this.files.push(testFile); + + const conversionPromise = new Promise((resolve, reject) => { + this.getCommand({ source: this.testfile, logger: testhelper.logger }) + .usingPreset('divx') + .on('error', function(err, stdout, stderr) { + testhelper.logError(err, stdout, stderr); + assert.ok(!err); + reject(err); + }) + .on('end', function() { + resolve(); + }) + .saveToFile(testFile); + }); + + conversionPromise.then(() => { + this.getCommand({ source: this.testfile, logger: testhelper.logger }) + .usingPreset('divx') + .setFfmpegPath('wrong-path') + .on('error', function(err) { + setTimeout(done, 1000); + err.message.should.match(/spawn wrong-path ENOENT/); + }) + .saveToFile(testFile); + }) + }); }); });