1## 5.2\. Video Encoding
2
3If device implementations support any video encoder and make it available
4to third-party apps, they:
5
6*   SHOULD NOT be, over two sliding windows, more than 15% over the bitrate
7between intraframe (I-frame) intervals.
8*   SHOULD NOT be more than 100% over the bitrate over a sliding window
9of 1 second.
10
11If device implementations include an embedded screen display with the
12diagonal length of at least 2.5 inches or include a video output port or
13declare the support of a camera via the `android.hardware.camera.any`
14feature flag, they:
15
16*   [C-1-1] MUST include the support of at least one of the VP8 or H.264 video
17encoders, and make it available for third-party applications.
18*   SHOULD support both VP8 and H.264 video encoders, and make it available
19for third-party applications.
20
21If device implementations support any of the H.264, VP8, VP9 or HEVC video
22encoders and make it available to third-party applications, they:
23
24*   [C-2-1] MUST support dynamically configurable bitrates.
25*   SHOULD support variable frame rates, where video encoder SHOULD determine
26instantaneous frame duration based on the timestamps of input buffers, and
27allocate its bit bucket based on that frame duration.
28
29If device implementations support the MPEG-4 SP video encoder and make it
30available to third-party apps, they:
31
32*   SHOULD support dynamically configurable bitrates for the supported encoder.
33
34If device implementations provide hardware accelerated video or image encoders,
35and support one or more attached or pluggable hardware camera(s) exposed through
36the `android.camera` APIs:
37
38*   [C-4-1] all hardware accelerated video and image encoders MUST support
39encoding frames from the hardware camera(s).
40*   SHOULD support encoding frames from the hardware camera(s) through all video
41or image encoders.
42
43### 5.2.1\. H.263
44
45If device implementations support H.263 encoders and make it available
46to third-party apps, they:
47
48*   [C-1-1] MUST support Baseline Profile Level 45.
49*   SHOULD support dynamically configurable bitrates for the supported encoder.
50
51
52### 5.2.2\. H.264
53
54If device implementations support H.264 codec, they:
55
56*   [C-1-1] MUST support Baseline Profile Level 3.
57    However, support for ASO (Arbitrary Slice Ordering), FMO (Flexible
58    Macroblock Ordering) and RS (Redundant Slices) is OPTIONAL. Moreover, to
59    maintain compatibility with other Android devices, it is RECOMMENDED that
60    ASO, FMO and RS are not used for Baseline Profile by encoders.
61*   [C-1-2] MUST support the SD (Standard Definition) video encoding profiles
62in the following table.
63*   SHOULD support Main Profile Level 4.
64*   SHOULD support the  HD (High Definition) video encoding profiles as
65indicated in the following table.
66
67If device implementations report support of H.264 encoding for 720p or 1080p
68resolution videos through the media APIs, they:
69
70*   [C-2-1] MUST support the encoding profiles in the following table.
71
72
73<table>
74 <tr>
75    <th></th>
76    <th>SD (Low quality)</th>
77    <th>SD (High quality)</th>
78    <th>HD 720p</th>
79    <th>HD 1080p</th>
80 </tr>
81 <tr>
82    <th>Video resolution</th>
83    <td>320 x 240 px</td>
84    <td>720 x 480 px</td>
85    <td>1280 x 720 px</td>
86    <td>1920 x 1080 px</td>
87 </tr>
88 <tr>
89    <th>Video frame rate</th>
90    <td>20 fps</td>
91    <td>30 fps</td>
92    <td>30 fps</td>
93    <td>30 fps</td>
94 </tr>
95 <tr>
96    <th>Video bitrate</th>
97    <td>384 Kbps</td>
98    <td>2 Mbps</td>
99    <td>4 Mbps</td>
100    <td>10 Mbps</td>
101 </tr>
102</table>
103
104### 5.2.3\. VP8
105
106If device implementations support VP8 codec, they:
107
108*   [C-1-1] MUST support the SD video encoding profiles.
109*   SHOULD support the following HD (High Definition) video encoding profiles.
110*   [C-1-2] MUST support writing Matroska WebM files.
111*   SHOULD provide a hardware VP8 codec that meets the
112[WebM project RTC hardware coding requirements](
113http://www.webmproject.org/hardware/rtc-coding-requirements), to ensure
114acceptable quality of web video streaming and video-conference services.
115
116If device implementations report support of VP8 encoding for 720p or 1080p
117resolution videos through the media APIs, they:
118
119*   [C-2-1] MUST support the encoding profiles in the following table.
120
121<table>
122 <tr>
123    <th></th>
124    <th>SD (Low quality)</th>
125    <th>SD (High quality)</th>
126    <th>HD 720p</th>
127    <th>HD 1080p</th>
128 </tr>
129 <tr>
130    <th>Video resolution</th>
131    <td>320 x 180 px</td>
132    <td>640 x 360 px</td>
133    <td>1280 x 720 px</td>
134    <td>1920 x 1080 px</td>
135 </tr>
136 <tr>
137    <th>Video frame rate</th>
138    <td>30 fps</td>
139    <td>30 fps</td>
140    <td>30 fps</td>
141    <td>30 fps</td>
142 </tr>
143 <tr>
144    <th>Video bitrate</th>
145    <td>800 Kbps </td>
146    <td>2 Mbps</td>
147    <td>4 Mbps</td>
148    <td>10 Mbps</td>
149 </tr>
150</table>
151
152### 5.2.4\. VP9
153
154If device implementations support VP9 codec, they:
155
156*   [C-1-2] MUST support Profile 0 Level 3.
157*   [C-1-1] MUST support writing Matroska WebM files.
158*   [C-1-3] MUST generate [CodecPrivate](
159https://www.webmproject.org/docs/container/#vp9-codec-feature-metadata-codecprivate
160) data.
161*   SHOULD support the HD decoding profiles as indicated in the following table.
162*   [SR] are STRONGLY RECOMMENDED to support the HD decoding profiles as
163indicated in the following table if there is a hardware encoder.
164
165<table>
166 <tr>
167    <th></th>
168    <th>SD</th>
169    <th>HD 720p</th>
170    <th>HD 1080p</th>
171    <th>UHD</th>
172 </tr>
173 <tr>
174    <th>Video resolution</th>
175    <td>720 x 480 px</td>
176    <td>1280 x 720 px</td>
177    <td>1920 x 1080 px</td>
178    <td>3840 x 2160 px</td>
179 </tr>
180 <tr>
181    <th>Video frame rate</th>
182    <td>30 fps</td>
183    <td>30 fps</td>
184    <td>30 fps</td>
185    <td>30 fps</td>
186 </tr>
187 <tr>
188    <th>Video bitrate</th>
189    <td>1.6 Mbps</td>
190    <td>4 Mbps</td>
191    <td>5 Mbps</td>
192    <td>20 Mbps</td>
193 </tr>
194</table>
195
196
197If device implementations claim to support Profile 2 or Profile 3 through the
198Media APIs:
199
200*   Support for 12-bit format is OPTIONAL.
201
202### 5.2.5\. H.265
203
204If device implementations support H.265 codec, they:
205
206*   [C-1-1] MUST support Main Profile Level 3.
207*   SHOULD support the HD encoding profiles as indicated in the following table.
208*   [SR] are STRONGLY RECOMMENDED to support the HD encoding profiles as
209indicated in the following table if there is a hardware encoder.
210
211<table>
212 <tr>
213    <th></th>
214    <th>SD</th>
215    <th>HD 720p</th>
216    <th>HD 1080p</th>
217    <th>UHD</th>
218 </tr>
219 <tr>
220    <th>Video resolution</th>
221    <td>720 x 480 px</td>
222    <td>1280 x 720 px</td>
223    <td>1920 x 1080 px</td>
224    <td>3840 x 2160 px</td>
225 </tr>
226 <tr>
227    <th>Video frame rate</th>
228    <td>30 fps</td>
229    <td>30 fps</td>
230    <td>30 fps</td>
231    <td>30 fps</td>
232 </tr>
233 <tr>
234    <th>Video bitrate</th>
235    <td>1.6 Mbps</td>
236    <td>4 Mbps</td>
237    <td>5 Mbps</td>
238    <td>20 Mbps</td>
239 </tr>
240</table>
241