supported-formats.md 6.5 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 11
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:

* The format of the individual media samples (e.g. a frame of video or a frame
O
Oliver Woodman 已提交
12 13 14 15 16 17 18 19
  of audio). We call these *sample formats*. Note that a typical video file will
  contain media in at least two sample formats; one for video (e.g. H.264) and
  one for audio (e.g. AAC).
* The format of the container that houses the media samples and associated
  metadata. We call these *container formats*. A media file has a single
  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
  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 25
The following sections define ExoPlayer's support at each level, from highest to
lowest.
O
ojw28 已提交
26 27 28 29 30

## Adaptive streaming ##

### DASH ###

O
Oliver Woodman 已提交
31 32 33 34 35
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
sample formats must also be supported (see the [sample formats](#sample-formats)
section for details).
O
ojw28 已提交
36 37 38 39

| Feature | Supported    | Comment              |
|---------|:------------:|:---------------------|
| **Containers** |||
O
Oliver Woodman 已提交
40
| FMP4 | YES| Demuxed streams only |
O
ojw28 已提交
41 42 43
| WebM | YES | Demuxed streams only |
| Matroska | YES | Demuxed streams only |
| MPEG-TS | NO | No support planned |
O
ojw28 已提交
44
| **Closed captions/subtitles** |||
O
ojw28 已提交
45 46
| 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
ojw28 已提交
47 48
| Tx3g | YES | Embedded in FMP4 |
| SubRip | YES | Embedded in WebM |
O
Oliver Woodman 已提交
49
| **Content protection** |||
O
ojw28 已提交
50
| Widevine CENC | YES | API 19 and higher; "cenc" scheme only |
O
Oliver Woodman 已提交
51
| PlayReady SL2000 | YES | Android TV only |
O
ojw28 已提交
52

O
ojw28 已提交
53 54
### SmoothStreaming ###

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

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

O
ojw28 已提交
70 71
### HLS ###

O
Oliver Woodman 已提交
72 73 74 75 76
ExoPlayer supports HLS with the MPEG-TS, ADTS and MP3 container formats. The
contained sample formats must also be supported (see the
[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 已提交
77
[here](https://medium.com/google-exoplayer/test-8b62d50362ef#.dlz6npay4).
O
ojw28 已提交
78 79 80

| Feature | Supported    | Comment              |
|---------|:------------:|:---------------------|
O
Oliver Woodman 已提交
81 82
| **Containers** |||
| MPEG-TS | YES ||
O
ojw28 已提交
83 84
| ADTS (AAC) | YES ||
| MP3 | YES ||
O
Oliver Woodman 已提交
85
| **Closed captions/subtitles** |||
O
ojw28 已提交
86
| EIA-608 | YES ||
O
Oliver Woodman 已提交
87
| WebVTT | YES ||
O
ojw28 已提交
88
| **Metdata** |||
O
Oliver Woodman 已提交
89 90 91
| ID3 metadata | YES ||
| **Content protection** |||
| AES-128 | YES ||
O
ojw28 已提交
92
| Sample AES-128 | NO ||
O
ojw28 已提交
93 94 95

## Standalone container formats ##

O
Oliver Woodman 已提交
96 97 98
Media files in the following container formats can be played directly by
ExoPlayer. The contained sample formats must also be supported (see the
[sample formats](#sample-formats) section for details).
O
ojw28 已提交
99

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

O
Oliver Woodman 已提交
116 117 118
\* Seeking is unsupported because the container does not provide metadata (e.g.
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 已提交
119 120 121

## Sample formats ##

O
Oliver Woodman 已提交
122 123 124 125 126
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 已提交
127

O
Oliver Woodman 已提交
128 129 130 131
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 已提交
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
[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 |
| MP3            | --enable-decoder=mp3 |
| AMR-NB         | --enable-decoder=armnb |
| ARM-WB         | --enable-decoder=armwb |
| 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 已提交
162
[FFmpeg extension]: https://github.com/google/ExoPlayer/tree/release-v2/extensions/ffmpeg