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

        // Audio codec(s)
        unavailable = self._outputs.reduce(function(cdcs, output) {
          var acodec = output.audio.find('-acodec', 1);
          if (acodec && acodec[0] !== 'copy') {
            if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') {
              cdcs.push(acodec[0]);
            }
          }

          return cdcs;
        }, []);

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

        // Video codec(s)
        unavailable = self._outputs.reduce(function(cdcs, output) {
          var vcodec = output.video.find('-vcodec', 1);
          if (vcodec && vcodec[0] !== 'copy') {
            if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') {
              cdcs.push(vcodec[0]);
            }
          }

          return cdcs;
        }, []);

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

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

        // Audio codec(s)
        unavailable = self._outputs.reduce(function(cdcs, output) {
          var acodec = output.audio.find('-acodec', 1);
          if (acodec && acodec[0] !== 'copy') {
            if (!(acodec[0] in encoders) || encoders[acodec[0]].type !== 'audio') {
              cdcs.push(acodec[0]);
            }
          }

          return cdcs;
        }, []);

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

        // Video codec(s)
        unavailable = self._outputs.reduce(function(cdcs, output) {
          var vcodec = output.video.find('-vcodec', 1);
          if (vcodec && vcodec[0] !== 'copy') {
            if (!(vcodec[0] in encoders) || encoders[vcodec[0]].type !== 'video') {
              cdcs.push(vcodec[0]);
            }
          }

          return cdcs;
        }, []);

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

        cb();
      }
function ( encoders , cb ) { var unavailable ; // Audio codec(s) unavailable = self . _outputs . reduce ( function ( cdcs , output ) { var acodec = output . audio . find ( '-acodec' , 1 ) ; if ( acodec && acodec [ 0 ] !== 'copy' ) { if ( ! ( acodec [ 0 ] in encoders ) || encoders [ acodec [ 0 ] ] . type !== 'audio' ) { cdcs . push ( acodec [ 0 ] ) ; } } return cdcs ; } , [ ] ) ; if ( unavailable . length === 1 ) { return cb ( new Error ( 'Audio codec ' + unavailable [ 0 ] + ' is not available' ) ) ; } else if ( unavailable . length > 1 ) { return cb ( new Error ( 'Audio codecs ' + unavailable . join ( ', ' ) + ' are not available' ) ) ; } // Video codec(s) unavailable = self . _outputs . reduce ( function ( cdcs , output ) { var vcodec = output . video . find ( '-vcodec' , 1 ) ; if ( vcodec && vcodec [ 0 ] !== 'copy' ) { if ( ! ( vcodec [ 0 ] in encoders ) || encoders [ vcodec [ 0 ] ] . type !== 'video' ) { cdcs . push ( vcodec [ 0 ] ) ; } } return cdcs ; } , [ ] ) ; if ( unavailable . length === 1 ) { return cb ( new Error ( 'Video codec ' + unavailable [ 0 ] + ' is not available' ) ) ; } else if ( unavailable . length > 1 ) { return cb ( new Error ( 'Video codecs ' + unavailable . join ( ', ' ) + ' are not available' ) ) ; } cb ( ) ; }
Check whether specified codecs are available and add strict experimental options if needed
Check whether specified codecs are available and add strict experimental options if needed