page.title=Android Supported Media Formats
@jd:body

<div id="qv-wrapper">
<div id="qv">

<h2>In this document</h2>

<ol>
<li><a href="#network">Network Protocols</a></li>
<li><a href="#core">Core Media Formats</a></li>
<li><a href="#recommendations">Video Encoding Recommendations</a></li>
</ol>

<h2>See also</h2>
<ol>
<li><a href="{@docRoot}guide/topics/media/index.html">Multimedia and Camera</a></li>
</ol>

<h2>Key classes</h2>
<ol>
<li>{@link android.media.MediaPlayer MediaPlayer}</li>
<li>{@link android.media.MediaRecorder MediaRecorder}</li>
</ol>

</div>
</div>

<p>This document describes the media codec, container, and network protocol support provided by the Android platform.</p>

<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>


<h2 id="network">Network Protocols</h2>

<p>The following network protocols are supported for audio and video playback:</p>

<ul>
  <li>RTSP (RTP, SDP)</li>
  <li>HTTP/HTTPS progressive streaming</li>
  <li>HTTP/HTTPS live streaming <a href="http://tools.ietf.org/html/draft-pantos-http-live-streaming">draft protocol</a>: <ul>
    <li>MPEG-2 TS media files only</li>
    <li>Protocol version 3 (Android 4.0 and above)</li>
    <li>Protocol version 2 (Android 3.x)</li>
    <li>Not supported before Android 3.0</li>
  </ul></li>
</ul>

<p class="note"><strong>Note:</strong> HTTPS is not supported before Android 3.1.</p>


<h2 id="core">Core Media Formats</h2>

<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>

<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>

<p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p>

<table style="font-size:12px">
<tbody>

<tr>
<th>Type</th>
<th>Format / Codec</th>
<th>Encoder</th>
<th>Decoder</th>
<th>Details</th>
<th>Supported File Type(s) / Container Formats</th>
</tr>

<tr>
<td rowspan="11">Audio</td>
<td>AAC LC</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td rowspan="2">Support for mono/stereo/5.0/5.1
content with standard sampling rates from 8 to 48 kHz.</td>
<td rowspan="4">
  &bull; 3GPP (.3gp)<br>
  <nobr>&bull; MPEG-4 (.mp4, .m4a)</nobr><br>
  &bull; ADTS raw AAC (.aac, decode in Android 3.1+, encode in Android 4.0+, ADIF not supported)<br>
  &bull; MPEG-TS (.ts, not seekable, Android 3.0+)</td>
</tr>

<tr>
<td>HE-AACv1 (AAC+)</td>
<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
<td style="text-align: center;"><big>&bull;</big></td>
</tr>

<tr>
<td>HE-AACv2 (enhanced AAC+)</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>Support for stereo/5.0/5.1
content with standard sampling rates from 8 to 48 kHz.</td>
</tr>

<tr>
<td>AAC ELD (enhanced low delay AAC)</td>
<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
<td>Support for mono/stereo content
with standard sampling rates from 16 to 48 kHz</td>
</tr>

<tr>
<td>AMR-NB</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>4.75 to 12.2 kbps sampled @ 8kHz</td>
<td>
  3GPP (.3gp)</td>
</tr>

<tr>
<td>AMR-WB</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td>
<td>
  3GPP (.3gp)</td>
</tr>

<tr>
<td>FLAC</td>
<td>&nbsp;</td>
<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.1+)</small></td>
<td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1
kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz
downsampler does not include a low-pass filter). 16-bit recommended;
no dither applied for 24-bit.
</td>
<td>
  FLAC (.flac) only</td>
</tr>

<tr>
<td>MP3</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR)
</td>
<td>
  MP3 (.mp3)</td>
</tr>

<tr>
<td>MIDI</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<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>
<td>
  &bull; Type 0 and 1 (.mid, .xmf, .mxmf)<br>
  &bull; RTTTL/RTX (.rtttl, .rtx)<br>
  &bull; OTA (.ota)<br>
  &bull; iMelody (.imy)</td>
