supported-formats.md 7.4 KB
Newer Older
O
ojw28 已提交
1 2 3
---
layout: default
title: Supported formats
O
Oliver Woodman 已提交
4
weight: 3
O
ojw28 已提交
5 6
---

O
Oliver Woodman 已提交
7 8 9 10
When defining the formats that ExoPlayer supports, it's important to note that
"media formats" are in fact defined at multiple levels. From the lowest level to
the highest, these are:

O
Oliver Woodman 已提交
11
* The format of the individual media samples (e.g., a frame of video or a frame
O
Oliver Woodman 已提交
12
  of audio). We call these *sample formats*. Note that a typical video file will
O
Oliver Woodman 已提交
13 14
  contain media in at least two sample formats; one for video (e.g., H.264) and
  one for audio (e.g., AAC).
O
Oliver Woodman 已提交
15 16
* The format of the container that houses the media samples and associated
  metadata. We call these *container formats*. A media file has a single
O
Oliver Woodman 已提交
17 18
  container format (e.g., MP4), which is commonly indicated by the file
  extension. Note that for some audio only formats (e.g., MP3), the sample and
O
Oliver Woodman 已提交
19
  container formats may be the same.
O
Oliver Woodman 已提交
20
* Adaptive streaming technologies such as DASH, SmoothStreaming and HLS. These
O
Oliver Woodman 已提交
21 22
  are not media formats as such, however it's still necessary to define what
  level of support ExoPlayer provides.
O
ojw28 已提交
23

O
Oliver Woodman 已提交
24
The following sections define ExoPlayer's support at each level, from highest to
O
Oliver Woodman 已提交
25 26
lowest. Support for standalone subtitle formats is also described at the bottom
of this page.
O
ojw28 已提交
27 28 29 30 31

## Adaptive streaming ##

### DASH ###

