This repository was archived by the owner on May 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ( / V i d e o c o d e c i n v a l i d - v i d e o - c o d e c i s n o t a v a i l a b l e / ) ;
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 ( / A u d i o c o d e c p n g i s n o t a v a i l a b l e / ) ;
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 ( / V i d e o c o d e c p c m _ u 1 6 l e i s n o t a v a i l a b l e / ) ;
230+
199231 cb ( ) ;
200232 } ) ;
201233 }
You can’t perform that action at this time.
0 commit comments