public static boolean isSubtitleStreamAvailable(int streamNum, MediaElement element) {
    // Check this is a video element
    if (element.getType() != MediaElementType.VIDEO) {
      return false;
    }

    // Get list of subtitle streams for video file
    List<SubtitleStream> subtitles = element.getSubtitleStreams();

    if (subtitles == null) {
      return false;
    }

    return subtitles.size() >= streamNum;
  }
  public static boolean isAudioStreamAvailable(int streamNum, MediaElement element) {
    // Get list of audio streams for element
    List<AudioStream> audioStreams = element.getAudioStreams();

    if (audioStreams == null) {
      return false;
    }

    return audioStreams.size() >= streamNum;
  }
  public Integer getForcedSubtitleIndex(MediaElement element) {
    // Check this is a video element
    if (element.getType() != MediaElementType.VIDEO) {
      return null;
    }

    // Get list of subtitle streams for video file
    List<SubtitleStream> subtitles = element.getSubtitleStreams();

    if (subtitles == null) {
      return null;
    }

    // Scan subtitles for forced streams
    for (SubtitleStream subtitle : subtitles) {
      if (subtitle.isForced()) {
        return subtitle.getStream();
      }
    }

    return null;
  }
 @Override
 public String toString() {
   return String.format(
       "TranscodeProfile[ID=%s, Type=%s, MediaElement=%s, Supported Files=%s, Supported Codecs=%s, Supported Multichannel Codecs=%s, Quality=%s, Max Sample Rate=%s, Max Bit Rate=%s, Format=%s, Mime Type=%s, Video Transcode=%s, Audio Transcodes=%s, Subtitle Transcodes=%s, Audio Track=%s, Subtitle Track=%s, Offset=%s, Direct Play=%s",
       id == null ? "null" : id.toString(),
       String.valueOf(type),
       element == null ? "null" : element.getID().toString(),
       files == null ? "null" : Arrays.toString(files),
       codecs == null ? "null" : Arrays.toString(codecs),
       mchCodecs == null ? "null" : Arrays.toString(mchCodecs),
       quality == null ? "null" : quality.toString(),
       maxSampleRate == null ? "null" : maxSampleRate.toString(),
       maxBitRate == null ? "null" : maxBitRate.toString(),
       format == null ? "null" : format,
       mimeType == null ? "null" : mimeType,
       videoTranscode == null ? "null" : videoTranscode.toString(),
       audioTranscodes == null ? "null" : Arrays.toString(audioTranscodes),
       subtitleTranscodes == null ? "null" : Arrays.toString(subtitleTranscodes),
       audioTrack == null ? "null" : audioTrack.toString(),
       subtitleTrack == null ? "null" : subtitleTrack.toString(),
       offset == null ? "null" : offset.toString(),
       String.valueOf(directPlay));
 }