diff --git a/lib/fluent-ffmpeg.js b/lib/fluent-ffmpeg.js index 0c824bf7..7e648560 100644 --- a/lib/fluent-ffmpeg.js +++ b/lib/fluent-ffmpeg.js @@ -206,6 +206,11 @@ FfmpegCommand.getAvailableFormats = function(callback) { (new FfmpegCommand()).availableFormats(callback); }; +FfmpegCommand.availableEncoders = +FfmpegCommand.getAvailableEncoders = function(callback) { + (new FfmpegCommand()).availableEncoders(callback); +}; + /* Add ffprobe methods */ diff --git a/test/capabilities.test.js b/test/capabilities.test.js index 3f5c531a..b74427a9 100644 --- a/test/capabilities.test.js +++ b/test/capabilities.test.js @@ -128,7 +128,7 @@ describe('Capabilities', function() { }); }); - it('should enable checking command arguments for available codecs and formats', function(done) { + it('should enable checking command arguments for available codecs, formats and encoders', function(done) { async.waterfall([ // Check with everything available function(cb) { @@ -196,6 +196,38 @@ describe('Capabilities', function() { assert.ok(!!err); err.message.should.match(/Video codec invalid-video-codec is not available/); + cb(); + }); + }, + + // Invalid audio encoder + function(cb) { + new Ffmpeg('/path/to/file.avi') + .fromFormat('avi') + // Valid codec, but not a valid encoder for audio + .audioCodec('png') + .videoCodec('png') + .toFormat('mp4') + ._checkCapabilities(function(err) { + assert.ok(!!err); + err.message.should.match(/Audio codec png is not available/); + + cb(); + }); + }, + + // Invalid video encoder + function(cb) { + new Ffmpeg('/path/to/file.avi') + .fromFormat('avi') + .audioCodec('pcm_u16le') + // Valid codec, but not a valid encoder for video + .videoCodec('pcm_u16le') + .toFormat('mp4') + ._checkCapabilities(function(err) { + assert.ok(!!err); + err.message.should.match(/Video codec pcm_u16le is not available/); + cb(); }); }