O
Oliver Woodman 已提交
32 33 34
ExoPlayer supports DASH with the FMP4, WebM and Matroska container formats.
Media streams must be demuxed, meaning that video, audio and text must be
defined in distinct AdaptationSet elements in the DASH manifest. The contained
O
Oliver Woodman 已提交
35 36
audio and video sample formats must also be supported (see the
[sample formats](#sample-formats) section for details).
O
ojw28 已提交
37 38 39 40

| Feature | Supported    | Comment              |
|---------|:------------:|:---------------------|
| **Containers** |||
O
Oliver Woodman 已提交
41
| FMP4 | YES| Demuxed streams only |
O
ojw28 已提交
42 43 44
| WebM | YES | Demuxed streams only |
| Matroska | YES | Demuxed streams only |
| MPEG-TS | NO | No support planned |
O
ojw28 已提交
45
| **Closed captions/subtitles** |||
O
ojw28 已提交
46 47
| TTML | YES | Raw, or embedded in FMP4 according to ISO/IEC 14496-30 |
| WebVTT | YES | Raw, or embedded in FMP4 according to ISO/IEC 14496-30 |
O
Oliver Woodman 已提交
48 49 50
| CEA-608 | YES | Carried in SEI messages embedded in FMP4 video tracks |
| **Metadata** |||
| EMSG metadata | YES | Embedded in FMP4 |
O
Oliver Woodman 已提交
51
| **Content protection** |||
O
Oliver Woodman 已提交
52
| Widevine | YES | API 19+ ("cenc" scheme) and 24+ ("cbcs", "cbc1" and "cens") |
O
Oliver Woodman 已提交
53
| PlayReady SL2000 | YES | Android TV only |
O
ojw28 已提交
54

O
ojw28 已提交
55 56
### SmoothStreaming ###

O
Oliver Woodman 已提交
57 58
ExoPlayer supports SmoothStreaming with the FMP4 container format. Media streams
must be demuxed, meaning that video, audio and text must be defined in distinct
O
Oliver Woodman 已提交
59 60 61
StreamIndex elements in the SmoothStreaming manifest. The contained audio and
video sample formats must also be supported (see the
[sample formats](#sample-formats) section for details).
O
ojw28 已提交
62 63 64

| Feature | Supported    | Comment              |
|---------|:------------:|:---------------------|
O
Oliver Woodman 已提交
65 66 67
| **Containers** |||
| FMP4 | YES | Demuxed streams only |
| **Closed captions/subtitles** |||
O
ojw28 已提交
68
| TTML | YES | Embedded in FMP4 |
O
Oliver Woodman 已提交
69 70
| **Content protection** |||
| PlayReady SL2000 | YES | Android TV only |
O
ojw28 已提交
71

O
ojw28 已提交
72 73
### HLS ###

O
Oliver Woodman 已提交
74 75
ExoPlayer supports HLS with the MPEG-TS, FMP4, ADTS and MP3 container formats.
The contained audio and video sample formats must also be supported (see the
O
Oliver Woodman 已提交
76 77 78
[sample formats](#sample-formats) section for details). Note that we recommend
using DASH (or SmoothStreaming) rather than HLS where possible. You can read
about some of the benefits of DASH
O
m  
Oliver Woodman 已提交
79
[here](https://medium.com/google-exoplayer/test-8b62d50362ef#.dlz6npay4).
O
ojw28 已提交
80 81 82

| Feature | Supported    | Comment              |
|---------|:------------:|:---------------------|
O
Oliver Woodman 已提交
83 84
| **Containers** |||
| MPEG-TS | YES ||
O
Oliver Woodman 已提交
85
| FMP4 | YES ||
O
ojw28 已提交
86 87
| ADTS (AAC) | YES ||
| MP3 | YES ||
O
Oliver Woodman 已提交
88
| **Closed captions/subtitles** |||
O
Oliver Woodman 已提交
89
| CEA-608 | YES ||
O
Oliver Woodman 已提交
90
| WebVTT | YES ||
O
Oliver Woodman 已提交
91
| **Metadata** |||
O
Oliver Woodman 已提交
92 93 94
| ID3 metadata | YES ||
| **Content protection** |||
| AES-128 | YES ||
O
ojw28 已提交
95
| Sample AES-128 | NO ||
O
Oliver Woodman 已提交
96
| Widevine | NO | Future support planned for API 24+ |
O
ojw28 已提交
97 98 99

## Standalone container formats ##

O
Oliver Woodman 已提交
100
Media files in the following container formats can be played directly by
O
Oliver Woodman 已提交
101 102
ExoPlayer. The contained audio and video sample formats must also be supported
(see the [sample formats](#sample-formats) section for details).
O
ojw28 已提交
103

O
ojw28 已提交
104 105 106
| Container format | Supported    | Comment              |
|------------------|:------------:|:---------------------|
| MP4 | YES ||
O
Oliver Woodman 已提交
107
| M4A | YES ||
O
ojw28 已提交
108 109 110 111
| FMP4 | YES ||
| WebM| YES ||
| Matroska| YES ||
| MP3 | YES ||
O
ojw28 已提交
112
| Ogg | YES | Containing Vorbis, Opus and Flac |
O
ojw28 已提交
113
| WAV | YES ||
O
ojw28 已提交
114 115 116 117
| MPEG-TS | YES | Not seekable* |
| MPEG-PS | YES | Not seekable* |
| FLV | YES | Not seekable* |
| ADTS (AAC) | YES | Not seekable* |
O
ojw28 已提交
118
| Flac | YES | Using the [Flac extension][] only |
O
ojw28 已提交
119

O
Oliver Woodman 已提交
120
\* Seeking is unsupported because the container does not provide metadata (e.g.,
O
Oliver Woodman 已提交
121 122
a sample index) to allow a media player to perform a seek in an efficient way.
If seeking is required, we suggest using a more appropriate container format.
O
ojw28 已提交
123 124 125

## Sample formats ##

O
Oliver Woodman 已提交
126 127 128 129 130
By default ExoPlayer uses Android's platform decoders. Hence the supported
sample formats depend on the underlying platform rather than on ExoPlayer.
Sample formats supported by Android devices are documented
[here](https://developer.android.com/guide/appendix/media-formats.html#core).
Note that individual devices may support additional formats beyond those listed.
O
ojw28 已提交
131

O
Oliver Woodman 已提交
132 133 134 135
In addition to using Android's platform decoders, ExoPlayer can also make use of
software decoder extensions. These must be manually built and included in
projects that wish to make use of them. We currently provide software decoder
extensions for
O
Oliver Woodman 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
[VP9](https://github.com/google/ExoPlayer/tree/release-v2/extensions/vp9),
[Flac](https://github.com/google/ExoPlayer/tree/release-v2/extensions/flac),
[Opus](https://github.com/google/ExoPlayer/tree/release-v2/extensions/opus) and
[FFmpeg](https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg).

### FFmpeg extension ###

The [FFmpeg extension][] supports decoding a variety of different audio sample
formats. You can choose which decoders to include by passing command line
arguments to FFmpeg's `configure` script:

| Sample format  | Argument(s) to `configure` |
|---------------:|----------------------------|
| Vorbis         | --enable-decoder=vorbis |
| Opus           | --enable-decoder=opus |
| FLAC           | --enable-decoder=flac |
O
Oliver Woodman 已提交
152 153 154 155
| ALAC           | --enable-decoder=alac |
| MP1, MP2, MP3  | --enable-decoder=mp3 |
| AMR-NB         | --enable-decoder=amrnb |
| AMR-WB         | --enable-decoder=amrwb |
O
Oliver Woodman 已提交
156 157 158 159 160 161 162 163 164 165 166
| AAC            | --enable-decoder=aac |
| AC-3           | --enable-decoder=ac3 |
| E-AC-3         | --enable-decoder=eac3 |
| DTS, DTS-HD    | --enable-decoder=dca |
| TrueHD         | --enable-decoder=mlp --enable-decoder=truehd |

See the extension's
[README.md](https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg/README.md)
for an example command line to `configure`.

[Flac extension]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/flac
O
Oliver Woodman 已提交
167
[FFmpeg extension]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg
O
Oliver Woodman 已提交
168 169 170 171 172 173 174 175 176 177

## Standalone subtitle formats ##

ExoPlayer supports standalone subtitle files in a variety of formats. Subtitle
files can be side-loaded as described in the [Developer guide][].

| Container format | Supported    | Comment              |
|------------------|:------------:|:---------------------|
| WebVTT | YES ||
| TTML | YES ||
178
| SMPTE-TT | YES | Use MimeTypes.APPLICATION_TTML |
O
Oliver Woodman 已提交
179 180
| SubRip | YES ||
| SubStationAlpha (SSA) | YES ||
181
| ASS | YES | Use MimeTypes.TEXT_SSA |
O
Oliver Woodman 已提交
182 183

[Developer guide]: https://google.github.io/ExoPlayer/guide.html#side-loading-a-subtitle-file