Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

Fix crash after setting ffmpeg path #1286

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/capabilities.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down
30 changes: 30 additions & 0 deletions test/processor.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
})
});
});
});