blob: 137f13811d11cb4a4fda718b784573aa5956d558 [file] [log] [blame]
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08001page.title=Android Supported Media Formats
2@jd:body
3
Roman Nurik7641db42011-01-21 15:52:38 -08004<div id="qv-wrapper">
5<div id="qv">
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08006
Roman Nurik7641db42011-01-21 15:52:38 -08007<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>
Joe Fernandez6d786392011-08-22 15:49:52 -070017<li><a href="{@docRoot}guide/topics/media/index.html">Multimedia and Camera</a></li>
Roman Nurik7641db42011-01-21 15:52:38 -080018</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>
Roman Nurik48acca62011-08-18 16:40:36 -070040 <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>
Roman Nurik7641db42011-01-21 15:52:38 -080047</ul>
48
Roman Nurik48acca62011-08-18 16:40:36 -070049<p class="note"><strong>Note:</strong> HTTPS is not supported before Android 3.1.</p>
Roman Nurik7641db42011-01-21 15:52:38 -080050
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080051
52<h2 id="core">Core Media Formats</h2>
53
Roman Nurik7641db42011-01-21 15:52:38 -080054<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
Roman Nurikc8754f32011-04-06 14:52:00 -070058<p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p>
59
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080060<table>
61<tbody>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062
Dirk Dougherty88a1fc22011-04-01 15:55:28 -070063<tr>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080064<th>Type</th>
Roman Nurik7641db42011-01-21 15:52:38 -080065<th>Format / Codec</th>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080066<th>Encoder</th>
67<th>Decoder</th>
68<th>Details</th>
Roman Nurik7641db42011-01-21 15:52:38 -080069<th>Supported File Type(s) / Container Formats</th>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080070</tr>
71
72<tr>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -070073<td rowspan="10">Audio</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080074<td>AAC LC/LTP</td>
Roman Nurik7641db42011-01-21 15:52:38 -080075<td style="text-align: center;"><big>&bull;</big></td>
76<td style="text-align: center;"><big>&bull;</big></td>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -070077<td rowspan="3">Mono/Stereo content in any combination of standard bit
78rates up to 160 kbps and sampling rates from 8 to 48kHz</td>
Roman Nurik48acca62011-08-18 16:40:36 -070079<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080084</tr>
85
86<tr>
87<td>HE-AACv1 (AAC+)</td>
88<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -080089<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080090</tr>
91
92<tr>
93<td>HE-AACv2 (enhanced AAC+)</td>
94<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -080095<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080096</tr>
97
98<tr>
99<td>AMR-NB</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800100<td style="text-align: center;"><big>&bull;</big></td>
101<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800102<td>4.75 to 12.2 kbps sampled @ 8kHz</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700103<td>
104 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800105</tr>
106
107<tr>
108<td>AMR-WB</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800109<td style="text-align: center;"><big>&bull;</big></td>
110<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800111<td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700112<td>
113 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800114</tr>
115
116<tr>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700117<td>FLAC</td>
118<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700119<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.1+)</small></td>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700120<td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1
121kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz
122downsampler does not include a low-pass filter). 16-bit recommended;
123no dither applied for 24-bit.
124</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700125<td>
126 FLAC (.flac) only</td>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700127</tr>
128
129<tr>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800130<td>MP3</td>
131<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800132<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800133<td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR)
134</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700135<td>
136 MP3 (.mp3)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800137</tr>
138
139<tr>
140<td>MIDI</td>
141<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800142<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800143<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>
Roman Nurik48acca62011-08-18 16:40:36 -0700144<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800149</tr>
150
151<tr>
Roman Nurik48acca62011-08-18 16:40:36 -0700152<td>Vorbis</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800153<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800154<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800155<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700156<td>
157 &bull; Ogg (.ogg)<br>
158 &bull; Matroska (.mkv, Android 4.0+)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800159</tr>
160
161<tr>
162<td>PCM/WAVE</td>
163<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800164<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800165<td>8- and 16-bit linear PCM (rates up to limit of hardware)</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700166<td>
167 WAVE (.wav)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800168</tr>
169
170<tr>
Roman Nurik48acca62011-08-18 16:40:36 -0700171<td rowspan="5">Image</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800172<td>JPEG</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800173<td style="text-align: center;"><big>&bull;</big></td>
174<td style="text-align: center;"><big>&bull;</big></td>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700175<td>Base+progressive</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700176<td>
177 JPEG (.jpg)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800178</tr>
179
180<tr>
181<td>GIF</td>
182<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800183<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700185<td>
186 GIF (.gif)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800187</tr>
188
189<tr>
190<td>PNG</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800191<td style="text-align: center;"><big>&bull;</big></td>
192<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800193<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700194<td>
195 PNG (.png)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196</tr>
197
198<tr>
199<td>BMP</td>
200<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800201<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800202<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700203<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800214</tr>
215
Roman Nurik7641db42011-01-21 15:52:38 -0800216
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800217<tr>
Roman Nurika02c3cb2011-02-22 10:29:00 -0800218<td rowspan="4">Video</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800219<td>H.263</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800220<td style="text-align: center;"><big>&bull;</big></td>
221<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800222<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700223<td>
224 &bull; 3GPP (.3gp)<br>
225 &bull; MPEG-4 (.mp4)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800226</tr>
227
228<tr>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700229<td>H.264 AVC</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800230<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
Roman Nurik48acca62011-08-18 16:40:36 -0700231<td style="text-align: center;" nowrap><big>&bull;</big></td>
Roman Nurik7641db42011-01-21 15:52:38 -0800232<td>Baseline Profile (BP)</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700233<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237</tr>
238
239<tr>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700240<td>MPEG-4 SP</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800241<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800242<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800243<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700244<td>
245 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246</tr>
247
Roman Nurika02c3cb2011-02-22 10:29:00 -0800248<tr>
249<td>VP8</td>
250<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700251<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>
Roman Nurika02c3cb2011-02-22 10:29:00 -0800256</tr>
257
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800258</tbody></table>
259
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800260
Roman Nurik7641db42011-01-21 15:52:38 -0800261<h2 id="recommendations">Video Encoding Recommendations</h2>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800262
Roman Nurik48acca62011-08-18 16:40:36 -0700263<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>
Roman Nurikc8754f32011-04-06 14:52:00 -0700264
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>
Roman Nurik48acca62011-08-18 16:40:36 -0700271 <th style="background-color:#f3f3f3;font-weight:normal"><acronym title="Standard definition">SD</a> (Low quality)</th>
272 <th style="background-color:#f3f3f3;font-weight:normal"><acronym title="Standard definition">SD</a> (High quality)</th>
273 <th style="background-color:#f3f3f3;font-weight:normal"><acronym title="High definition">HD</a> (Not available on all devices)</th>
Roman Nurikc8754f32011-04-06 14:52:00 -0700274 </tr>
275 </thead>
276 <tbody>
277 <tr>
278 <th>Video codec</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700279 <td>H.264 Baseline Profile</td>
280 <td>H.264 Baseline Profile</td>
281 <td>H.264 Baseline Profile</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700282 </tr>
283 <tr>
284 <th>Video resolution</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700285 <td>176 x 144 px</td>
286 <td>480 x 360 px</td>
287 <td>1280 x 720 px</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700288 </tr>
289 <tr>
290 <th>Video frame rate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700291 <td>12 fps</td>
292 <td>30 fps</td>
293 <td>30 fps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700294 </tr>
295 <tr>
296 <th>Video bitrate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700297 <td>56 Kbps</td>
298 <td>500 Kbps</td>
299 <td>2 Mbps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700300 </tr>
301 <tr>
302 <th>Audio codec</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700303 <td>AAC-LC</td>
304 <td>AAC-LC</td>
305 <td>AAC-LC</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700306 </tr>
307 <tr>
308 <th>Audio channels</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700309 <td>1 (mono)</td>
310 <td>2 (stereo)</td>
311 <td>2 (stereo)</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700312 </tr>
313 <tr>
314 <th>Audio bitrate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700315 <td>24 Kbps</td>
316 <td>128 Kbps</td>
317 <td>192 Kbps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700318 </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>
Dirk Dougherty226299442009-05-22 15:11:27 -0700323
Roman Nurik7641db42011-01-21 15:52:38 -0800324<ul>
Roman Nurik48acca62011-08-18 16:40:36 -0700325 <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>
Roman Nurikc8754f32011-04-06 14:52:00 -0700327 <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>
Roman Nurik7641db42011-01-21 15:52:38 -0800329</ul>