lib/capabilities.js
function(formats, cb) {
        var unavailable;

        // Output format(s)
        unavailable = self._outputs
          .reduce(function(fmts, output) {
            var format = output.options.find('-f', 1);
            if (format) {
              if (!(format[0] in formats) || !(formats[format[0]].canMux)) {
                fmts.push(format);
              }
            }

            return fmts;
          }, []);

        if (unavailable.length === 1) {
          return cb(new Error('Output format ' + unavailable[0] + ' is not available'));
        } else if (unavailable.length > 1) {
          return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available'));
        }

        // Input format(s)
        unavailable = self._inputs
          .reduce(function(fmts, input) {
            var format = input.options.find('-f', 1);
            if (format) {
              if (!(format[0] in formats) || !(formats[format[0]].canDemux)) {
                fmts.push(format[0]);
              }
            }

            return fmts;
          }, []);

        if (unavailable.length === 1) {
          return cb(new Error('Input format ' + unavailable[0] + ' is not available'));
        } else if (unavailable.length > 1) {
          return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available'));
        }

        cb();
      }
function(formats, cb) {
        var unavailable;

        // Output format(s)
        unavailable = self._outputs
          .reduce(function(fmts, output) {
            var format = output.options.find('-f', 1);
            if (format) {
              if (!(format[0] in formats) || !(formats[format[0]].canMux)) {
                fmts.push(format);
              }
            }

            return fmts;
          }, []);

        if (unavailable.length === 1) {
          return cb(new Error('Output format ' + unavailable[0] + ' is not available'));
        } else if (unavailable.length > 1) {
          return cb(new Error('Output formats ' + unavailable.join(', ') + ' are not available'));
        }

        // Input format(s)
        unavailable = self._inputs
          .reduce(function(fmts, input) {
            var format = input.options.find('-f', 1);
            if (format) {
              if (!(format[0] in formats) || !(formats[format[0]].canDemux)) {
                fmts.push(format[0]);
              }
            }

            return fmts;
          }, []);

        if (unavailable.length === 1) {
          return cb(new Error('Input format ' + unavailable[0] + ' is not available'));
        } else if (unavailable.length > 1) {
          return cb(new Error('Input formats ' + unavailable.join(', ') + ' are not available'));
        }

        cb();
      }
function ( formats , cb ) { var unavailable ; // Output format(s) unavailable = self . _outputs . reduce ( function ( fmts , output ) { var format = output . options . find ( '-f' , 1 ) ; if ( format ) { if ( ! ( format [ 0 ] in formats ) || ! ( formats [ format [ 0 ] ] . canMux ) ) { fmts . push ( format ) ; } } return fmts ; } , [ ] ) ; if ( unavailable . length === 1 ) { return cb ( new Error ( 'Output format ' + unavailable [ 0 ] + ' is not available' ) ) ; } else if ( unavailable . length > 1 ) { return cb ( new Error ( 'Output formats ' + unavailable . join ( ', ' ) + ' are not available' ) ) ; } // Input format(s) unavailable = self . _inputs . reduce ( function ( fmts , input ) { var format = input . options . find ( '-f' , 1 ) ; if ( format ) { if ( ! ( format [ 0 ] in formats ) || ! ( formats [ format [ 0 ] ] . canDemux ) ) { fmts . push ( format [ 0 ] ) ; } } return fmts ; } , [ ] ) ; if ( unavailable . length === 1 ) { return cb ( new Error ( 'Input format ' + unavailable [ 0 ] + ' is not available' ) ) ; } else if ( unavailable . length > 1 ) { return cb ( new Error ( 'Input formats ' + unavailable . join ( ', ' ) + ' are not available' ) ) ; } cb ( ) ; }
Check whether specified formats are available
Check whether specified formats are available