docs/doc/reference/com/google/android/exoplayer2/transformer/EncoderUtil.html
Package com.google.android.exoplayer2.transformer
[@Deprecated](https://developer.android.com/reference/java/lang/Deprecated.html "class or interface in java.lang")public final classEncoderUtilextends[Object](https://developer.android.com/reference/java/lang/Object.html "class or interface in java.lang")
Deprecated. com.google.android.exoplayer2 is deprecated. Please migrate to androidx.media3 (which contains the same ExoPlayer code). See the migration guide for more details, including a script to help with the migration.
Utility methods for MediaCodec encoders.
Fields | Modifier and Type | Field | Description |
| --- | --- | --- |
| static int | LEVEL_UNSET |
Deprecated.
A value to indicate the encoding level is not set. |
All Methods Static Methods Concrete Methods Deprecated Methods | Modifier and Type | Method | Description |
| --- | --- | --- |
| static void | clearCachedEncoders() |
Deprecated.
Clears the cached list of encoders.
|
| static String | findCodecForFormat(MediaFormat format, boolean isDecoder) |
Deprecated.
Finds a MediaCodec that supports the MediaFormat, or null if none is found.
|
| static int | findHighestSupportedEncodingLevel(MediaCodecInfo encoderInfo, String mimeType, int profile) |
Deprecated.
Finds the highest supported encoding level given a profile.
|
| static ImmutableSet<Integer> | findSupportedEncodingProfiles(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Returns a set of supported encoding profiles for the given encoder and MIME type.
|
| static ImmutableList<Integer> | getCodecProfilesForHdrFormat(String mimeType, @com.google.android.exoplayer2.C.ColorTransfer int colorTransfer) |
Deprecated.
Returns the profile constants that can be used to encode the given HDR format, if supported by the device (this method does not check device capabilities).
|
| static int | getMaxSupportedInstances(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Returns the number of max number of the supported concurrent codec instances.
|
| static Range<Integer> | getSupportedBitrateRange(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Returns the range of supported bitrates for the given MIME type.
|
| static ImmutableList<Integer> | getSupportedColorFormats(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Returns a list of supported color formats for the given encoder and MIME type.
|
| static ImmutableList<MediaCodecInfo> | getSupportedEncoders(String mimeType) |
Deprecated.
Returns a list of encoders that support the given mimeType, or an empty list if there is none.
|
| static ImmutableList<MediaCodecInfo> | getSupportedEncodersForHdrEditing(String mimeType, ColorInfo colorInfo) |
Deprecated.
Returns a list of encoders that support HDR editing for the given mimeType and ColorInfo, or an empty list if the format is unknown or not supported for HDR encoding.
|
| static Range<Integer> | getSupportedHeights(MediaCodecInfo encoderInfo, String mimeType, int width) |
Deprecated.
Returns a Range of supported heights for the given encoder, MIME type and width.
|
| static ImmutableSet<String> | getSupportedMimeTypes() |
Deprecated.
Returns a list of MIME types that can be encoded.
|
| static Size | getSupportedResolution(MediaCodecInfo encoderInfo, String mimeType, int width, int height) |
Deprecated.
Finds an encoder's supported resolution from a given resolution.
|
| static Pair<Range<Integer>,Range<Integer>> | getSupportedResolutionRanges(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Returns a Pair of supported width and height ranges for the given encoder and MIME type.
|
| static boolean | isBitrateModeSupported(MediaCodecInfo encoderInfo, String mimeType, int bitrateMode) |
Deprecated.
Returns whether the bitrate mode is supported by the encoder.
|
| static boolean | isFeatureSupported(MediaCodecInfo encoderInfo, String mimeType, String featureName) |
Deprecated.
Returns whether a given feature is supported.
|
| static boolean | isHardwareAccelerated(MediaCodecInfo encoderInfo, String mimeType) |
Deprecated.
Checks if a codec is hardware-accelerated.
|
| static boolean | isSizeSupported(MediaCodecInfo encoderInfo, String mimeType, int width, int height) |
Deprecated.
Returns whether the encoder supports the given resolution. |
-
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
public static final int LEVEL_UNSET
Deprecated.
A value to indicate the encoding level is not set. See Also:Constant Field Values
-
public static[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")> getSupportedEncoders([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mimeType)
Deprecated.
Returns a list of encoders that support the given mimeType, or an empty list if there is none.
-
public static[ImmutableSet](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableSet.html?is-external=true "class or interface in com.google.common.collect")<[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")> getSupportedMimeTypes()
Deprecated.
Returns a list of MIME types that can be encoded.
-
public static void clearCachedEncoders()
Deprecated.
Clears the cached list of encoders.
-
public static[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")> getSupportedEncodersForHdrEditing([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mimeType,
@Nullable[ColorInfo](../video/ColorInfo.html "class in com.google.android.exoplayer2.video")colorInfo)
Deprecated.
Returns a list of encoders that support HDR editing for the given mimeType and ColorInfo, or an empty list if the format is unknown or not supported for HDR encoding.
-
public static[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Integer](https://developer.android.com/reference/java/lang/Integer.html "class or interface in java.lang")> getCodecProfilesForHdrFormat([String](https://developer.android.com/reference/java/lang/String.html?is-external=true "class or interface in java.lang")mimeType,
@com.google.android.exoplayer2.C.ColorTransfer int colorTransfer)
Deprecated.
Returns the profile constants that can be used to encode the given HDR format, if supported by the device (this method does not check device capabilities). If multiple profiles are returned, they are ordered by expected level of compatibility, with the most widely compatible profile first.
-
public static boolean isSizeSupported([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
int width,
int height)
Deprecated.
Returns whether the encoder supports the given resolution.
-
public static[Range](https://developer.android.com/reference/android/util/Range.html "class or interface in android.util")<[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")> getSupportedHeights([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
int width)
Deprecated.
Returns a Range of supported heights for the given encoder, MIME type and width.
Throws:IllegalArgumentException - When the width is not in the range of supported widths.
-
public static[Pair](https://developer.android.com/reference/android/util/Pair.html "class or interface in android.util")<[Range](https://developer.android.com/reference/android/util/Range.html?is-external=true "class or interface in android.util")<[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")>,[Range](https://developer.android.com/reference/android/util/Range.html?is-external=true "class or interface in android.util")<[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")>> getSupportedResolutionRanges([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns a Pair of supported width and height ranges for the given encoder and MIME type.
-
@Nullable
public static[Size](https://developer.android.com/reference/android/util/Size.html "class or interface in android.util")getSupportedResolution([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
int width,
int height)
Deprecated.
Finds an encoder's supported resolution from a given resolution.
The input resolution is returned, if it (after aligning to the encoder's requirement) is supported by the encoder.
The resolution will be adjusted to be within the encoder's range of supported resolutions, and will be aligned to the encoder's alignment requirement. The adjustment process takes into account the original aspect ratio. But the fixed resolution may not preserve the original aspect ratio, depending on the encoder's required size alignment.
Parameters:encoderInfo - The MediaCodecInfo of the encoder.mimeType - The output MIME type.width - The original width.height - The original height.Returns:A supported resolution, or null if unable to find a fallback.
-
public static[ImmutableSet](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableSet.html?is-external=true "class or interface in com.google.common.collect")<[Integer](https://developer.android.com/reference/java/lang/Integer.html "class or interface in java.lang")> findSupportedEncodingProfiles([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns a set of supported encoding profiles for the given encoder and MIME type.
-
public static int findHighestSupportedEncodingLevel([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
int profile)
Deprecated.
Finds the highest supported encoding level given a profile.
Parameters:encoderInfo - The encoderInfo.mimeType - The MIME type.profile - The encoding profile.Returns:The highest supported encoding level, as documented in MediaCodecInfo.CodecProfileLevel, or LEVEL_UNSET if the profile is not supported.
-
@Nullable
public static[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")findCodecForFormat([MediaFormat](https://developer.android.com/reference/android/media/MediaFormat.html?is-external=true "class or interface in android.media")format,
boolean isDecoder)
Deprecated.
Finds a MediaCodec that supports the MediaFormat, or null if none is found.
-
public static[Range](https://developer.android.com/reference/android/util/Range.html "class or interface in android.util")<[Integer](https://developer.android.com/reference/java/lang/Integer.html?is-external=true "class or interface in java.lang")> getSupportedBitrateRange([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns the range of supported bitrates for the given MIME type.
-
public static boolean isBitrateModeSupported([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,
int bitrateMode)
Deprecated.
Returns whether the bitrate mode is supported by the encoder.
-
public static[ImmutableList](https://guava.dev/releases/31.1-android/api/docs/com/google/common/collect/ImmutableList.html?is-external=true "class or interface in com.google.common.collect")<[Integer](https://developer.android.com/reference/java/lang/Integer.html "class or interface in java.lang")> getSupportedColorFormats([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html?is-external=true "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns a list of supported color formats for the given encoder and MIME type.
-
public static boolean isHardwareAccelerated([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Checks if a codec is hardware-accelerated.
-
public static boolean isFeatureSupported([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")featureName)
Deprecated.
Returns whether a given feature is supported.
-
@RequiresApi(23)
public static int getMaxSupportedInstances([MediaCodecInfo](https://developer.android.com/reference/android/media/MediaCodecInfo.html "class or interface in android.media")encoderInfo,[String](https://developer.android.com/reference/java/lang/String.html "class or interface in java.lang")mimeType)
Deprecated.
Returns the number of max number of the supported concurrent codec instances.