1page.title=Supported Media Formats 2page.tags=video,audio,mpeg,mp4,m4a,mp3,3gp,3gpp,flac,wave,wav 3@jd:body 4 5<div id="qv-wrapper"> 6<div id="qv"> 7 8<h2>In this document</h2> 9 10<ol> 11<li><a href="#network">Network Protocols</a></li> 12<li><a href="#core">Core Media Formats</a></li> 13<li><a href="#recommendations">Video Encoding Recommendations</a></li> 14</ol> 15 16<h2>See also</h2> 17<ol> 18<li><a href="{@docRoot}guide/topics/media/index.html">Multimedia and Camera</a></li> 19</ol> 20 21<h2>Key classes</h2> 22<ol> 23<li>{@link android.media.MediaPlayer MediaPlayer}</li> 24<li>{@link android.media.MediaRecorder MediaRecorder}</li> 25</ol> 26 27</div> 28</div> 29 30<p>This document describes the media codec, container, and network protocol support provided by the Android platform.</p> 31 32<p>As an application developer, you are free to make use of any media codec that is available on any Android-powered device, including those provided by the Android platform and those that are device-specific. <strong>However, it is a best practice to use media encoding profiles that are device-agnostic</strong>.</p> 33 34 35<h2 id="network">Network Protocols</h2> 36 37<p>The following network protocols are supported for audio and video playback:</p> 38 39<ul> 40 <li>RTSP (RTP, SDP)</li> 41 <li>HTTP/HTTPS progressive streaming</li> 42 <li>HTTP/HTTPS live streaming <a href="http://tools.ietf.org/html/draft-pantos-http-live-streaming">draft protocol</a>: <ul> 43 <li>MPEG-2 TS media files only</li> 44 <li>Protocol version 3 (Android 4.0 and above)</li> 45 <li>Protocol version 2 (Android 3.x)</li> 46 <li>Not supported before Android 3.0</li> 47 </ul></li> 48</ul> 49 50<p class="note"><strong>Note:</strong> HTTPS is not supported before Android 3.1.</p> 51 52 53<h2 id="core">Core Media Formats</h2> 54 55<p>The table below describes the media format support built into the Android platform. Note that any given mobile device may provide support for additional formats or file types not listed in the table.</p> 56 57<p class="note"><strong>Note:</strong> Media codecs that are not guaranteed to be available on all Android platform versions are accordingly noted in parentheses—for example "(Android 3.0+)".</p> 58 59<p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p> 60 61<table style="font-size:12px"> 62<tbody> 63 64<tr> 65<th>Type</th> 66<th>Format / Codec</th> 67<th>Encoder</th> 68<th>Decoder</th> 69<th>Details</th> 70<th>Supported File Type(s) / Container Formats</th> 71</tr> 72 73<tr> 74<td rowspan="12">Audio</td> 75<td>AAC LC</td> 76<td style="text-align: center;"><big>•</big></td> 77<td style="text-align: center;"><big>•</big></td> 78<td rowspan="2">Support for mono/stereo/5.0/5.1 79content with standard sampling rates from 8 to 48 kHz.</td> 80<td rowspan="4"> 81 • 3GPP (.3gp)<br> 82 <nobr>• MPEG-4 (.mp4, .m4a)</nobr><br> 83 • ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported)<br> 84 • MPEG-TS (.ts, not seekable, Android 3.0+)</td> 85</tr> 86 87<tr> 88<td>HE-AACv1 (AAC+)</td> 89<td style="text-align: center;"><big>•</big><br><small>(Android 4.1+)</small></td> 90<td style="text-align: center;"><big>•</big></td> 91</tr> 92 93<tr> 94<td>HE-AACv2 (enhanced AAC+)</td> 95<td> </td> 96<td style="text-align: center;"><big>•</big></td> 97<td>Support for stereo/5.0/5.1 98content with standard sampling rates from 8 to 48 kHz.</td> 99</tr> 100 101<tr> 102<td>AAC ELD (enhanced low delay AAC)</td> 103<td style="text-align: center;"><big>•</big><br><small>(Android 4.1+)</small></td> 104<td style="text-align: center;"><big>•</big><br><small>(Android 4.1+)</small></td> 105<td>Support for mono/stereo content 106with standard sampling rates from 16 to 48 kHz</td> 107</tr> 108 109<tr> 110<td>AMR-NB</td> 111<td style="text-align: center;"><big>•</big></td> 112<td style="text-align: center;"><big>•</big></td> 113<td>4.75 to 12.2 kbps sampled @ 8kHz</td> 114<td> 115 3GPP (.3gp)</td> 116</tr> 117 118<tr> 119<td>AMR-WB</td> 120<td style="text-align: center;"><big>•</big></td> 121<td style="text-align: center;"><big>•</big></td> 122<td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td> 123<td> 124 3GPP (.3gp)</td> 125</tr> 126 127<tr> 128<td>FLAC</td> 129<td> </td> 130<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 3.1+)</small></td> 131<td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1 132kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz 133downsampler does not include a low-pass filter). 16-bit recommended; 134no dither applied for 24-bit. 135</td> 136<td> 137 FLAC (.flac) only</td> 138</tr> 139 140<tr> 141<td>MP3</td> 142<td> </td> 143<td style="text-align: center;"><big>•</big></td> 144<td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR) 145</td> 146<td> 147 MP3 (.mp3)</td> 148</tr> 149 150<tr> 151<td>MIDI</td> 152<td> </td> 153<td style="text-align: center;"><big>•</big></td> 154<td>MIDI Type 0 and 1. DLS Version 1 and 2. XMF and Mobile XMF. Support for ringtone formats RTTTL/RTX, OTA, and iMelody </td> 155<td> 156 • Type 0 and 1 (.mid, .xmf, .mxmf)<br> 157 • RTTTL/RTX (.rtttl, .rtx)<br> 158 • OTA (.ota)<br> 159 • iMelody (.imy)</td> 160</tr> 161 162<tr> 163<td>Vorbis</td> 164<td> </td> 165<td style="text-align: center;"><big>•</big></td> 166<td> </td> 167<td> 168 • Ogg (.ogg)<br> 169 • Matroska (.mkv, Android 4.0+)</td> 170</tr> 171 172<tr> 173<td>PCM/WAVE</td> 174<td style="text-align: center;"><big>•</big><br><small>(Android 4.1+)</small></td> 175<td style="text-align: center;"><big>•</big></td> 176<td>8- and 16-bit linear PCM (rates up to limit of hardware). Sampling 177rates for raw PCM recordings at 8000, 16000 and 44100 Hz.</td> 178<td> 179 WAVE (.wav)</td> 180</tr> 181 182<tr> 183<td>Opus</td> 184<td style="text-align: center;"></td> 185<td style="text-align: center;"><big>•</big><br><small>(Android 5.0+)</small></td> 186<td></td> 187<td> 188 Matroska (.mkv)</td> 189</tr> 190 191<tr> 192<td rowspan="5">Image</td> 193<td>JPEG</td> 194<td style="text-align: center;"><big>•</big></td> 195<td style="text-align: center;"><big>•</big></td> 196<td>Base+progressive</td> 197<td> 198 JPEG (.jpg)</td> 199</tr> 200 201<tr> 202<td>GIF</td> 203<td> </td> 204<td style="text-align: center;"><big>•</big></td> 205<td> </td> 206<td> 207 GIF (.gif)</td> 208</tr> 209 210<tr> 211<td>PNG</td> 212<td style="text-align: center;"><big>•</big></td> 213<td style="text-align: center;"><big>•</big></td> 214<td> </td> 215<td> 216 PNG (.png)</td> 217</tr> 218 219<tr> 220<td>BMP</td> 221<td> </td> 222<td style="text-align: center;"><big>•</big></td> 223<td> </td> 224<td> 225 BMP (.bmp)</td> 226</tr> 227 228<tr> 229<td>WebP</td> 230<td style="text-align: center;" nowrap> 231 <big>•</big><br> 232 <small>(Android 4.0+)</small><br> 233 <small>(Lossless, Transparency, Android 4.2.1+)</small> 234</td> 235<td style="text-align: center;" nowrap> 236 <big>•</big><br> 237 <small>(Android 4.0+)</small><br> 238 <small>(Lossless, Transparency, Android 4.2.1+)</small> 239</td> 240<td> </td> 241<td> 242 WebP (.webp)</td> 243</tr> 244 245 246<tr> 247<td rowspan="6">Video</td> 248<td>H.263</td> 249<td style="text-align: center;"><big>•</big></td> 250<td style="text-align: center;"><big>•</big></td> 251<td> </td> 252<td> 253 • 3GPP (.3gp)<br> 254 • MPEG-4 (.mp4)</td> 255</tr> 256 257<tr> 258<td>H.264 AVC</td> 259<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 3.0+)</small></td> 260<td style="text-align: center;" nowrap><big>•</big></td> 261<td>Baseline Profile (BP)</td> 262<td> 263 • 3GPP (.3gp)<br> 264 • MPEG-4 (.mp4)<br> 265 • MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)</td> 266</tr> 267 268<tr> 269<td>H.265 HEVC</td> 270<td style="text-align: center;" nowrap></td> 271<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 5.0+)</small></td> 272<td>Main Profile Level 3 for mobile devices and Main Profile Level 4.1 for Android TV</td> 273<td> 274 • MPEG-4 (.mp4)<br> 275</tr> 276 277<tr> 278<td>MPEG-4 SP</td> 279<td> </td> 280<td style="text-align: center;"><big>•</big></td> 281<td> </td> 282<td> 283 3GPP (.3gp)</td> 284</tr> 285 286<tr> 287<td>VP8</td> 288<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 4.3+)</small></td> 289<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 2.3.3+)</small></td> 290<td>Streamable only in Android 4.0 and above</td> 291<td> 292 • <a href="http://www.webmproject.org/">WebM</a> (.webm)<br> 293 • Matroska (.mkv, Android 4.0+)</td> 294</tr> 295 296<tr> 297<td>VP9</td> 298<td style="text-align: center;" nowrap></td> 299<td style="text-align: center;" nowrap><big>•</big><br><small>(Android 4.4+)</small></td> 300<td></td> 301<td> 302 • <a href="http://www.webmproject.org/">WebM</a> (.webm)<br> 303 • Matroska (.mkv, Android 4.0+)</td> 304</tr> 305 306</tbody></table> 307 308 309<h2 id="recommendations">Video Encoding Recommendations</h2> 310 311<p>Table 2, below, lists examples of video encoding profiles and parameters that the Android 312media framework supports for playback in the H.264 Baseline Profile codec. While 313table 3 lists examples that the framework supports for playback in the VP8 media codec.</p> 314 315<p>In addition to these encoding parameter recommendations, 316a device's available <em>video recording</em> profiles can be used as a proxy for media playback 317capabilities. These profiles can be inspected using the {@link android.media.CamcorderProfile 318CamcorderProfile} class, which is available since API level 8.</p> 319 320<p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong> 321Examples of supported video encoding parameters for the H.264 Baseline Profile codec.</p> 322 323<table> 324 <thead> 325 <tr> 326 <th> </th> 327 <th><acronym title="Standard definition">SD</a> (Low quality)</th> 328 <th><acronym title="Standard definition">SD</a> (High quality)</th> 329 <th><acronym title="High definition">HD 720p</a> (N/A on all devices)</th> 330 </tr> 331 </thead> 332 <tbody> 333 <tr> 334 <th>Video resolution</th> 335 <td>176 x 144 px</td> 336 <td>480 x 360 px</td> 337 <td>1280 x 720 px</td> 338 </tr> 339 <tr> 340 <th>Video frame rate</th> 341 <td>12 fps</td> 342 <td>30 fps</td> 343 <td>30 fps</td> 344 </tr> 345 <tr> 346 <th>Video bitrate</th> 347 <td>56 Kbps</td> 348 <td>500 Kbps</td> 349 <td>2 Mbps</td> 350 </tr> 351 <tr> 352 <th>Audio codec</th> 353 <td>AAC-LC</td> 354 <td>AAC-LC</td> 355 <td>AAC-LC</td> 356 </tr> 357 <tr> 358 <th>Audio channels</th> 359 <td>1 (mono)</td> 360 <td>2 (stereo)</td> 361 <td>2 (stereo)</td> 362 </tr> 363 <tr> 364 <th>Audio bitrate</th> 365 <td>24 Kbps</td> 366 <td>128 Kbps</td> 367 <td>192 Kbps</td> 368 </tr> 369 </tbody> 370</table> 371 372 373 374<p class="table-caption" id="encoding-recommendations-table-vp8"><strong>Table 3.</strong> 375Examples of supported video encoding parameters for the VP8 codec.</p> 376 377<table> 378 <thead> 379 <tr> 380 <th> </th> 381 <th><acronym title="Standard definition">SD</a> (Low quality)</th> 382 <th><acronym title="Standard definition">SD</a> (High quality)</th> 383 <th><acronym title="High definition">HD 720p</a> (N/A on all devices)</th> 384 <th><acronym title="High definition">HD 1080p</a> (N/A on all devices)</th> 385 </tr> 386 </thead> 387 <tbody> 388 <tr> 389 <th>Video resolution</th> 390 <td>320 x 180 px</td> 391 <td>640 x 360 px</td> 392 <td>1280 x 720 px</td> 393 <td>1920 x 1080 px</td> 394 </tr> 395 <tr> 396 <th>Video frame rate</th> 397 <td>30 fps</td> 398 <td>30 fps</td> 399 <td>30 fps</td> 400 <td>30 fps</td> 401 </tr> 402 <tr> 403 <th>Video bitrate</th> 404 <td>800 Kbps</td> 405 <td>2 Mbps</td> 406 <td>4 Mbps</td> 407 <td>10 Mbps</td> 408 </tr> 409 </tbody> 410</table> 411 412 413 414 415<p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p> 416 417<ul> 418 <li>For 3GPP and MPEG-4 containers, the <code>moov</code> atom must precede any <code>mdat</code> atoms, but must succeed the 419 <code>ftyp</code> atom.</li> 420 <li>For 3GPP, MPEG-4, and WebM containers, audio and video samples corresponding to the same time offset may be no more than 500 KB apart. 421 To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.</li> 422</ul> 423