blob: 19f510afb1d822f72fd3cbe71f910b8ed3ffed58 [file] [log] [blame]
Scott Mainb8525dd2013-05-23 15:43:37 -07001page.title=Supported Media Formats
Joe Fernandez33baa5a2013-11-14 11:41:19 -08002page.tags=video,audio,mpeg,mp4,m4a,mp3,3gp,3gpp,flac,wave,wav
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08003@jd:body
4
Roman Nurik7641db42011-01-21 15:52:38 -08005<div id="qv-wrapper">
6<div id="qv">
The Android Open Source Project9066cfe2009-03-03 19:31:44 -08007
Roman Nurik7641db42011-01-21 15:52:38 -08008<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>
Joe Fernandez6d786392011-08-22 15:49:52 -070018<li><a href="{@docRoot}guide/topics/media/index.html">Multimedia and Camera</a></li>
Roman Nurik7641db42011-01-21 15:52:38 -080019</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>
Roman Nurik48acca62011-08-18 16:40:36 -070041 <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>
Roman Nurik7641db42011-01-21 15:52:38 -080048</ul>
49
Roman Nurik48acca62011-08-18 16:40:36 -070050<p class="note"><strong>Note:</strong> HTTPS is not supported before Android 3.1.</p>
Roman Nurik7641db42011-01-21 15:52:38 -080051
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080052
53<h2 id="core">Core Media Formats</h2>
54
Roman Nurik7641db42011-01-21 15:52:38 -080055<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
Roman Nurikc8754f32011-04-06 14:52:00 -070059<p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p>
60
Scott Mainb79d8ec2012-09-18 10:40:49 -070061<table style="font-size:12px">
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080062<tbody>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080063
Dirk Dougherty88a1fc22011-04-01 15:55:28 -070064<tr>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080065<th>Type</th>
Roman Nurik7641db42011-01-21 15:52:38 -080066<th>Format / Codec</th>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080067<th>Encoder</th>
68<th>Decoder</th>
69<th>Details</th>
Roman Nurik7641db42011-01-21 15:52:38 -080070<th>Supported File Type(s) / Container Formats</th>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080071</tr>
72
73<tr>
Scott Mainb79d8ec2012-09-18 10:40:49 -070074<td rowspan="11">Audio</td>
75<td>AAC LC</td>
Roman Nurik7641db42011-01-21 15:52:38 -080076<td style="text-align: center;"><big>&bull;</big></td>
77<td style="text-align: center;"><big>&bull;</big></td>
Scott Mainb79d8ec2012-09-18 10:40:49 -070078<td rowspan="2">Support for mono/stereo/5.0/5.1
79content with standard sampling rates from 8 to 48 kHz.</td>
80<td rowspan="4">
Roman Nurik48acca62011-08-18 16:40:36 -070081 &bull; 3GPP (.3gp)<br>
Scott Mainb79d8ec2012-09-18 10:40:49 -070082 <nobr>&bull; MPEG-4 (.mp4, .m4a)</nobr><br>
Roman Nurik48acca62011-08-18 16:40:36 -070083 &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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080085</tr>
86
87<tr>
88<td>HE-AACv1 (AAC+)</td>
Scott Mainb79d8ec2012-09-18 10:40:49 -070089<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
Roman Nurik7641db42011-01-21 15:52:38 -080090<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080091</tr>
92
93<tr>
94<td>HE-AACv2 (enhanced AAC+)</td>
95<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -080096<td style="text-align: center;"><big>&bull;</big></td>
Scott Mainb79d8ec2012-09-18 10:40:49 -070097<td>Support for stereo/5.0/5.1
98content 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
106with standard sampling rates from 16 to 48 kHz</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800107</tr>
108
109<tr>
110<td>AMR-NB</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800111<td style="text-align: center;"><big>&bull;</big></td>
112<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800113<td>4.75 to 12.2 kbps sampled @ 8kHz</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700114<td>
115 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800116</tr>
117
118<tr>
119<td>AMR-WB</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800120<td style="text-align: center;"><big>&bull;</big></td>
121<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800122<td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700123<td>
124 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800125</tr>
126
127<tr>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700128<td>FLAC</td>
129<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700130<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.1+)</small></td>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700131<td>Mono/Stereo (no multichannel). Sample rates up to 48 kHz (but up to 44.1
132kHz is recommended on devices with 44.1 kHz output, as the 48 to 44.1 kHz
133downsampler does not include a low-pass filter). 16-bit recommended;
134no dither applied for 24-bit.
135</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700136<td>
137 FLAC (.flac) only</td>
Dirk Dougherty88a1fc22011-04-01 15:55:28 -0700138</tr>
139
140<tr>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800141<td>MP3</td>
142<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800143<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800144<td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR)
145</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700146<td>
147 MP3 (.mp3)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800148</tr>
149
150<tr>
151<td>MIDI</td>
152<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800153<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800154<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 -0700155<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800160</tr>
161
162<tr>
Roman Nurik48acca62011-08-18 16:40:36 -0700163<td>Vorbis</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800164<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800165<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800166<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700167<td>
168 &bull; Ogg (.ogg)<br>
169 &bull; Matroska (.mkv, Android 4.0+)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800170</tr>
171
172<tr>
173<td>PCM/WAVE</td>
Scott Mainb79d8ec2012-09-18 10:40:49 -0700174<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
Roman Nurik7641db42011-01-21 15:52:38 -0800175<td style="text-align: center;"><big>&bull;</big></td>
Scott Mainb79d8ec2012-09-18 10:40:49 -0700176<td>8- and 16-bit linear PCM (rates up to limit of hardware). Sampling
177rates for raw PCM recordings at 8000, 16000 and 44100 Hz.</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700178<td>
179 WAVE (.wav)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800180</tr>
181
182<tr>
Roman Nurik48acca62011-08-18 16:40:36 -0700183<td rowspan="5">Image</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800184<td>JPEG</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800185<td style="text-align: center;"><big>&bull;</big></td>
186<td style="text-align: center;"><big>&bull;</big></td>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700187<td>Base+progressive</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700188<td>
189 JPEG (.jpg)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800190</tr>
191
192<tr>
193<td>GIF</td>
194<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800195<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800196<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700197<td>
198 GIF (.gif)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800199</tr>
200
201<tr>
202<td>PNG</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800203<td style="text-align: center;"><big>&bull;</big></td>
204<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800205<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700206<td>
207 PNG (.png)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800208</tr>
209
210<tr>
211<td>BMP</td>
212<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800213<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800214<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700215<td>
216 BMP (.bmp)</td>
217</tr>
218
219<tr>
Scott Mainc0da3f12013-10-11 12:03:12 -0700220<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>
Roman Nurik48acca62011-08-18 16:40:36 -0700231<td>&nbsp;</td>
232<td>
233 WebP (.webp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800234</tr>
235
Roman Nurik7641db42011-01-21 15:52:38 -0800236
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800237<tr>
Roman Nurika02c3cb2011-02-22 10:29:00 -0800238<td rowspan="4">Video</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800239<td>H.263</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800240<td style="text-align: center;"><big>&bull;</big></td>
241<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800242<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700243<td>
244 &bull; 3GPP (.3gp)<br>
245 &bull; MPEG-4 (.mp4)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800246</tr>
247
248<tr>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700249<td>H.264 AVC</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800250<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
Roman Nurik48acca62011-08-18 16:40:36 -0700251<td style="text-align: center;" nowrap><big>&bull;</big></td>
Roman Nurik7641db42011-01-21 15:52:38 -0800252<td>Baseline Profile (BP)</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700253<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>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800257</tr>
258
259<tr>
Dirk Doughertyd9671b82009-04-15 11:29:53 -0700260<td>MPEG-4 SP</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800261<td>&nbsp;</td>
Roman Nurik7641db42011-01-21 15:52:38 -0800262<td style="text-align: center;"><big>&bull;</big></td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800263<td>&nbsp;</td>
Roman Nurik48acca62011-08-18 16:40:36 -0700264<td>
265 3GPP (.3gp)</td>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800266</tr>
267
Roman Nurika02c3cb2011-02-22 10:29:00 -0800268<tr>
269<td>VP8</td>
Scott Main99700bf2013-06-18 10:43:35 -0700270<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.3+)</small></td>
Roman Nurik48acca62011-08-18 16:40:36 -0700271<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>
Roman Nurika02c3cb2011-02-22 10:29:00 -0800276</tr>
277
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800278</tbody></table>
279
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800280
Roman Nurik7641db42011-01-21 15:52:38 -0800281<h2 id="recommendations">Video Encoding Recommendations</h2>
The Android Open Source Project9066cfe2009-03-03 19:31:44 -0800282
Scott Main99700bf2013-06-18 10:43:35 -0700283<p>Table 2, below, lists examples of video encoding profiles and parameters that the Android
284media framework supports for playback in the H.264 Baseline Profile codec. While
285table 3 lists examples that the framework supports for playback in the VP8 media codec.</p>
Roman Nurikc8754f32011-04-06 14:52:00 -0700286
Scott Main99700bf2013-06-18 10:43:35 -0700287<p>In addition to these encoding parameter recommendations,
288a device's available <em>video recording</em> profiles can be used as a proxy for media playback
289capabilities. These profiles can be inspected using the {@link android.media.CamcorderProfile
290CamcorderProfile} class, which is available since API level 8.</p>
291
292<p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong>
293Examples of supported video encoding parameters for the H.264 Baseline Profile codec.</p>
Roman Nurikc8754f32011-04-06 14:52:00 -0700294
295<table>
296 <thead>
297 <tr>
298 <th>&nbsp;</th>
Scott Main50e990c2012-06-21 17:14:39 -0700299 <th><acronym title="Standard definition">SD</a> (Low quality)</th>
300 <th><acronym title="Standard definition">SD</a> (High quality)</th>
Scott Main99700bf2013-06-18 10:43:35 -0700301 <th><acronym title="High definition">HD 720p</a> (N/A on all devices)</th>
Roman Nurikc8754f32011-04-06 14:52:00 -0700302 </tr>
303 </thead>
304 <tbody>
305 <tr>
Roman Nurikc8754f32011-04-06 14:52:00 -0700306 <th>Video resolution</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700307 <td>176 x 144 px</td>
308 <td>480 x 360 px</td>
309 <td>1280 x 720 px</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700310 </tr>
311 <tr>
312 <th>Video frame rate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700313 <td>12 fps</td>
314 <td>30 fps</td>
315 <td>30 fps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700316 </tr>
317 <tr>
318 <th>Video bitrate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700319 <td>56 Kbps</td>
320 <td>500 Kbps</td>
321 <td>2 Mbps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700322 </tr>
323 <tr>
324 <th>Audio codec</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700325 <td>AAC-LC</td>
326 <td>AAC-LC</td>
327 <td>AAC-LC</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700328 </tr>
329 <tr>
330 <th>Audio channels</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700331 <td>1 (mono)</td>
332 <td>2 (stereo)</td>
333 <td>2 (stereo)</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700334 </tr>
335 <tr>
336 <th>Audio bitrate</th>
Roman Nurik48acca62011-08-18 16:40:36 -0700337 <td>24 Kbps</td>
338 <td>128 Kbps</td>
339 <td>192 Kbps</td>
Roman Nurikc8754f32011-04-06 14:52:00 -0700340 </tr>
341 </tbody>
342</table>
343
Scott Main99700bf2013-06-18 10:43:35 -0700344
345
346<p class="table-caption" id="encoding-recommendations-table-vp8"><strong>Table 3.</strong>
347Examples 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
Roman Nurikc8754f32011-04-06 14:52:00 -0700387<p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p>
Dirk Dougherty22629942009-05-22 15:11:27 -0700388
Roman Nurik7641db42011-01-21 15:52:38 -0800389<ul>
Roman Nurik48acca62011-08-18 16:40:36 -0700390 <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>
Roman Nurikc8754f32011-04-06 14:52:00 -0700392 <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>
Roman Nurik7641db42011-01-21 15:52:38 -0800394</ul>