</tr>

<tr>
<td>Vorbis</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  &bull; Ogg (.ogg)<br>
  &bull; Matroska (.mkv, Android 4.0+)</td>
</tr>

<tr>
<td>PCM/WAVE</td>
<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>8- and 16-bit linear PCM (rates up to limit of hardware). Sampling
rates for raw PCM recordings at 8000, 16000 and 44100 Hz.</td>
<td>
  WAVE (.wav)</td>
</tr>

<tr>
<td rowspan="5">Image</td>
<td>JPEG</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>Base+progressive</td>
<td>
  JPEG (.jpg)</td>
</tr>

<tr>
<td>GIF</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  GIF (.gif)</td>
</tr>

<tr>
<td>PNG</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  PNG (.png)</td>
</tr>

<tr>
<td>BMP</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  BMP (.bmp)</td>
</tr>

<tr>
<td>WEBP</td>
<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
<td>&nbsp;</td>
<td>
  WebP (.webp)</td>
</tr>


<tr>
<td rowspan="4">Video</td>
<td>H.263</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  &bull; 3GPP (.3gp)<br>
  &bull; MPEG-4 (.mp4)</td>
</tr>

<tr>
<td>H.264 AVC</td>
<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
<td style="text-align: center;" nowrap><big>&bull;</big></td>
<td>Baseline Profile (BP)</td>
<td>
  &bull; 3GPP (.3gp)<br>
  &bull; MPEG-4 (.mp4)<br>
  &bull; MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)</td>
</tr>

<tr>
<td>MPEG-4 SP</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>
  3GPP (.3gp)</td>
</tr>

<tr>
<td>VP8</td>
<td>&nbsp;</td>
<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 2.3.3+)</small></td>
<td>Streamable only in Android 4.0 and above</td>
<td>
  &bull; <a href="http://www.webmproject.org/">WebM</a> (.webm)<br>
  &bull; Matroska (.mkv, Android 4.0+)</td>
</tr>

</tbody></table>


<h2 id="recommendations">Video Encoding Recommendations</h2>

<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>

<p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong> Examples of supported video encoding parameters.</p>

<table>
  <thead>
  <tr>
    <th>&nbsp;</th>
    <th><acronym title="Standard definition">SD</a> (Low quality)</th>
    <th><acronym title="Standard definition">SD</a> (High quality)</th>
    <th><acronym title="High definition">HD</a> (Not available on all devices)</th>
  </tr>
  </thead>
  <tbody>
  <tr>
    <th>Video codec</th>
    <td>H.264 Baseline Profile</td>
    <td>H.264 Baseline Profile</td>
    <td>H.264 Baseline Profile</td>
  </tr>
  <tr>
    <th>Video resolution</th>
    <td>176 x 144 px</td>
    <td>480 x 360 px</td>
    <td>1280 x 720 px</td>
  </tr>
  <tr>
    <th>Video frame rate</th>
    <td>12 fps</td>
    <td>30 fps</td>
    <td>30 fps</td>
  </tr>
  <tr>
    <th>Video bitrate</th>
    <td>56 Kbps</td>
    <td>500 Kbps</td>
    <td>2 Mbps</td>
  </tr>
  <tr>
    <th>Audio codec</th>
    <td>AAC-LC</td>
    <td>AAC-LC</td>
    <td>AAC-LC</td>
  </tr>
  <tr>
    <th>Audio channels</th>
    <td>1 (mono)</td>
    <td>2 (stereo)</td>
    <td>2 (stereo)</td>
  </tr>
  <tr>
    <th>Audio bitrate</th>
    <td>24 Kbps</td>
    <td>128 Kbps</td>
    <td>192 Kbps</td>
  </tr>
  </tbody>
</table>

<p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p>

<ul>
  <li>For 3GPP and MPEG-4 containers, the <code>moov</code> atom must precede any <code>mdat</code> atoms, but must succeed the
      <code>ftyp</code> atom.</li>
  <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.
      To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.</li>
</ul>
