blob: e128a1cc0347c35f1c3530baac6489c33cce1f85 [file] [log] [blame]
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">Audio and Video</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 progressive streaming</li>
<li>HTTP live streaming <a href="http://tools.ietf.org/html/draft-pantos-http-live-streaming-05">draft protocol</a> (Android 3.0 and above)</li>
</ul>
<p class="note"><strong>Note:</strong> HTTPS is not supported at this time.</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>
<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="10">Audio</td>
<td>AAC LC/LTP</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td style="text-align: center;"><big>&bull;</big></td>
<td rowspan="3">Mono/Stereo content in any combination of standard bit
rates up to 160 kbps and sampling rates from 8 to 48kHz</td>
<td rowspan="3">3GPP (.3gp), and MPEG-4 (.mp4, .m4a). ADTS raw AAC (.aac, decode only, ADIF not supported, Android 3.1+). </td>
</tr>
<tr>
<td>HE-AACv1 (AAC+)</td>
<td>&nbsp;</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>
</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;"><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>Type 0 and 1 (.mid, .xmf, .mxmf). Also RTTTL/RTX (.rtttl, .rtx), OTA (.ota), and iMelody (.imy)</td>
</tr>
<tr>
<td>Ogg Vorbis</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>&nbsp;</td>
<td>Ogg (.ogg)</td>
</tr>
<tr>
<td>PCM/WAVE</td>
<td>&nbsp;</td>
<td style="text-align: center;"><big>&bull;</big></td>
<td>8- and 16-bit linear PCM (rates up to limit of hardware)</td>
<td>WAVE (.wav)</td>
</tr>
<tr>
<td rowspan="4">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 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>3GPP (.3gp) and 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;"><big>&bull;</big></td>
<td>Baseline Profile (BP)</td>
<td>3GPP (.3gp) and MPEG-4 (.mp4). 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;"><big>&bull;</big><br><small>(Android 2.3.3+)</small></td>
<td>&nbsp;</td>
<td><a href="http://www.webmproject.org/">WebM</a> (.webm)</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 video recording 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 style="background-color:#f3f3f3;font-weight:normal">Lower quality</th>
<th style="background-color:#f3f3f3;font-weight:normal">Higher quality</th>
</tr>
</thead>
<tbody>
<tr>
<th>Video codec</th>
<td>H.264 Baseline Profile</th>
<td>H.264 Baseline Profile</th>
</tr>
<tr>
<th>Video resolution</th>
<td>176 x 144 px</th>
<td>480 x 360 px</th>
</tr>
<tr>
<th>Video frame rate</th>
<td>12 fps</th>
<td>30 fps</th>
</tr>
<tr>
<th>Video bitrate</th>
<td>56 Kbps</th>
<td>500 Kbps</th>
</tr>
<tr>
<th>Audio codec</th>
<td>AAC-LC</th>
<td>AAC-LC</th>
</tr>
<tr>
<th>Audio channels</th>
<td>1 (mono)</th>
<td>2 (stereo)</th>
</tr>
<tr>
<th>Audio bitrate</th>
<td>24 Kbps</th>
<td>128 Kbps</th>
</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.</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>