• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1page.title=Supported Media Formats
2page.tags="video","audio","mpeg","mp4","m4a","mp3","3gp","3gpp","flac","wave","wav"
3@jd:body
4
5<div id="qv-wrapper">
6<div id="qv">
7
8<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>
18<li><a href="{@docRoot}guide/topics/media/index.html">Multimedia and Camera</a></li>
19</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>
41  <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>
48</ul>
49
50<p class="note"><strong>Note:</strong> HTTPS is not supported before Android 3.1.</p>
51
52
53<h2 id="core">Core Media Formats</h2>
54
55<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
59<p class="table-caption" id="formats-table"><strong>Table 1.</strong> Core media format and codec support.</p>
60
61<table style="font-size:12px">
62<tbody>
63
64<tr>
65<th>Type</th>
66<th>Format / Codec</th>
67<th>Encoder</th>
68<th>Decoder</th>
69<th>Details</th>
70<th>Supported File Type(s) / Container Formats</th>
71</tr>
72
73<tr>
74<td rowspan="11">Audio</td>
75<td>AAC LC</td>
76<td style="text-align: center;"><big>&bull;</big></td>
77<td style="text-align: center;"><big>&bull;</big></td>
78<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">
81  &bull; 3GPP (.3gp)<br>
82  <nobr>&bull; MPEG-4 (.mp4, .m4a)</nobr><br>
83  &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>
85</tr>
86
87<tr>
88<td>HE-AACv1 (AAC+)</td>
89<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
90<td style="text-align: center;"><big>&bull;</big></td>
91</tr>
92
93<tr>
94<td>HE-AACv2 (enhanced AAC+)</td>
95<td>&nbsp;</td>
96<td style="text-align: center;"><big>&bull;</big></td>
97<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>
107</tr>
108
109<tr>
110<td>AMR-NB</td>
111<td style="text-align: center;"><big>&bull;</big></td>
112<td style="text-align: center;"><big>&bull;</big></td>
113<td>4.75 to 12.2 kbps sampled @ 8kHz</td>
114<td>
115  3GPP (.3gp)</td>
116</tr>
117
118<tr>
119<td>AMR-WB</td>
120<td style="text-align: center;"><big>&bull;</big></td>
121<td style="text-align: center;"><big>&bull;</big></td>
122<td>9 rates from 6.60 kbit/s to 23.85 kbit/s sampled @ 16kHz</td>
123<td>
124  3GPP (.3gp)</td>
125</tr>
126
127<tr>
128<td>FLAC</td>
129<td>&nbsp;</td>
130<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.1+)</small></td>
131<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>
136<td>
137  FLAC (.flac) only</td>
138</tr>
139
140<tr>
141<td>MP3</td>
142<td>&nbsp;</td>
143<td style="text-align: center;"><big>&bull;</big></td>
144<td>Mono/Stereo 8-320Kbps constant (CBR) or variable bit-rate (VBR)
145</td>
146<td>
147  MP3 (.mp3)</td>
148</tr>
149
150<tr>
151<td>MIDI</td>
152<td>&nbsp;</td>
153<td style="text-align: center;"><big>&bull;</big></td>
154<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>
155<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>
160</tr>
161
162<tr>
163<td>Vorbis</td>
164<td>&nbsp;</td>
165<td style="text-align: center;"><big>&bull;</big></td>
166<td>&nbsp;</td>
167<td>
168  &bull; Ogg (.ogg)<br>
169  &bull; Matroska (.mkv, Android 4.0+)</td>
170</tr>
171
172<tr>
173<td>PCM/WAVE</td>
174<td style="text-align: center;"><big>&bull;</big><br><small>(Android 4.1+)</small></td>
175<td style="text-align: center;"><big>&bull;</big></td>
176<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>
178<td>
179  WAVE (.wav)</td>
180</tr>
181
182<tr>
183<td rowspan="5">Image</td>
184<td>JPEG</td>
185<td style="text-align: center;"><big>&bull;</big></td>
186<td style="text-align: center;"><big>&bull;</big></td>
187<td>Base+progressive</td>
188<td>
189  JPEG (.jpg)</td>
190</tr>
191
192<tr>
193<td>GIF</td>
194<td>&nbsp;</td>
195<td style="text-align: center;"><big>&bull;</big></td>
196<td>&nbsp;</td>
197<td>
198  GIF (.gif)</td>
199</tr>
200
201<tr>
202<td>PNG</td>
203<td style="text-align: center;"><big>&bull;</big></td>
204<td style="text-align: center;"><big>&bull;</big></td>
205<td>&nbsp;</td>
206<td>
207  PNG (.png)</td>
208</tr>
209
210<tr>
211<td>BMP</td>
212<td>&nbsp;</td>
213<td style="text-align: center;"><big>&bull;</big></td>
214<td>&nbsp;</td>
215<td>
216  BMP (.bmp)</td>
217</tr>
218
219<tr>
220<td>WEBP</td>
221<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
222<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 4.0+)</small></td>
223<td>&nbsp;</td>
224<td>
225  WebP (.webp)</td>
226</tr>
227
228
229<tr>
230<td rowspan="4">Video</td>
231<td>H.263</td>
232<td style="text-align: center;"><big>&bull;</big></td>
233<td style="text-align: center;"><big>&bull;</big></td>
234<td>&nbsp;</td>
235<td>
236  &bull; 3GPP (.3gp)<br>
237  &bull; MPEG-4 (.mp4)</td>
238</tr>
239
240<tr>
241<td>H.264 AVC</td>
242<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 3.0+)</small></td>
243<td style="text-align: center;" nowrap><big>&bull;</big></td>
244<td>Baseline Profile (BP)</td>
245<td>
246  &bull; 3GPP (.3gp)<br>
247  &bull; MPEG-4 (.mp4)<br>
248  &bull; MPEG-TS (.ts, AAC audio only, not seekable, Android 3.0+)</td>
249</tr>
250
251<tr>
252<td>MPEG-4 SP</td>
253<td>&nbsp;</td>
254<td style="text-align: center;"><big>&bull;</big></td>
255<td>&nbsp;</td>
256<td>
257  3GPP (.3gp)</td>
258</tr>
259
260<tr>
261<td>VP8</td>
262<td>&nbsp;</td>
263<td style="text-align: center;" nowrap><big>&bull;</big><br><small>(Android 2.3.3+)</small></td>
264<td>Streamable only in Android 4.0 and above</td>
265<td>
266  &bull; <a href="http://www.webmproject.org/">WebM</a> (.webm)<br>
267  &bull; Matroska (.mkv, Android 4.0+)</td>
268</tr>
269
270</tbody></table>
271
272
273<h2 id="recommendations">Video Encoding Recommendations</h2>
274
275<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>
276
277<p class="table-caption" id="encoding-recommendations-table"><strong>Table 2.</strong> Examples of supported video encoding parameters.</p>
278
279<table>
280  <thead>
281  <tr>
282    <th>&nbsp;</th>
283    <th><acronym title="Standard definition">SD</a> (Low quality)</th>
284    <th><acronym title="Standard definition">SD</a> (High quality)</th>
285    <th><acronym title="High definition">HD</a> (Not available on all devices)</th>
286  </tr>
287  </thead>
288  <tbody>
289  <tr>
290    <th>Video codec</th>
291    <td>H.264 Baseline Profile</td>
292    <td>H.264 Baseline Profile</td>
293    <td>H.264 Baseline Profile</td>
294  </tr>
295  <tr>
296    <th>Video resolution</th>
297    <td>176 x 144 px</td>
298    <td>480 x 360 px</td>
299    <td>1280 x 720 px</td>
300  </tr>
301  <tr>
302    <th>Video frame rate</th>
303    <td>12 fps</td>
304    <td>30 fps</td>
305    <td>30 fps</td>
306  </tr>
307  <tr>
308    <th>Video bitrate</th>
309    <td>56 Kbps</td>
310    <td>500 Kbps</td>
311    <td>2 Mbps</td>
312  </tr>
313  <tr>
314    <th>Audio codec</th>
315    <td>AAC-LC</td>
316    <td>AAC-LC</td>
317    <td>AAC-LC</td>
318  </tr>
319  <tr>
320    <th>Audio channels</th>
321    <td>1 (mono)</td>
322    <td>2 (stereo)</td>
323    <td>2 (stereo)</td>
324  </tr>
325  <tr>
326    <th>Audio bitrate</th>
327    <td>24 Kbps</td>
328    <td>128 Kbps</td>
329    <td>192 Kbps</td>
330  </tr>
331  </tbody>
332</table>
333
334<p style="margin-top: 2em">For video content that is streamed over HTTP or RTSP, there are additional requirements:</p>
335
336<ul>
337  <li>For 3GPP and MPEG-4 containers, the <code>moov</code> atom must precede any <code>mdat</code> atoms, but must succeed the
338      <code>ftyp</code> atom.</li>
339  <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.
340      To minimize this audio/video drift, consider interleaving audio and video in smaller chunk sizes.</li>
341</ul>
342