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

Commit d53d366

Browse files
authored
Merge pull request #698 from rhodgkins/missing-capabilities
Missing capability method getAvailableEncoders
2 parents dcc052a + 119a277 commit d53d366

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

lib/fluent-ffmpeg.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,11 @@ FfmpegCommand.getAvailableFormats = function(callback) {
206206
(new FfmpegCommand()).availableFormats(callback);
207207
};
208208

209+
FfmpegCommand.availableEncoders =
210+
FfmpegCommand.getAvailableEncoders = function(callback) {
211+
(new FfmpegCommand()).availableEncoders(callback);
212+
};
213+
209214

210215
/* Add ffprobe methods */
211216

test/capabilities.test.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ describe('Capabilities', function() {
128128
});
129129
});
130130

131-
it('should enable checking command arguments for available codecs and formats', function(done) {
131+
it('should enable checking command arguments for available codecs, formats and encoders', function(done) {
132132
async.waterfall([
133133
// Check with everything available
134134
function(cb) {
@@ -196,6 +196,38 @@ describe('Capabilities', function() {
196196
assert.ok(!!err);
197197
err.message.should.match(/Video codec invalid-video-codec is not available/);
198198

199+
cb();
200+
});
201+
},
202+
203+
// Invalid audio encoder
204+
function(cb) {
205+
new Ffmpeg('/path/to/file.avi')
206+
.fromFormat('avi')
207+
// Valid codec, but not a valid encoder for audio
208+
.audioCodec('png')
209+
.videoCodec('png')
210+
.toFormat('mp4')
211+
._checkCapabilities(function(err) {
212+
assert.ok(!!err);
213+
err.message.should.match(/Audio codec png is not available/);
214+
215+
cb();
216+
});
217+
},
218+
219+
// Invalid video encoder
220+
function(cb) {
221+
new Ffmpeg('/path/to/file.avi')
222+
.fromFormat('avi')
223+
.audioCodec('pcm_u16le')
224+
// Valid codec, but not a valid encoder for video
225+
.videoCodec('pcm_u16le')
226+
.toFormat('mp4')
227+
._checkCapabilities(function(err) {
228+
assert.ok(!!err);
229+
err.message.should.match(/Video codec pcm_u16le is not available/);
230+
199231
cb();
200232
});
201233
}

0 commit comments

Comments
 (0)