Skip to content

Commit

Permalink
Merge pull request fluent-ffmpeg#698 from rhodgkins/missing-capabilities
Browse files Browse the repository at this point in the history
Missing capability method getAvailableEncoders
  • Loading branch information
njoyard authored Apr 23, 2017
2 parents dcc052a + 119a277 commit d53d366
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/fluent-ffmpeg.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 */

Expand Down
34 changes: 33 additions & 1 deletion test/capabilities.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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();
});
}
Expand Down

0 comments on commit d53d366

Please sign in to comment.