Imported Upstream version 1.4+222+hg5f9f7194267b
[deb_x265.git] / doc / reST / presets.rst
CommitLineData
72b9787e
JB
1Preset Options
2--------------
3
b53f7c52
JB
4.. _presets:
5
72b9787e
JB
6Presets
7=======
8
72b9787e
JB
9x265 has a number of predefined :option:`--preset` options that make
10trade-offs between encode speed (encoded frames per second) and
11compression efficiency (quality per bit in the bitstream). The default
12preset is medium, it does a reasonably good job of finding the best
13possible quality without spending enormous CPU cycles looking for the
14absolute most efficient way to achieve that quality. As you go higher
15than medium, the encoder takes shortcuts to improve performance at the
16expense of quality and compression efficiency. As you go lower than
17medium, the encoder tries harder and harder to achieve the best quailty
18per bit compression ratio.
19
20The presets adjust encoder parameters to affect these trade-offs.
21
22+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
23| | ultrafast | superfast | veryfast | faster | fast | medium | slow | slower | veryslow | placebo |
24+==============+===========+===========+==========+========+======+========+======+========+==========+=========+
25| ctu | 32 | 32 | 32 | 64 | 64 | 64 | 64 | 64 | 64 | 64 |
26+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
27| bframes | 4 | 4 | 4 | 4 | 4 | 4 | 4 | 8 | 8 | 8 |
28+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
29| b-adapt | 0 | 0 | 0 | 0 | 2 | 2 | 2 | 2 | 2 | 2 |
30+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
31| rc-lookahead | 10 | 10 | 15 | 15 | 15 | 20 | 25 | 30 | 40 | 60 |
32+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
33| scenecut | 0 | 40 | 40 | 40 | 40 | 40 | 40 | 40 | 40 | 40 |
34+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
35| refs | 1 | 1 | 1 | 1 | 3 | 3 | 3 | 3 | 5 | 5 |
36+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
37| me | dia | hex | hex | hex | hex | hex | star | star | star | star |
38+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
39| merange | 25 | 44 | 57 | 57 | 57 | 57 | 57 | 57 | 57 | 92 |
40+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
41| subme | 0 | 1 | 1 | 2 | 2 | 2 | 3 | 3 | 4 | 5 |
42+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
43| rect | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 |
44+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
45| amp | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
46+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
47| max-merge | 2 | 2 | 2 | 2 | 2 | 2 | 3 | 3 | 4 | 5 |
48+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
49| early-skip | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 |
50+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
51| fast-intra | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 |
52+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
53| b-intra | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
54+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
55| sao | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
56+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
57| signhide | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
58+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
59| weightp | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
60+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
61| weightb | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 |
62+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
63| aq-mode | 0 | 0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 |
64+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
65| cuTree | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 |
66+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
67| rdLevel | 2 | 2 | 2 | 2 | 2 | 3 | 4 | 6 | 6 | 6 |
68+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
b53f7c52 69| deblock | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 |
72b9787e
JB
70+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
71| tu-intra | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | 4 |
72+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
73| tu-inter | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | 4 |
74+--------------+-----------+-----------+----------+--------+------+--------+------+--------+----------+---------+
75
76Placebo mode enables transform-skip prediction evaluation.
77
b53f7c52
JB
78.. _tunings:
79
72b9787e
JB
80Tuning
81======
82
83There are a few :option:`--tune` options available, which are applied
84after the preset.
85
86.. Note::
87
88 The *psnr* and *ssim* tune options disable all optimizations that
89 sacrafice metric scores for perceived visual quality (also known as
90 psycho-visual optimizations). By default x265 always tunes for
91 highest perceived visual quality but if one intends to measure an
92 encode using PSNR or SSIM for the purpose of benchmarking, we highly
93 recommend you configure x265 to tune for that particular metric.
94
95+--------------+-----------------------------------------------------+
96| --tune | effect |
97+==============+=====================================================+
98| psnr | disables adaptive quant, psy-rd, and cutree |
99+--------------+-----------------------------------------------------+
100| ssim | enables adaptive quant auto-mode, disables psy-rd |
101+--------------+-----------------------------------------------------+
b53f7c52
JB
102| grain | improves retention of film grain. more below |
103+--------------+-----------------------------------------------------+
72b9787e
JB
104| fastdecode | no loop filters, no weighted pred, no intra in B |
105+--------------+-----------------------------------------------------+
106| zerolatency | no lookahead, no B frames, no cutree |
107+--------------+-----------------------------------------------------+
b53f7c52
JB
108| cbr | --pbratio 1.0 --ratetol 0.5 |
109+--------------+-----------------------------------------------------+
110
111
112Film Grain Retention
113~~~~~~~~~~~~~~~~~~~~
114
115:option:`--tune` grain tries to improve the retention of film grain in
116the reconstructed output. It helps rate distortion optimizations select
117modes which preserve high frequency noise:
118
119 * :option:`--psy-rd` 0.5
120 * :option:`--psy-rdoq` 30
121
122.. Note::
123
124 --psy-rdoq is only effective when RDOQuant is enabled, which is at
125 RD levels 4, 5, and 6 (presets slow and below).
126
127It lowers the strength of adaptive quantization, so residual energy can
128be more evenly distributed across the (noisy) picture:
129
130 * :option:`--aq-mode` 1
131 * :option:`--aq-strength` 0.3
132
133And it similarly tunes rate control to prevent the slice QP from
134swinging too wildly from frame to frame:
135
136 * :option:`--ipratio` 1.1
137 * :option:`--pbratio` 1.1
138 * :option:`--qcomp` 0.8
139
140And lastly it reduces the strength of deblocking to prevent grain being
141blurred on block boundaries:
142
143 * :option:`--deblock` -2
144