1 ## 5.1\. Media Codecs 2 3 ### 5.1.1\. Audio Encoding 4 5 See more details in [5.1.3. Audio Codecs Details](#5_1_3_audio_codecs_details). 6 7 Handheld device implementations MUST support the following audio encoding: 8 9 * [H-0-1] AMR-NB 10 * [H-0-2] AMR-WB 11 * [H-0-3] MPEG-4 AAC Profile (AAC LC) 12 * [H-0-4] MPEG-4 HE AAC Profile (AAC+) 13 * [H-0-5] AAC ELD (enhanced low delay AAC) 14 15 16 Television device implementations MUST support the following audio encoding: 17 18 * [T-0-1] MPEG-4 AAC Profile (AAC LC) 19 * [T-0-2] MPEG-4 HE AAC Profile (AAC+) 20 * [T-0-3] AAC ELD (enhanced low delay AAC) 21 22 Automotive device implementations MUST support the following audio encoding: 23 24 * [A-1-1] MPEG-4 AAC Profile (AAC LC) 25 * [A-1-2] MPEG-4 HE AAC Profile (AAC+) 26 * [A-1-3] AAC ELD (enhanced low delay AAC) 27 28 If device implementations declare `android.hardware.microphone`, 29 they MUST support the following audio encoding: 30 31 * [C-1-1] PCM/WAVE 32 33 34 ### 5.1.2\. Audio Decoding 35 36 See more details in [5.1.3. Audio Codecs Details](#5_1_3_audio_codecs_details). 37 38 Handheld device implementations MUST support the following decoding. 39 40 * [H-0-1] AMR-NB 41 * [H-0-2] AMR-WB 42 43 If device implementations declare support for the 44 `android.hardware.audio.output` feature, they: 45 46 * [C-1-1] MPEG-4 AAC Profile (AAC LC) 47 * [C-1-2] MPEG-4 HE AAC Profile (AAC+) 48 * [C-1-3] MPEG-4 HE AACv2 Profile (enhanced AAC+) 49 * [C-1-4] AAC ELD (enhanced low delay AAC) 50 * [C-1-5] FLAC 51 * [C-1-6] MP3 52 * [C-1-7] MIDI 53 * [C-1-8] Vorbis 54 * [C-1-9] PCM/WAVE 55 * [C-1-10] Opus 56 57 If device implementations support the decoding of AAC input buffers of 58 multichannel streams (i.e. more than two channels) to PCM through the default 59 AAC audio decoder in the `android.media.MediaCodec` API, the following MUST be 60 supported: 61 62 * [C-2-1] Decoding MUST be performed without downmixing (e.g. a 5.0 AAC 63 stream must be decoded to five channels of PCM, a 5.1 AAC stream must be decoded 64 to six channels of PCM). 65 * [C-2-2] Dynamic range metadata MUST be as defined in "Dynamic Range Control 66 (DRC)" in ISO/IEC 14496-3, and the `android.media.MediaFormat` DRC keys to 67 configure the dynamic range-related behaviors of the audio decoder. The 68 AAC DRC keys were introduced in API 21,and are: 69 KEY_AAC_DRC_ATTENUATION_FACTOR, KEY_AAC_DRC_BOOST_FACTOR, 70 KEY_AAC_DRC_HEAVY_COMPRESSION, KEY_AAC_DRC_TARGET_REFERENCE_LEVEL and 71 KEY_AAC_ENCODED_TARGET_LEVEL 72 73 74 ### 5.1.3\. Audio Codecs Details 75 76 <table> 77 <tr> 78 <th>Format/Codec</th> 79 <th>Details</th> 80 <th>Supported File Types/Container Formats</th> 81 </tr> 82 <tr> 83 <td>MPEG-4 AAC Profile<br />(AAC LC)</td> 84 <td>Support for mono/stereo/5.0/5.1 content with standard 85 sampling rates from 8 to 48 kHz.</td> 86 <td> 87 <ul> 88 <li class="table_list">3GPP (.3gp)</li> 89 <li class="table_list">MPEG-4 (.mp4, .m4a)</li> 90 <li class="table_list">ADTS raw AAC (.aac, ADIF not supported)</li> 91 <li class="table_list">MPEG-TS (.ts, not seekable)</li></ul> 92 </td> 93 </tr> 94 <tr> 95 <td>MPEG-4 HE AAC Profile (AAC+)</td> 96 <td>Support for mono/stereo/5.0/5.1 content with standard 97 sampling rates from 16 to 48 kHz.</td> 98 <td></td> 99 </tr> 100 <tr> 101 <td>MPEG-4 HE AACv2<br /> 102 103 Profile (enhanced AAC+)</td> 104 <td>Support for mono/stereo/5.0/5.1 content with standard 105 sampling rates from 16 to 48 kHz.</td> 106 <td></td> 107 </tr> 108 <tr> 109 <td>AAC ELD (enhanced low delay AAC)</td> 110 <td>Support for mono/stereo content with standard sampling rates from 16 to 111 48 kHz.</td> 112 <td></td> 113 </tr> 114 <tr> 115 <td>AMR-NB</td> 116 <td>4.75 to 12.2 kbps sampled @ 8 kHz</td> 117 <td>3GPP (.3gp)</td> 118 </tr> 119 <tr> 120 <td>AMR-WB</td> 121 <td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16 kHz</td> 122 <td></td> 123 </tr> 124 <tr> 125 <td>FLAC</td> 126 <td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1 127 kHz is RECOMMENDED on devices with 44.1 kHz output, as the 48 to 44.1 kHz 128 downsampler does not include a low-pass filter). 16-bit RECOMMENDED; no 129 dither applied for 24-bit.</td> 130 <td>FLAC (.flac) only</td> 131 </tr> 132 <tr> 133 <td>MP3</td> 134 <td>Mono/Stereo 8-320Kbps constant (CBR) or variable bitrate (VBR)</td> 135 <td>MP3 (.mp3)</td> 136 </tr> 137 <tr> 138 <td>MIDI</td> 139 <td>MIDI Type 0 and 1. DLS Version 1 and 2. XMF and Mobile XMF. Support for 140 ringtone formats RTTTL/RTX, OTA, and iMelody</td> 141 <td><ul> 142 <li class="table_list">Type 0 and 1 (.mid, .xmf, .mxmf)</li> 143 <li class="table_list">RTTTL/RTX (.rtttl, .rtx)</li> 144 <li class="table_list">OTA (.ota)</li> 145 <li class="table_list">iMelody (.imy)</li></ul></td> 146 </tr> 147 <tr> 148 <td>Vorbis</td> 149 <td></td> 150 <td><ul> 151 <li class="table_list">Ogg (.ogg)</li> 152 <li class="table_list">Matroska (.mkv, Android 4.0+)</li></ul></td> 153 </tr> 154 <tr> 155 <td>PCM/WAVE</td> 156 <td>16-bit linear PCM (rates up to limit of hardware). Devices MUST support 157 sampling rates for raw PCM recording at 8000, 11025, 16000, and 44100 Hz 158 frequencies.</td> 159 <td>WAVE (.wav)</td> 160 </tr> 161 <tr> 162 <td>Opus</td> 163 <td></td> 164 <td>Matroska (.mkv), Ogg(.ogg)</td> 165 </tr> 166 </table> 167 168 ### 5.1.4\. Image Encoding 169 170 See more details in [5.1.6. Image Codecs Details](#5_1_6_image_codecs_details). 171 172 Device implementations MUST support encoding the following image encoding: 173 174 * [C-0-1] JPEG 175 * [C-0-2] PNG 176 * [C-0-3] WebP 177 178 ### 5.1.5\. Image Decoding 179 180 See more details in [5.1.6. Image Codecs Details](#5_1_6_image_codecs_details). 181 182 Device impelementations MUST support encoding the following image decoding: 183 184 * [C-0-1] JPEG 185 * [C-0-2] GIF 186 * [C-0-3] PNG 187 * [C-0-4] BMP 188 * [C-0-5] WebP 189 * [C-0-6] Raw 190 191 ### 5.1.6\. Image Codecs Details 192 193 <table> 194 <tr> 195 <th>Format/Codec</th> 196 <th>Details</th> 197 <th>Supported File Types/Container Formats</th> 198 </tr> 199 <tr> 200 <td>JPEG</td> 201 <td>Base+progressive</td> 202 <td>JPEG (.jpg)</td> 203 </tr> 204 <tr> 205 <td>GIF</td> 206 <td></td> 207 <td>GIF (.gif)</td> 208 </tr> 209 <tr> 210 <td>PNG</td> 211 <td></td> 212 <td>PNG (.png)</td> 213 </tr> 214 <tr> 215 <td>BMP</td> 216 <td></td> 217 <td>BMP (.bmp)</td> 218 </tr> 219 <tr> 220 <td>WebP</td> 221 <td></td> 222 <td>WebP (.webp)</td> 223 </tr> 224 <tr> 225 <td>Raw</td> 226 <td></td> 227 <td>ARW (.arw), CR2 (.cr2), DNG (.dng), NEF (.nef), NRW (.nrw), ORF (.orf), 228 PEF (.pef), RAF (.raf), RW2 (.rw2), SRW (.srw)</td> 229 </tr> 230 </table> 231 232 233 234 ### 5.1.7\. Video Codecs 235 236 * For acceptable quality of web video streaming and video-conference 237 services, device implementations SHOULD use a hardware VP8 codec that meets the 238 [requirements](http://www.webmproject.org/hardware/rtc-coding-requirements/). 239 240 If device implementations include a video decoder or encoder: 241 242 * [C-1-1] Video codecs MUST support output and input bytebuffer sizes that 243 accommodate the largest feasible compressed and uncompressed frame as dictated 244 by the standard and configuration but also not overallocate. 245 246 * [C-1-2] Video encoders and decoders MUST support YUV420 flexible color 247 format (COLOR_FormatYUV420Flexible). 248 249 If device implementations advertise HDR profile support through 250 [`Display.HdrCapabilities`]( 251 https://developer.android.com/reference/android/view/Display.HdrCapabilities.html), 252 they: 253 254 * [C-2-1] MUST support HDR static metadata parsing and handling. 255 256 If device implementations advertise intra refresh support through 257 `FEATURE_IntraRefresh` in the [`MediaCodecInfo.CodecCapabilities`]( 258 https://developer.android.com/reference/android/media/MediaCodecInfo.CodecCapabilities.html#FEATURE_IntraRefresh) 259 class, they: 260 261 * [C-3-1]MUST support the refresh periods in the range of 10 - 60 frames and 262 accurately operate within 20% of configured refresh period. 263 264 265 266 ### 5.1.8\. Video Codecs List 267 268 269 <table> 270 <tr> 271 <th>Format/Codec</th> 272 <th>Details</th> 273 <th>Supported File Types/<br>Container Formats</th> 274 </tr> 275 <tr> 276 <td>H.263</td> 277 <td></td> 278 <td><ul> 279 <li class="table_list">3GPP (.3gp)</li> 280 <li class="table_list">MPEG-4 (.mp4)</li></ul></td> 281 </tr> 282 <tr> 283 <td>H.264 AVC</td> 284 <td>See <a href="#5_2_video_encoding">section 5.2 </a>and 285 <a href="#5_3_video_decoding">5.3</a> for details</td> 286 <td><ul> 287 <li class="table_list">3GPP (.3gp)</li> 288 <li class="table_list">MPEG-4 (.mp4)</li> 289 <li class="table_list">MPEG-2 TS (.ts, AAC audio only, not seekable, Android 290 3.0+)</li></ul></td> 291 </tr> 292 <tr> 293 <td>H.265 HEVC</td> 294 <td>See <a href="#5_3_video_decoding">section 5.3</a> for details</td> 295 <td>MPEG-4 (.mp4)</td> 296 </tr> 297 <tr> 298 <td>MPEG-2</td> 299 <td>Main Profile</td> 300 <td>MPEG2-TS</td> 301 </tr> 302 <tr> 303 <td>MPEG-4 SP</td> 304 <td></td> 305 <td>3GPP (.3gp)</td> 306 </tr> 307 <tr> 308 <td>VP8</td> 309 <td>See <a href="#5_2_video_encoding">section 5.2</a> and 310 <a href="#5_3_video_decoding">5.3</a> for details</td> 311 <td><ul> 312 <li class="table_list"><a href="http://www.webmproject.org/">WebM 313 (.webm)</a></li> 314 <li class="table_list">Matroska (.mkv)</li></ul> 315 </td> 316 </tr> 317 <tr> 318 <td>VP9</td> 319 <td>See <a href="#5_3_video_decoding">section 5.3</a> for details</td> 320 <td><ul> 321 <li class="table_list"><a href="http://www.webmproject.org/">WebM 322 (.webm)</a></li> 323 <li class="table_list">Matroska (.mkv)</li></ul> 324 </td> 325 </tr> 326 </table> 327 328 329