## 5.1\. Media Codecs ### 5.1.1\. Audio Encoding See more details in [5.1.3. Audio Codecs Details](#5_1_3_audio_codecs_details). If device implementations declare `android.hardware.microphone`, they MUST support encoding the following audio formats and make them available to third-party apps: * [C-1-1] PCM/WAVE * [C-1-2] FLAC * [C-1-3] Opus All audio encoders MUST support: * [C-3-1] PCM 16-bit native byte order audio frames via the [`android.media.MediaCodec`]( https://developer.android.com/reference/android/media/MediaCodec.html#raw-audio-buffers) API. ### 5.1.2\. Audio Decoding See more details in [5.1.3. Audio Codecs Details](#5_1_3_audio_codecs_details). If device implementations declare support for the `android.hardware.audio.output` feature, they must support decoding the following audio formats: * [C-1-1] MPEG-4 AAC Profile (AAC LC) * [C-1-2] MPEG-4 HE AAC Profile (AAC+) * [C-1-3] MPEG-4 HE AACv2 Profile (enhanced AAC+) * [C-1-4] AAC ELD (enhanced low delay AAC) * [C-1-11] xHE-AAC (ISO/IEC 23003-3 Extended HE AAC Profile, which includes the USAC Baseline Profile, and ISO/IEC 23003-4 Dynamic Range Control Profile) * [C-1-5] FLAC * [C-1-6] MP3 * [C-1-7] MIDI * [C-1-8] Vorbis * [C-1-9] PCM/WAVE including high-resolution audio formats up to 24 bits, 192 kHz sample rate, and 8 channels. Note that this requirement is for decoding only, and that a device is permitted to downsample and downmix during the playback phase. * [C-1-10] Opus If device implementations support the decoding of AAC input buffers of multichannel streams (i.e. more than two channels) to PCM through the default AAC audio decoder in the `android.media.MediaCodec` API, the following MUST be supported: * [C-2-1] Decoding MUST be performed without downmixing (e.g. a 5.0 AAC stream must be decoded to five channels of PCM, a 5.1 AAC stream must be decoded to six channels of PCM). * [C-2-2] Dynamic range metadata MUST be as defined in "Dynamic Range Control (DRC)" in ISO/IEC 14496-3, and the `android.media.MediaFormat` DRC keys to configure the dynamic range-related behaviors of the audio decoder. The AAC DRC keys were introduced in API 21, and are: `KEY_AAC_DRC_ATTENUATION_FACTOR`, `KEY_AAC_DRC_BOOST_FACTOR`, `KEY_AAC_DRC_HEAVY_COMPRESSION`, `KEY_AAC_DRC_TARGET_REFERENCE_LEVEL` and `KEY_AAC_ENCODED_TARGET_LEVEL`. * [SR] It is STRONGLY RECOMMENDED that requirements C-2-1 and C-2-2 above are satisfied by all AAC audio decoders. When decoding USAC audio, MPEG-D (ISO/IEC 23003-4): * [C-3-1] Loudness and DRC metadata MUST be interpreted and applied according to MPEG-D DRC Dynamic Range Control Profile Level 1. * [C-3-2] The decoder MUST behave according to the configuration set with the following `android.media.MediaFormat` keys: `KEY_AAC_DRC_TARGET_REFERENCE_LEVEL` and `KEY_AAC_DRC_EFFECT_TYPE`. MPEG-4 AAC, HE AAC, and HE AACv2 profile decoders: * MAY support loudness and dynamic range control using ISO/IEC 23003-4 Dynamic Range Control Profile. If ISO/IEC 23003-4 is supported and if both ISO/IEC 23003-4 and ISO/IEC 14496-3 metadata are present in a decoded bitstream, then: * ISO/IEC 23003-4 metadata SHALL take precedence. All audio decoders MUST support outputting: * [C-6-1] PCM 16-bit native byte order audio frames via the [`android.media.MediaCodec`]( https://developer.android.com/reference/android/media/MediaCodec.html#raw-audio-buffers) API. ### 5.1.3\. Audio Codecs Details
Format/Codec | Details | File Types/Container Formats to be supported |
---|---|---|
MPEG-4 AAC Profile (AAC LC) |
Support for mono/stereo/5.0/5.1 content with standard sampling rates from 8 to 48 kHz. |
|
MPEG-4 HE AAC Profile (AAC+) | Support for mono/stereo/5.0/5.1 content with standard sampling rates from 16 to 48 kHz. |
|
MPEG-4 HE AACv2 Profile (enhanced AAC+) |
Support for mono/stereo/5.0/5.1 content with standard sampling rates from 16 to 48 kHz. |
|
AAC ELD (enhanced low delay AAC) | Support for mono/stereo content with standard sampling rates from 16 to 48 kHz. |
|
USAC | Support for mono/stereo content with standard sampling rates from 7.35 to 48 kHz. | MPEG-4 (.mp4, .m4a) |
AMR-NB | 4.75 to 12.2 kbps sampled @ 8 kHz | 3GPP (.3gp) |
AMR-WB | 9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16 kHz, as defined at AMR-WB, Adaptive Multi-Rate - Wideband Speech Codec | 3GPP (.3gp) |
FLAC | For both encoder and decoder: at least Mono and Stereo modes MUST be supported. Sample rates up to 192 kHz MUST be supported; 16-bit and 24-bit resolution MUST be supported. FLAC 24-bit audio data handling MUST be available with floating point audio configuration. |
|
MP3 | Mono/Stereo 8-320Kbps constant (CBR) or variable bitrate (VBR) |
|
MIDI | MIDI Type 0 and 1. DLS Version 1 and 2. XMF and Mobile XMF. Support for ringtone formats RTTTL/RTX, OTA, and iMelody |
|
Vorbis |
|
|
PCM/WAVE | PCM codec MUST support 16-bit linear PCM and 16-bit float. WAVE extractor must support 16-bit, 24-bit, 32-bit linear PCM and 32-bit float (rates up to limit of hardware). Sampling rates MUST be supported from 8 kHz to 192 kHz. | WAVE (.wav) |
Opus | Decoding: Support for mono, stereo, 5.0 and 5.1 content
with sampling rates of 8000, 12000, 16000, 24000, and 48000 Hz.
Encoding: Support for mono and stereo content with sampling rates of 8000, 12000, 16000, 24000, and 48000 Hz. |
|
Format/Codec | Details | Supported File Types/Container Formats |
---|---|---|
JPEG | Base+progressive | JPEG (.jpg) |
GIF | GIF (.gif) | |
PNG | PNG (.png) | |
BMP | BMP (.bmp) | |
WebP | WebP (.webp) | |
Raw | ARW (.arw), CR2 (.cr2), DNG (.dng), NEF (.nef), NRW (.nrw), ORF (.orf), PEF (.pef), RAF (.raf), RW2 (.rw2), SRW (.srw) | |
HEIF | Image, Image collection, Image sequence | HEIF (.heif), HEIC (.heic) |
Format/Codec | Details | File Types/Container Formats to be supported |
---|---|---|
H.263 |
|
|
H.264 AVC | See section 5.2 and 5.3 for details |
|
H.265 HEVC | See section 5.3 for details |
|
MPEG-2 | Main Profile |
|
MPEG-4 SP |
|
|
VP8 | See section 5.2 and 5.3 for details |
|
VP9 | See section 5.3 for details |
|
SD (low quality) | SD (high quality) | HD 720p | HD 1080p | UHD | |
---|---|---|---|---|---|
Video resolution |
|
|
|
1920 x 1080 px (other than MPEG4) | 3840 x 2160 px (HEVC, VP9) |