0x80001001
android
runtime_error
ai_generated
true
android.media.MediaCodec$CodecException: Error 0x80001001: Failed to configure codec (format not supported)
ID: android/mediacodec-format-not-supported
88%Fix Rate
86%Confidence
1Evidence
2023-04-22First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| Android 11 (API 30) | active | — | — | — |
| Android 12 (API 31) | active | — | — | — |
| Android 13 (API 33) | active | — | — | — |
| MediaCodec API (all versions) | active | — | — | — |
Root Cause
MediaCodec.configure() is called with a MediaFormat containing unsupported parameters (e.g., resolution, bitrate, or profile) for the selected codec on the device's hardware decoder/encoder.
generic中文
使用包含设备硬件解码器/编码器不支持的参数(例如分辨率、比特率或配置文件)的MediaFormat调用MediaCodec.configure()。
Official Documentation
https://developer.android.com/reference/android/media/MediaCodec#configure(android.media.MediaFormat,%20android.view.Surface,%20android.media.MediaCrypto,%20int)Workarounds
-
90% success Query codec capabilities using MediaCodecList.getCodecCapabilities() and adjust format parameters (e.g., reduce resolution, change profile). Example: val capabilities = MediaCodecList(MediaCodecList.REGULAR_CODECS).findEncoderForFormat(format); val codecInfo = MediaCodecList.getCodecInfoAt(index); val caps = codecInfo.getCapabilitiesForType(mimeType);
Query codec capabilities using MediaCodecList.getCodecCapabilities() and adjust format parameters (e.g., reduce resolution, change profile). Example: val capabilities = MediaCodecList(MediaCodecList.REGULAR_CODECS).findEncoderForFormat(format); val codecInfo = MediaCodecList.getCodecInfoAt(index); val caps = codecInfo.getCapabilitiesForType(mimeType);
-
85% success Fall back to a software codec by using MediaCodecList with a specific component name that is known to support the format, or use MediaCodec.createDecoderByType() with a fallback to MediaCodec.createByCodecName() using a software decoder name.
Fall back to a software codec by using MediaCodecList with a specific component name that is known to support the format, or use MediaCodec.createDecoderByType() with a fallback to MediaCodec.createByCodecName() using a software decoder name.
中文步骤
Query codec capabilities using MediaCodecList.getCodecCapabilities() and adjust format parameters (e.g., reduce resolution, change profile). Example: val capabilities = MediaCodecList(MediaCodecList.REGULAR_CODECS).findEncoderForFormat(format); val codecInfo = MediaCodecList.getCodecInfoAt(index); val caps = codecInfo.getCapabilitiesForType(mimeType);
Fall back to a software codec by using MediaCodecList with a specific component name that is known to support the format, or use MediaCodec.createDecoderByType() with a fallback to MediaCodec.createByCodecName() using a software decoder name.
Dead Ends
Common approaches that don't work:
-
Hardcode a specific codec name like 'video/avc' without checking device support
80% fail
Different devices support different profiles and levels within a codec. Hardcoding a codec name does not ensure the format parameters are valid.
-
Use the highest resolution supported by the camera sensor
75% fail
The encoder may not support that resolution even if the camera does. The codec's capabilities are independent of the camera's.