1
1
# Encoding for vp9/av1
2
2
3
- the vpX/aom family of codecs (vp8,vp9 and av1) are the standard for
3
+ The vpX/aom family of codecs (vp8, vp9, and av1) are the standard for
4
4
royalty-free video encoding and have been for the past 10 years.
5
- the vpX/aom family of codecs is widely supported for playback
5
+ The vpX/aom family of codecs is widely supported for playback
6
6
in all modern browsers (excluding safari, but with apple's entry
7
- into the alliance for open media this is expected to change)
7
+ into the alliance for open media, this is expected to change)
8
8
and many hardware devices such as gaming consoles and phones.
9
- The second generation and third generation of vpX/aom family codecs
9
+ The second and third generation of vpX/aom family codecs
10
10
(vp9 and av1) provide better video quality at smaller file sizes
11
- compared to h.264 however av1's encoders have yet to reach the
12
- same maturity as x264 or x265 and so a comparison cannot
13
- yet be drawn between av1 and it's competitor h.265 on detail
14
- retention.
11
+ than h.264. However, av1's encoders have yet to reach the
12
+ same maturity as x264 or x265,
13
+ so we cannot yet draw a comparison between av1 and its competitor h.265
14
+ on detail retention.
15
15
16
16
libvpx is a mature, feature-complete, free, open-source encoder
17
- for the vp8/vp9 video formats which provides maximum
17
+ for the vp8/vp9 video formats, providing maximum
18
18
compression for vp9.
19
19
20
20
SVT-VP9 is a non-feature-complete, speed-optimized, free,
21
- open-source encoder for the vp9 video format which provides
22
- high-speed highly parallel encoding.
21
+ open-source encoder for the vp9 video format, which provides
22
+ high-speed, highly parallel encoding.
23
23
24
24
libaom is a feature-complete, free, open-source encoder
25
- for the av1 format and future formats in the family
26
- such as the currently in early development av2 format .
27
- On average libaom provides 20% better compression than h.265
28
- but due to lack of maturity can struggle at times with loss
29
- of detail .
25
+ for the av1 format and future formats in the family,
26
+ such as the av2 format ( currently in early development) .
27
+ On average, libaom provides 20% better compression than h.265
28
+ but can sometimes struggle with a loss of detail
29
+ due to lack of maturity .
30
30
31
31
SVT-AV1 is a non-feature-complete, speed-optimized, free,
32
- open-source encoder for the av1 video format which provides
33
- high-speed highly parallel encoding. By aiming to provide
34
- lower levels of compression at a higher speed it has been able
35
- to reach a higher level of maturity quicker than libaom.
32
+ open-source encoder for the av1 video format, which provides
33
+ high-speed, highly parallel encoding.
34
+ By aiming to provide lower levels of compression at a higher speed
35
+ it has reached a higher level of maturity quicker than libaom.
36
36
37
37
38
38
## Prerequisites
@@ -42,7 +42,7 @@ To get started, you'll need a few things:
42
42
- A video to encode—for the examples,
43
43
use a yuv file generated by VapourSynth,
44
44
which you should be able to do
45
- if you've been following the previous sections of this guide
45
+ if you've been following the previous sections of this guide.
46
46
- Either libvpx and libaom or SVT-VP9 and SVT-AV1
47
47
48
48
Here's how we get a copy of these encoders:
@@ -54,7 +54,7 @@ libaom (git) may be built from source by downloading the sources using git-bash
54
54
```
55
55
git clone https://aomedia.googlesource.com/aom
56
56
mkdir build
57
- cd build
57
+ cd build
58
58
cmake ../aom
59
59
make
60
60
```
@@ -88,35 +88,35 @@ Here are a few examples:
88
88
## Getting Started
89
89
90
90
All four encoders are highly configurable,
91
- and the options will overwhelm you at first.
91
+ and the options might overwhelm you at first.
92
92
But we will provide you with some basic
93
93
parameters and guidance to start with for your
94
94
first encodes. The encoders in this family have
95
- most of their options named similarly to each other
96
- so for simplicity's sake we will use libvpx and
95
+ most of their options named similarly to each other,
96
+ so for simplicity's sake, we will use libvpx and
97
97
libaom for these examples.
98
98
99
99
### On the topic of patent and copyright.
100
100
101
- the vpX/aom family of codecs are royalty-free codecs ,
101
+ The vpX/aom family of codecs are royalty-free,
102
102
meaning you do not have to pay to use technologies
103
103
required to design, distribute or use a vpX/aom encoder
104
- or decoder. This differs from h.264 and h.265 which
105
- require payment for use of technologies required to
106
- design a h.264 or h.265 encoder or decoder.
104
+ or decoder. This differs from h.264 and h.265,
105
+ which require payment for the use of the technologies needed to
106
+ design an h.264 or h.265 encoder or decoder.
107
107
108
- Unfortunately because of this vpX/aom family codecs
109
- are best used in 2 -pass mode ( due to some technologies
108
+ Unfortunately, because of this, vpX/aom family codecs
109
+ are best used in two -pass mode due to some technologies
110
110
required to provide a satisfactory single pass encoder
111
- being subject to patent royalties imposed by the mpeg
112
- group (the creators of h.264 and h.265)) . As such all
113
- examples in this guide are 2 -pass encodes.
111
+ being subject to patent royalties imposed by the MPEG
112
+ alliance (the creators of h.264 and h.265). As such,
113
+ all examples in this guide are two -pass encodes.
114
114
115
115
### Example 1: General-Purpose Encoding with VP9
116
116
117
117
Open up a terminal window,
118
118
and navigate to the folder
119
- where your VapourSynth script lives (for a 1080p or larger 16:9 video)
119
+ where your VapourSynth script lives (for a 1080p or larger 16:9 video).
120
120
Let's run the following commands:
121
121
122
122
```
@@ -132,7 +132,7 @@ Let's run through what each of these options means:
132
132
##### ` vspipe --y4m myvideo.vpy temp.y4m `
133
133
134
134
This portion loads your VapourSynth script
135
- and saves to temp.y4m
135
+ and saves it to temp.y4m.
136
136
137
137
##### ` --codec=vp9 `
138
138
@@ -142,12 +142,12 @@ be encoding using the vp9 codec.
142
142
143
143
##### ` --passes=2 `
144
144
145
- This tells vpxenc that we're doing 2 pass encoding.
145
+ This tells vpxenc that we're doing two- pass encoding.
146
146
147
147
148
148
##### ` --pass=X `
149
149
150
- this tells vpxenc which pass we are performing.
150
+ This tells vpxenc which pass we are performing.
151
151
152
152
153
153
##### ` --fpf=passdata.bin `
@@ -157,16 +157,16 @@ This tells vpxenc where to store the statistics used for the second pass.
157
157
158
158
##### ` --row-mt=1 `
159
159
160
- This tells vpxenc to multithread on tile- rows, not just tile columns.
160
+ This tells vpxenc to multithread on tile rows, not just tile columns.
161
161
This is an important parameter because it greatly reduces encode time.
162
162
163
163
164
164
##### ` --cpu-used=X `
165
165
166
166
This is like x264's presets.
167
- It allows you to switch between faster encoding,
167
+ It allows you to switch between faster encoding
168
168
or higher quality.
169
- The full list of presets, mapped to their h.264 equivalents is
169
+ The full list of presets mapped to their h.264 equivalents is
170
170
171
171
0 . placebo
172
172
1 . veryslow
@@ -179,30 +179,29 @@ The full list of presets, mapped to their h.264 equivalents is
179
179
8 . superfast
180
180
9 . ultrafast
181
181
182
- Unlike h.264 0 and 9 are reasonably useful if you want to get
183
- maximum compression (and don't care about encoding time) or
184
- maximum encoding speed (and don't care about getting good quality
185
- (realtime video for example)) respectively.
182
+ Unlike with h.264, 0 and 9 are reasonably useful if you want to get
183
+ maximum compression (and don't care about encoding time) or
184
+ maximum encoding speed (and don't care about getting good quality
185
+ (real-time video, for example)), respectively.
186
186
187
187
##### ` --deadline best `
188
188
189
- this instructs the encoder to be more strict about the quality of
190
- the encoding and not to move on until it is 100% satisfied with
191
- that frame.
189
+ This instructs the encoder to be more strict about the encoding quality
190
+ and to not move on until it is 100% satisfied with that frame.
192
191
193
192
194
193
##### ` --auto-alt-ref=2 `
195
194
196
- This is a option that determines how keyframes are chosen. If you
197
- are tuning for maximum playback compatability choose 1, if you are
198
- tuning for maximum quality choose 2.
195
+ This is an option that determines how keyframes are chosen. If you
196
+ are tuning for maximum playback compatibility, choose 1; if you are
197
+ tuning for maximum quality, choose 2.
199
198
200
199
201
200
##### ` --lag-in-frames=25 `
202
201
203
202
This option allows keyframes to be moved forward or back by this
204
- number of frames which allows for better keyframe placement.
205
- larger numbers like 25 are better suited for anime.
203
+ number of frames, allowing for better keyframe placement.
204
+ Larger numbers like 25 are better suited for anime.
206
205
207
206
208
207
##### ` --arnr-strength=0 `
@@ -213,31 +212,31 @@ video with vapoursynth.
213
212
214
213
##### ` --aq-mode=2 `
215
214
216
- This option tells the encoder to rely on how complex the motion
217
- of each frame is to determine the adaptive quantization. In
218
- other words, more motion in more directions equals more bits
215
+ This option tells the encoder to rely on how complex
216
+ each frame's motion is to determine the adaptive quantization.
217
+ In other words, more motion in more directions equals more bits
219
218
devoted to that frame.
220
219
221
220
222
221
##### ` --frame-parallel=0 `
223
222
224
- This option allows for parallel decoding of the video, it reduces
225
- quality so we disable it.
223
+ This option allows for parallel video decoding, reducing quality,
224
+ so we disable it.
226
225
227
226
228
227
##### ` --tile-columns=2 ` and ` --tile-rows=1 `
229
228
230
229
These options determine how the encoder breaks up the frame into
231
- chunks for encoding. The more chunks the more threads can be used
230
+ chunks for encoding. The more chunks, the more threads can be used
232
231
for encoding. One important note here is that the values of this
233
- parameter are in the form of $$ 2^{x} $$ meaning that the number of
234
- columns and rows with these values is actually 4 and 2
232
+ parameter are in the form of \\ ( 2^{x}\\ ), meaning that the number of
233
+ columns and rows with these values is actually 4 and 2,
235
234
respectively. Tiles cannot be smaller than 65536 pixels in area.
236
235
237
236
238
237
##### ` --threads=8 `
239
238
240
- Self explanitory . Set this to the number of threads your cpu has.
239
+ Self-explanatory . Set this to the number of threads your CPU has.
241
240
242
241
243
242
##### ` --end-usage=vbr `
@@ -254,14 +253,14 @@ Set the average quantizer level.
254
253
255
254
This last portion tells which files to use for the input and output.
256
255
We use ` -o ` to tell which filename to write the encoded file to.
257
- In the first case, vpxenc will write a file at ` /dev/null ` which is
258
- the null device on posix systems (meaning no file will be written
259
- for the first pass (if you're on windows simply use the filename nul
260
- instead)). In the second pass we write an ivf to ` myvideo.ivf ` in the
256
+ In the first case, vpxenc will write a file at ` /dev/null ` ,
257
+ the null device on POSIX systems (meaning no file will be written
258
+ for the first pass (if you're on windows, use the filename nul
259
+ instead)). In the second pass, we write an ivf to ` myvideo.ivf ` in the
261
260
current working directory.
262
261
263
262
The last argument we are passing to vpxenc is the input file.
264
- As we are doing a two pass encode it is more efficient to save the
263
+ As we are doing a two- pass encode, it is more efficient to save the
265
264
output of vapoursynth then run the encode on that instead of running
266
265
vapoursynth twice.
267
266
275
274
We covered the basics of how to encode using the vpX/aom family of
276
275
codecs, including speed presets.
277
276
278
- Here is a summary of when to use vp9 vs AV1 (please note these are
277
+ Here is a summary of when to use vp9 vs. AV1 (please note these are
279
278
recommendations, you do not have to follow them):
280
279
281
280
- Is your source larger than Full HD?
0 commit comments