private static int selectTrack(MediaExtractor extractor){
  int numTracks=extractor.getTrackCount();
  for (int i=0; i < numTracks; i++) {
    MediaFormat format=extractor.getTrackFormat(i);
    String mime=format.getString(MediaFormat.KEY_MIME);
    if (mime.startsWith("video/")) {
      if (VERBOSE) {
        Log.d(TAG,"Extractor selected track " + i + " ("+ mime+ "): "+ format);
      }
      return i;
    }
  }
  return -1;
}

private static int selectTrack ( MediaExtractor extractor ) { int numTracks = extractor . getTrackCount ( ) ; for ( int i = 0 ; i < numTracks ; i ++ ) { MediaFormat format = extractor . getTrackFormat ( i ) ; String mime = format . getString ( MediaFormat . KEY_MIME ) ; if ( mime . startsWith ( "video/" ) ) { if ( VERBOSE ) { Log . d ( TAG , "Extractor selected track " + i + " (" + mime + "): " + format ) ; } return i ; } } return - 1 ; }
selects the video track , if any .
