Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.
Merged
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
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