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