Home | History | Annotate | Download | only in appendix
      1 page.title=Supported Media Formats
      2 page.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&mdash;for example &quot;(Android 3.0+)&quot;.</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="11">Audio</td>
     75 <td>AAC LC</td>
     76 <td style="text-align: center;"><big>&bull;</big></td>
     77 <td style="text-align: center;"><big>&bull;</big></td>
     78 <td rowspan="2">Support for mono/stereo/5.0/5.1
     79 content with standard sampling rates from 8 to 48 kHz.</td>
     80 <td rowspan="4">
     81   &bull; 3GPP (.3gp)<br>
     82   <nobr>&bull; MPEG-4 (.mp4, .m4a)</nobr><br>
     83   &bull; ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported)<br>
     84   &bull; 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>&bull;</big><br><small>(Android 4.1+)</small></td>
     90 <td style="text-align: center;"><big>&bull;</big></td>
     91 </tr>
     92 
     93 <tr>
     94 <td>HE-AACv2 (enhanced AAC+)</td>
     95 <td>&nbsp;</td>
     96 <td style="text-align: center;"><big>&bull;</big></td>
     97 <td>Support for stereo/5.0/5.1
     98 content 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>&bull;</big><br><small>(Android 4.1+)</small></td>
    104 <td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
    105 <td>Support for mono/stereo content
    106 with 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>&bull;</big></td>
    112 <td style="text-align: center;"><big>&bull;</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>&bull;</big></td>
    121 <td style="text-align: center;"><big>&bull;</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>&nbsp;</td>
    130 <td style="text-align: center;" nowrap><big>&bull;</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
    132 kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz
    133 downsampler does not include a low-pass filter). 16-bit recommended;
    134 no 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>&nbsp;</td>
    143 <td style="text-align: center;"><big>&bull;</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>&nbsp;</td>
    153 <td style="text-align: center;"><big>&bull;</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   &bull; Type 0 and 1 (.mid, .xmf, .mxmf)<br>
    157   &bull; RTTTL/RTX (.rtttl, .rtx)<br>
    158   &bull; OTA (.ota)<br>
    159   &bull; iMelody (.imy)</td>
    160 </tr>
    161 
    162 <tr>
    163 <td>Vorbis</td>
    164 <td>&nbsp;</td>
    165 <td style="text-align: center;"><big>&bull;</big></td>
    166 <td>&nbsp;</td>
    167 <td>
    168   &bull; Ogg (.ogg)<br>
    169   &bull; Matroska (.mkv, Android 4.0+)</td>
    170 </tr>
    171 
    172 <tr>
    173 <td>PCM/WAVE</td>
    174 <td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
    175 <td style="text-align: center;"><big>&bull;</big></td>
    176 <td>8- and 16-bit linear PCM (rates up to limit of hardware). Sampling
    177 rates for raw PCM recordings at 8000, 16000 and 44100 Hz.</td>
    178 <td>
    179   WAVE (.wav)</td>
    180 </tr>
    181 
    182 <tr>
    183 <td rowspan="5">Image</td>
    184 <td>JPEG</td>
    185 <td style="text-align: center;"><big>&bull;</big></td>
    186 <td style="text-align: center;"><big>&bull;</big></td>
    187 <td>Base+progressive</td>
    188 <td>
    189   JPEG (.jpg)</td>
    190 </tr>
    191 
    192 <tr>
    193 <td>GIF</td>
    194 <td>&nbsp;</td>
    195 <td style="text-align: center;"><big>&bull;</big></td>
    196 <td>&nbsp;</td>
    197 <td>
    198   GIF (.gif)</td>
    199 </tr>
    200 
    201 <tr>
    202 <td>PNG</td>
    203 <td style="text-align: center;"><big>&bull;</big></td>
    204 <td style="text-align: center;"><big>&bull;</big></td>
    205 <td>&nbsp;</td>
    206 <td>
    207   PNG (.png)</td>
    208 </tr>
    209 
    210 <tr>
    211 <td>BMP</td>
    212 <td>&nbsp;</td>
    213 <td style="text-align: center;"><big>&bull;</big></td>
    214 <td>&nbsp;</td>
    215 <td>
    216   BMP (.bmp)</td>
    217 </tr>
    218 
    219 <tr>
    220 <td>WebP</td>
    221 <td style="text-align: center;" nowrap>
    222   <big>&bull;</big><br>
    223   <small>(Android 4.0+)</small><br>
    224   <small>(Lossless, Transparency, Android 4.2.1+)</small>
    225 </td>
    226 <td style="text-align: center;" nowrap>
    227   <big>&bull;</big><br>
    228   <small>(Android 4.0+)</small><br>
    229   <small>(Lossless, Transparency, Android 4.2.1+)</small>
    230 </td>
    231 <td>&nbsp;</td>
    232 <td>
    233   WebP (.webp)</td>
    234 </tr>
    235 
    236 
    237 <tr>
    238 <td rowspan="4">Video</td>
    239 <td>H.263</td>
    240 <td style="text-align: center;"><big>&bull;</big></td>
    241 <td style="text-align: center;"><big>&bull;</big></td>
    242 <td>&nbsp;</td>
    243 <td>
    244   &bull; 3GPP (.3gp)<br>
    245   &bull; MPEG-4 (.mp4)</td>
    246 </tr>
    247 
    248 <tr>
    249 <td>H.264 AVC</td>
    250 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
    251 <td style="text-align: center;" nowrap><big>&bull;</big></td>
    252 <td>Baseline Profile (BP)</td>
    253 <td>
    254   &bull; 3GPP (.3gp)<br>
    255   &bull; MPEG-4 (.mp4)<br>
    256   &bull; MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)</td>
    257 </tr>
    258 
    259 <tr>
    260 <td>MPEG-4 SP</td>
    261 <td>&nbsp;</td>
    262 <td style="text-align: center;"><big>&bull;</big></td>
    263 <td>&nbsp;</td>
    264 <td>
    265   3GPP (.3gp)</td>
    266 </tr>
    267 
    268 <tr>
    269 <td>VP8</td>
    270 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.3+)</small></td>
    271 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 2.3.3+)</small></td>
    272 <td>Streamable only in Android 4.0 and above</td>
    273 <td>
    274   &bull; <a href="http://www.webmproject.org/">WebM</a> (.webm)<br>
    275   &bull; Matroska (.mkv, Android 4.0+)</td>
    276 </tr>
    277 
    278 </tbody></table>
    279 
    280 
    281 <h2 id="recommendations">Video Encoding Recommendations</h2>
    282 
    283 <p>Table 2, below, lists examples of video encoding profiles and parameters that the Android
    284 media framework supports for playback in the H.264 Baseline Profile codec. While
    285 table 3 lists examples that the framework supports for playback in the VP8 media codec.</p>
    286 
    287 <p>In addition to these encoding parameter recommendations,
    288 a device's available <em>video recording</em> profiles can be used as a proxy for media playback
    289 capabilities. These profiles can be inspected using the {@link android.media.CamcorderProfile
    290 CamcorderProfile} class, which is available since API level 8.</p>
    291 
    292 <p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong>
    293 Examples of supported video encoding parameters for the H.264 Baseline Profile codec.</p>
    294 
    295 <table>
    296   <thead>
    297   <tr>
    298     <th>&nbsp;</th>
    299     <th><acronym title="Standard definition">SD</a> (Low quality)</th>
    300     <th><acronym title="Standard definition">SD</a> (High quality)</th>
    301     <th><acronym title="High definition">HD 720p</a> (N/A on all devices)</th>
    302   </tr>
    303   </thead>
    304   <tbody>
    305   <tr>
    306     <th>Video resolution</th>
    307     <td>176 x 144 px</td>
    308     <td>480 x 360 px</td>
    309     <td>1280 x 720 px</td>
    310   </tr>
    311   <tr>
    312     <th>Video frame rate</th>
    313     <td>12 fps</td>
    314     <td>30 fps</td>
    315     <td>30 fps</td>
    316   </tr>
    317   <tr>
    318     <th>Video bitrate</th>
    319     <td>56 Kbps</td>
    320     <td>500 Kbps</td>
    321     <td>2 Mbps</td>
    322   </tr>
    323   <tr>
    324     <th>Audio codec</th>
    325     <td>AAC-LC</td>
    326     <td>AAC-LC</td>
    327     <td>AAC-LC</td>
    328   </tr>
    329   <tr>
    330     <th>Audio channels</th>
    331     <td>1 (mono)</td>
    332     <td>2 (stereo)</td>
    333     <td>2 (stereo)</td>
    334   </tr>
    335   <tr>
    336     <th>Audio bitrate</th>
    337     <td>24 Kbps</td>
    338     <td>128 Kbps</td>
    339     <td>192 Kbps</td>
    340   </tr>
    341   </tbody>
    342 </table>
    343 
    344 
    345 
    346 <p class="table-caption" id="encoding-recommendations-table-vp8"><strong>Table 3.</strong>
    347 Examples of supported video encoding parameters for the VP8 codec.</p>
    348 
    349 <table>
    350   <thead>
    351   <tr>
    352     <th>&nbsp;</th>
    353     <th><acronym title="Standard definition">SD</a> (Low quality)</th>
    354     <th><acronym title="Standard definition">SD</a> (High quality)</th>
    355     <th><acronym title="High definition">HD 720p</a> (N/A on all devices)</th>
    356     <th><acronym title="High definition">HD 1080p</a> (N/A on all devices)</th>
    357   </tr>
    358   </thead>
    359   <tbody>
    360   <tr>
    361     <th>Video resolution</th>
    362     <td>320 x 180 px</td>
    363     <td>640 x 360 px</td>
    364     <td>1280 x 720 px</td>
    365     <td>1920 x 1080 px</td>
    366   </tr>
    367   <tr>
    368     <th>Video frame rate</th>
    369     <td>30 fps</td>
    370     <td>30 fps</td>
    371     <td>30 fps</td>
    372     <td>30 fps</td>
    373   </tr>
    374   <tr>
    375     <th>Video bitrate</th>
    376     <td>800 Kbps</td>
    377     <td>2 Mbps</td>
    378     <td>4 Mbps</td>
    379     <td>10 Mbps</td>
    380   </tr>
    381   </tbody>
    382 </table>
    383 
    384 
    385 
    386 
    387 <p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p>
    388 
    389 <ul>
    390   <li>For 3GPP and MPEG-4 containers, the <code>moov</code> atom must precede any <code>mdat</code> atoms, but must succeed the
    391       <code>ftyp</code> atom.</li>
    392   <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.
    393       To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.</li>
    394 </ul>
    395