# android.media.MediaCodec$CodecException: Error 0x80001001: Failed to configure codec (format not supported)

- **ID:** `android/mediacodec-format-not-supported`
- **Domain:** android
- **Category:** runtime_error
- **Error Code:** `0x80001001`
- **Verification:** ai_generated
- **Fix Rate:** 88%

## 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.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| Android 11 (API 30) | active | — | — |
| Android 12 (API 31) | active | — | — |
| Android 13 (API 33) | active | — | — |
| MediaCodec API (all versions) | active | — | — |

## Workarounds

1. **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);** (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);
   ```
2. **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.** (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.
   ```

## Dead Ends

- **Hardcode a specific codec name like 'video/avc' without checking device support** — Different devices support different profiles and levels within a codec. Hardcoding a codec name does not ensure the format parameters are valid. (80% fail)
- **Use the highest resolution supported by the camera sensor** — The encoder may not support that resolution even if the camera does. The codec's capabilities are independent of the camera's. (75% fail)
