Home | History | Annotate | Download | only in appendix
      1 page.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&mdash;for example &quot;(Android 3.0+)&quot;.</p>
     57 
     58 <p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p>
     59 
     60 <table>
     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="10">Audio</td>
     74 <td>AAC LC/LTP</td>
     75 <td style="text-align: center;"><big>&bull;</big></td>
     76 <td style="text-align: center;"><big>&bull;</big></td>
     77 <td rowspan="3">Mono/Stereo content in any combination of standard bit
     78 rates up to 160 kbps and sampling rates from 8 to 48kHz</td>
     79 <td rowspan="3">
     80   &bull; 3GPP (.3gp)<br>
     81   &bull; MPEG-4 (.mp4, .m4a)<br>
     82   &bull; ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported)<br>
     83   &bull; MPEG-TS (.ts, not seekable, Android 3.0+)</td>
     84 </tr>
     85 
     86 <tr>
     87 <td>HE-AACv1 (AAC+)</td>
     88 <td>&nbsp;</td>
     89 <td style="text-align: center;"><big>&bull;</big></td>
     90 </tr>
     91 
     92 <tr>
     93 <td>HE-AACv2 (enhanced AAC+)</td>
     94 <td>&nbsp;</td>
     95 <td style="text-align: center;"><big>&bull;</big></td>
     96 </tr>
     97 
     98 <tr>
     99 <td>AMR-NB</td>
    100 <td style="text-align: center;"><big>&bull;</big></td>
    101 <td style="text-align: center;"><big>&bull;</big></td>
    102 <td>4.75 to 12.2 kbps sampled @ 8kHz</td>
    103 <td>
    104   3GPP (.3gp)</td>
    105 </tr>
    106 
    107 <tr>
    108 <td>AMR-WB</td>
    109 <td style="text-align: center;"><big>&bull;</big></td>
    110 <td style="text-align: center;"><big>&bull;</big></td>
    111 <td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td>
    112 <td>
    113   3GPP (.3gp)</td>
    114 </tr>
    115 
    116 <tr>
    117 <td>FLAC</td>
    118 <td>&nbsp;</td>
    119 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.1+)</small></td>
    120 <td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1
    121 kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz
    122 downsampler does not include a low-pass filter). 16-bit recommended;
    123 no dither applied for 24-bit.
    124 </td>
    125 <td>
    126   FLAC (.flac) only</td>
    127 </tr>
    128 
    129 <tr>
    130 <td>MP3</td>
    131 <td>&nbsp;</td>
    132 <td style="text-align: center;"><big>&bull;</big></td>
    133 <td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR)
    134 </td>
    135 <td>
    136   MP3 (.mp3)</td>
    137 </tr>
    138 
    139 <tr>
    140 <td>MIDI</td>
    141 <td>&nbsp;</td>
    142 <td style="text-align: center;"><big>&bull;</big></td>
    143 <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>
    144 <td>
    145   &bull; Type 0 and 1 (.mid, .xmf, .mxmf)<br>
    146   &bull; RTTTL/RTX (.rtttl, .rtx)<br>
    147   &bull; OTA (.ota)<br>
    148   &bull; iMelody (.imy)</td>
    149 </tr>
    150 
    151 <tr>
    152 <td>Vorbis</td>
    153 <td>&nbsp;</td>
    154 <td style="text-align: center;"><big>&bull;</big></td>
    155 <td>&nbsp;</td>
    156 <td>
    157   &bull; Ogg (.ogg)<br>
    158   &bull; Matroska (.mkv, Android 4.0+)</td>
    159 </tr>
    160 
    161 <tr>
    162 <td>PCM/WAVE</td>
    163 <td>&nbsp;</td>
    164 <td style="text-align: center;"><big>&bull;</big></td>
    165 <td>8- and 16-bit linear PCM (rates up to limit of hardware)</td>
    166 <td>
    167   WAVE (.wav)</td>
    168 </tr>
    169 
    170 <tr>
    171 <td rowspan="5">Image</td>
    172 <td>JPEG</td>
    173 <td style="text-align: center;"><big>&bull;</big></td>
    174 <td style="text-align: center;"><big>&bull;</big></td>
    175 <td>Base+progressive</td>
    176 <td>
    177   JPEG (.jpg)</td>
    178 </tr>
    179 
    180 <tr>
    181 <td>GIF</td>
    182 <td>&nbsp;</td>
    183 <td style="text-align: center;"><big>&bull;</big></td>
    184 <td>&nbsp;</td>
    185 <td>
    186   GIF (.gif)</td>
    187 </tr>
    188 
    189 <tr>
    190 <td>PNG</td>
    191 <td style="text-align: center;"><big>&bull;</big></td>
    192 <td style="text-align: center;"><big>&bull;</big></td>
    193 <td>&nbsp;</td>
    194 <td>
    195   PNG (.png)</td>
    196 </tr>
    197 
    198 <tr>
    199 <td>BMP</td>
    200 <td>&nbsp;</td>
    201 <td style="text-align: center;"><big>&bull;</big></td>
    202 <td>&nbsp;</td>
    203 <td>
    204   BMP (.bmp)</td>
    205 </tr>
    206 
    207 <tr>
    208 <td>WEBP</td>
    209 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
    210 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
    211 <td>&nbsp;</td>
    212 <td>
    213   WebP (.webp)</td>
    214 </tr>
    215 
    216 
    217 <tr>
    218 <td rowspan="4">Video</td>
    219 <td>H.263</td>
    220 <td style="text-align: center;"><big>&bull;</big></td>
    221 <td style="text-align: center;"><big>&bull;</big></td>
    222 <td>&nbsp;</td>
    223 <td>
    224   &bull; 3GPP (.3gp)<br>
    225   &bull; MPEG-4 (.mp4)</td>
    226 </tr>
    227 
    228 <tr>
    229 <td>H.264 AVC</td>
    230 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
    231 <td style="text-align: center;" nowrap><big>&bull;</big></td>
    232 <td>Baseline Profile (BP)</td>
    233 <td>
    234   &bull; 3GPP (.3gp)<br>
    235   &bull; MPEG-4 (.mp4)<br>
    236   &bull; MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)</td>
    237 </tr>
    238 
    239 <tr>
    240 <td>MPEG-4 SP</td>
    241 <td>&nbsp;</td>
    242 <td style="text-align: center;"><big>&bull;</big></td>
    243 <td>&nbsp;</td>
    244 <td>
    245   3GPP (.3gp)</td>
    246 </tr>
    247 
    248 <tr>
    249 <td>VP8</td>
    250 <td>&nbsp;</td>
    251 <td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 2.3.3+)</small></td>
    252 <td>Streamable only in Android 4.0 and above</td>
    253 <td>
    254   &bull; <a href="http://www.webmproject.org/">WebM</a> (.webm)<br>
    255   &bull; Matroska (.mkv, Android 4.0+)</td>
    256 </tr>
    257 
    258 </tbody></table>
    259 
    260 
    261 <h2 id="recommendations">Video Encoding Recommendations</h2>
    262 
    263 <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>
    264 
    265 <p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong> Examples of supported video encoding parameters.</p>
    266 
    267 <table>
    268   <thead>
    269   <tr>
    270     <th>&nbsp;</th>
    271     <th><acronym title="Standard definition">SD</a> (Low quality)</th>
    272     <th><acronym title="Standard definition">SD</a> (High quality)</th>
    273     <th><acronym title="High definition">HD</a> (Not available on all devices)</th>
    274   </tr>
    275   </thead>
    276   <tbody>
    277   <tr>
    278     <th>Video codec</th>
    279     <td>H.264 Baseline Profile</td>
    280     <td>H.264 Baseline Profile</td>
    281     <td>H.264 Baseline Profile</td>
    282   </tr>
    283   <tr>
    284     <th>Video resolution</th>
    285     <td>176 x 144 px</td>
    286     <td>480 x 360 px</td>
    287     <td>1280 x 720 px</td>
    288   </tr>
    289   <tr>
    290     <th>Video frame rate</th>
    291     <td>12 fps</td>
    292     <td>30 fps</td>
    293     <td>30 fps</td>
    294   </tr>
    295   <tr>
    296     <th>Video bitrate</th>
    297     <td>56 Kbps</td>
    298     <td>500 Kbps</td>
    299     <td>2 Mbps</td>
    300   </tr>
    301   <tr>
    302     <th>Audio codec</th>
    303     <td>AAC-LC</td>
    304     <td>AAC-LC</td>
    305     <td>AAC-LC</td>
    306   </tr>
    307   <tr>
    308     <th>Audio channels</th>
    309     <td>1 (mono)</td>
    310     <td>2 (stereo)</td>
    311     <td>2 (stereo)</td>
    312   </tr>
    313   <tr>
    314     <th>Audio bitrate</th>
    315     <td>24 Kbps</td>
    316     <td>128 Kbps</td>
    317     <td>192 Kbps</td>
    318   </tr>
    319   </tbody>
    320 </table>
    321 
    322 <p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p>
    323 
    324 <ul>
    325   <li>For 3GPP and MPEG-4 containers, the <code>moov</code> atom must precede any <code>mdat</code> atoms, but must succeed the
    326       <code>ftyp</code> atom.</li>
    327   <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.
    328       To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.</li>
    329 </ul>
    330