public static boolean isTranscodeRequired(TranscodeProfile profile, VideoStream stream) { if (!isSupported(profile.getCodecs(), stream.getCodec())) { return true; } // Check bitrate if (profile.getMaxBitRate() != null) { if (profile.getMediaElement().getBitrate() > profile.getMaxBitRate()) { return true; } } // If direct play is not enabled check stream parameters if (!profile.isDirectPlayEnabled()) { // Check bitrate if (profile.getMediaElement().getBitrate() > VIDEO_QUALITY_MAX_BITRATE[profile.getQuality()]) { return true; } // Check resolution if (compareDimensions( new Dimension(stream.getWidth(), stream.getHeight()), VIDEO_QUALITY_RESOLUTION[profile.getQuality()]) == 1) { return true; } } return false; }