5 .. _string-options-ref:
7 Note that unless an option is listed as **CLI ONLY** the option is also
8 supported by x265_param_parse(). The CLI uses getopt to parse the
9 command line options so the short or long versions may be used and the
10 long options may be truncated to the shortest unambiguous abbreviation.
11 Users of the API must pass x265_param_parse() the full option name.
13 Preset and tune have special implications. The API user must call
14 x265_param_default_preset() with the preset and tune parameters they
15 wish to use, prior to calling x265_param_parse() to set any additional
16 fields. The CLI does this for the user implicitly, so all CLI options
17 are applied after the user's preset and tune choices, regardless of the
18 order of the arguments on the command line.
20 If there is an extra command line argument (not an option or an option
21 value) the CLI will treat it as the input filename. This effectively
22 makes the :option:`--input` specifier optional for the input file. If
23 there are two extra arguments, the second is treated as the output
24 bitstream filename, making :option:`--output` also optional if the input
25 filename was implied. This makes :command:`x265 in.y4m out.hevc` a valid
26 command line. If there are more than two extra arguments, the CLI will
27 consider this an error and abort.
29 Generally, when an option expects a string value from a list of strings
30 the user may specify the integer ordinal of the value they desire. ie:
31 :option:`--log-level` 3 is equivalent to :option:`--log-level` debug.
36 .. option:: --help, -h
42 .. option:: --version, -V
44 Display version details
48 Logging/Statistic Options
49 =========================
51 .. option:: --log-level <integer|string>
53 Logging level. Debug level enables per-frame QP, metric, and bitrate
54 logging. If a CSV file is being generated, debug level makes the log
55 be per-frame rather than per-encode. Full level enables hash and
56 weight logging. -1 disables all logging, except certain fatal
57 errors, and can be specified by the string "none".
65 .. option:: --no-progress
67 Disable periodic progress reports from the CLI
71 .. option:: --csv <filename>
73 Writes encoding results to a comma separated value log file. Creates
74 the file if it doesnt already exist, else adds one line per run. if
75 :option:`--log-level` is debug or above, it writes one line per
78 .. option:: --cu-stats, --no-cu-stats
80 Records statistics on how each CU was coded (split depths and other
81 mode decisions) and reports those statistics at the end of the
82 encode. Default disabled
84 .. option:: --ssim, --no-ssim
86 Calculate and report Structural Similarity values. It is
87 recommended to use :option:`--tune` ssim if you are measuring ssim,
88 else the results should not be used for comparison purposes.
91 .. option:: --psnr, --no-psnr
93 Calculate and report Peak Signal to Noise Ratio. It is recommended
94 to use :option:`--tune` psnr if you are measuring PSNR, else the
95 results should not be used for comparison purposes. Default
101 .. option:: --asm <integer:false:string>, --no-asm
103 x265 will use all detected CPU SIMD architectures by default. You can
104 disable all assembly by using :option:`--no-asm` or you can specify
105 a comma separated list of SIMD architectures to use, matching these
106 strings: MMX2, SSE, SSE2, SSE3, SSSE3, SSE4, SSE4.1, SSE4.2, AVX, XOP, FMA4, AVX2, FMA3
108 Some higher architectures imply lower ones being present, this is
111 One may also directly supply the CPU capability bitmap as an integer.
113 .. option:: --frame-threads, -F <integer>
115 Number of concurrently encoded frames. Using a single frame thread
116 gives a slight improvement in compression, since the entire reference
117 frames are always available for motion compensation, but it has
118 severe performance implications. Default is an autodetected count
119 based on the number of CPU cores and whether WPP is enabled or not.
121 Over-allocation of frame threads will not improve performance, it
122 will generally just increase memory use.
124 .. option:: --threads <integer>
126 Number of threads to allocate for the worker thread pool This pool
127 is used for WPP and for distributed analysis and motion search:
128 :option:`--wpp` :option:`--pmode` and :option:`--pme` respectively.
130 If :option:`--threads` 1 is specified, then no thread pool is
131 created. When no thread pool is created, all the thread pool
132 features are implicitly disabled. If all the pool features are
133 disabled by the user, then the pool is implicitly disabled.
135 Default 0, one thread is allocated per detected hardware thread
138 .. option:: --wpp, --no-wpp
140 Enable Wavefront Parallel Processing. The encoder may begin encoding
141 a row as soon as the row above it is at least two CTUs ahead in the
142 encode process. This gives a 3-5x gain in parallelism for about 1%
143 overhead in compression efficiency.
145 This feature is implicitly disabled when no thread pool is present.
149 .. option:: --pmode, --no-pmode
151 Parallel mode decision, or distributed mode analysis. When enabled
152 the encoder will distribute the analysis work of each CU (merge,
153 inter, intra) across multiple worker threads. Only recommended if
154 x265 is not already saturating the CPU cores. In RD levels 3 and 4
155 it will be most effective if --rect is enabled. At RD levels 5 and
156 6 there is generally always enough work to distribute to warrant the
157 overhead, assuming your CPUs are not already saturated.
159 --pmode will increase utilization without reducing compression
160 efficiency. In fact, since the modes are all measured in parallel it
161 makes certain early-outs impractical and thus you usually get
162 slightly better compression when it is enabled (at the expense of
163 not skipping improbable modes). This bypassing of early-outs can
164 cause pmode to slow down encodes, especially at faster presets.
166 This feature is implicitly disabled when no thread pool is present.
170 .. option:: --pme, --no-pme
172 Parallel motion estimation. When enabled the encoder will distribute
173 motion estimation across multiple worker threads when more than two
174 references require motion searches for a given CU. Only recommended
175 if x265 is not already saturating CPU cores. :option:`--pmode` is
176 much more effective than this option, since the amount of work it
177 distributes is substantially higher. With --pme it is not unusual
178 for the overhead of distributing the work to outweigh the
179 parallelism benefits.
181 This feature is implicitly disabled when no thread pool is present.
183 --pme will increase utilization on many core systems with no effect
184 on the output bitstream.
188 .. option:: --preset, -p <integer|string>
190 Sets parameters to preselected values, trading off compression efficiency against
191 encoding speed. These parameters are applied before all other input parameters are
192 applied, and so you can override any parameters that these values control. See
193 :ref:`presets <presets>` for more detail.
200 5. medium **(default)**
206 .. option:: --tune, -t <string>
208 Tune the settings for a particular type of source or situation. The changes will
209 be applied after :option:`--preset` but before all other parameters. Default none.
210 See :ref:`tunings <tunings>` for more detail.
212 **Values:** psnr, ssim, grain, zero-latency, fast-decode, cbr.
214 Input/Output File Options
215 =========================
217 These options all describe the input video sequence or, in the case of
218 :option:`--dither`, operations that are performed on the sequence prior
219 to encode. All options dealing with files (names, formats, offsets or
220 frame counts) are only applicable to the CLI application.
222 .. option:: --input <filename>
224 Input filename, only raw YUV or Y4M supported. Use single dash for
225 stdin. This option name will be implied for the first "extra"
226 command line argument.
232 Parse input stream as YUV4MPEG2 regardless of file extension,
233 primarily intended for use with stdin (ie: :option:`--input` -
234 :option:`--y4m`). This option is implied if the input filename has
239 .. option:: --input-depth <integer>
241 YUV only: Bit-depth of input file or stream
243 **Values:** any value between 8 and 16. Default is internal depth.
249 Enable high quality downscaling. Dithering is based on the diffusion
250 of errors from one row of pixels to the next row of pixels in a
251 picture. Only applicable when the input bit depth is larger than
252 8bits and internal bit depth is 8bits. Default disabled
256 .. option:: --input-res <wxh>
258 YUV only: Source picture size [w x h]
262 .. option:: --input-csp <integer|string>
264 YUV only: Source color space. Only i420, i422, and i444 are
265 supported at this time. The internal color space is always the
266 same as the source color space (libx265 does not support any color
270 1. i420 **(default)**
276 .. option:: --fps <integer|float|numerator/denominator>
278 YUV only: Source frame rate
280 **Range of values:** positive int or float, or num/denom
282 .. option:: --interlaceMode <false|tff|bff>, --no-interlaceMode
284 0. progressive pictures **(default)**
286 2. bottom field first
288 HEVC encodes interlaced content as fields. Fields must be provided to
289 the encoder in the correct temporal order. The source dimensions
290 must be field dimensions and the FPS must be in units of fields per
291 second. The decoder must re-combine the fields in their correct
292 orientation for display.
294 .. option:: --seek <integer>
296 Number of frames to skip at start of input file. Default 0
300 .. option:: --frames, -f <integer>
302 Number of frames of input sequence to be encoded. Default 0 (all)
306 .. option:: --output, -o <filename>
308 Bitstream output file name. If there are two extra CLI options, the
309 first is implicitly the input filename and the second is the output
310 filename, making the :option:`--output` option optional.
312 The output file will always contain a raw HEVC bitstream, the CLI
313 does not support any container file formats.
320 .. option:: --profile <string>
322 Enforce the requirements of the specified profile, ensuring the
323 output stream will be decodable by a decoder which supports that
324 profile. May abort the encode if the specified profile is
325 impossible to be supported by the compile options chosen for the
326 encoder (a high bit depth encoder will be unable to output
327 bitstreams compliant with Main or Mainstillpicture).
329 API users must use x265_param_apply_profile() after configuring
330 their param structure. Any changes made to the param structure after
331 this call might make the encode non-compliant.
333 **Values:** main, main10, mainstillpicture, main422-8, main422-10, main444-8, main444-10
337 .. option:: --level-idc <integer|float>
339 Minimum decoder requirement level. Defaults to 0, which implies
340 auto-detection by the encoder. If specified, the encoder will
341 attempt to bring the encode specifications within that specified
342 level. If the encoder is unable to reach the level it issues a
343 warning and aborts the encode. If the requested requirement level is
344 higher than the actual level, the actual requirement level is
347 Beware, specifying a decoder level will force the encoder to enable
348 VBV for constant rate factor encodes, which may introduce
351 The value is specified as a float or as an integer with the level
352 times 10, for example level **5.1** is specified as "5.1" or "51",
353 and level **5.0** is specified as "5.0" or "50".
355 Annex A levels: 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2
357 .. option:: --high-tier, --no-high-tier
359 If :option:`--level-idc` has been specified, the option adds the
360 intention to support the High tier of that level. If your specified
361 level does not support a High tier, a warning is issued and this
362 modifier flag is ignored.
365 :option:`--profile`, :option:`--level-idc`, and
366 :option:`--high-tier` are only intended for use when you are
367 targeting a particular decoder (or decoders) with fixed resource
368 limitations and must constrain the bitstream within those limits.
369 Specifying a profile or level may lower the encode quality
370 parameters to meet those requirements but it will never raise
373 Mode decision / Analysis
374 ========================
376 .. option:: --rd <0..6>
378 Level of RDO in mode decision. The higher the value, the more
379 exhaustive the analysis and the more rate distortion optimization is
380 used. The lower the value the faster the encode, the higher the
381 value the smaller the bitstream (in general). Default 3
383 Note that this table aims for accuracy, but is not necessarily our
384 final target behavior for each mode.
386 +-------+---------------------------------------------------------------+
387 | Level | Description |
388 +=======+===============================================================+
389 | 0 | sa8d mode and split decisions, intra w/ source pixels |
390 +-------+---------------------------------------------------------------+
391 | 1 | recon generated (better intra), RDO merge/skip selection |
392 +-------+---------------------------------------------------------------+
393 | 2 | RDO splits and merge/skip selection |
394 +-------+---------------------------------------------------------------+
395 | 3 | RDO mode and split decisions, chroma residual used for sa8d |
396 +-------+---------------------------------------------------------------+
397 | 4 | Adds RDO Quant |
398 +-------+---------------------------------------------------------------+
399 | 5 | Adds RDO prediction decisions |
400 +-------+---------------------------------------------------------------+
401 | 6 | Currently same as 5 |
402 +-------+---------------------------------------------------------------+
404 **Range of values:** 0: least .. 6: full RDO analysis
406 Options which affect the coding unit quad-tree, sometimes referred to as
407 the prediction quad-tree.
409 .. option:: --ctu, -s <64|32|16>
411 Maximum CU size (width and height). The larger the maximum CU size,
412 the more efficiently x265 can encode flat areas of the picture,
413 giving large reductions in bitrate. However this comes at a loss of
414 parallelism with fewer rows of CUs that can be encoded in parallel,
415 and less frame parallelism as well. Because of this the faster
416 presets use a CU size of 32. Default: 64
418 .. option:: --rect, --no-rect
420 Enable analysis of rectangular motion partitions Nx2N and 2NxN
421 (50/50 splits, two directions). Default disabled
423 .. option:: --amp, --no-amp
425 Enable analysis of asymmetric motion partitions (75/25 splits, four
426 directions). At RD levels 0 through 4, AMP partitions are only
427 considered at CU sizes 32x32 and below. At RD levels 5 and 6, it
428 will only consider AMP partitions as merge candidates (no motion
429 search) at 64x64, and as merge or inter candidates below 64x64.
431 The AMP partitions which are searched are derived from the current
432 best inter partition. If Nx2N (vertical rectangular) is the best
433 current prediction, then left and right asymmetrical splits will be
434 evaluated. If 2NxN (horizontal rectangular) is the best current
435 prediction, then top and bottom asymmetrical splits will be
436 evaluated, If 2Nx2N is the best prediction, and the block is not a
437 merge/skip, then all four AMP partitions are evaluated.
439 This setting has no effect if rectangular partitions are disabled.
442 .. option:: --early-skip, --no-early-skip
444 Measure full CU size (2Nx2N) merge candidates first; if no residual
445 is found the analysis is short circuited. Default disabled
447 .. option:: --fast-cbf, --no-fast-cbf
449 Short circuit analysis if a prediction is found that does not set
450 the coded block flag (aka: no residual was encoded). It prevents
451 the encoder from perhaps finding other predictions that also have no
452 residual but require less signaling bits or have less distortion.
453 Only applicable for RD levels 5 and 6. Default disabled
455 .. option:: --fast-intra, --no-fast-intra
457 Perform an initial scan of every fifth intra angular mode, then
458 check modes +/- 2 distance from the best mode, then +/- 1 distance
459 from the best mode, effectively performing a gradient descent. When
460 enabled 10 modes in total are checked. When disabled all 33 angular
461 modes are checked. Only applicable for :option:`--rd` levels 4 and
462 below (medium preset and faster).
464 .. option:: --b-intra, --no-b-intra
466 Enables the evaluation of intra modes in B slices. Default disabled.
468 .. option:: --cu-lossless, --no-cu-lossless
470 For each CU, evaluate lossless (transform and quant bypass) encode
471 of the best non-lossless mode option as a potential rate distortion
472 optimization. If the global option :option:`--lossless` has been
473 specified, all CUs will be encoded as lossless unconditionally
474 regardless of whether this option was enabled. Default disabled.
476 Only effective at RD levels 3 and above, which perform RDO mode
479 .. option:: --tskip, --no-tskip
481 Enable evaluation of transform skip (bypass DCT but still use
482 quantization) coding for 4x4 TU coded blocks.
484 Only effective at RD levels 3 and above, which perform RDO mode
485 decisions. Default disabled
487 .. option:: --tskip-fast, --no-tskip-fast
489 Only evaluate transform skip for NxN intra predictions (4x4 blocks).
490 Only applicable if transform skip is enabled. For chroma, only
491 evaluate if luma used tskip. Inter block tskip analysis is
492 unmodified. Default disabled
494 Analysis re-use options, to improve performance when encoding the same
495 sequence multiple times (presumably at varying bitrates). The encoder
496 will not reuse analysis if the resolution and slice type parameters do
499 .. option:: --analysis-mode <string|int>
501 Specify whether analysis information of each frame is output by encoder
502 or input for reuse. By reading the analysis data writen by an
503 earlier encode of the same sequence, substantial redundant work may
506 The following data may be stored and reused:
507 I frames - split decisions and luma intra directions of all CUs.
508 P/B frames - motion vectors are dumped at each depth for all CUs.
510 **Values:** off(0), save(1): dump analysis data, load(2): read analysis data
512 .. option:: --analysis-file <filename>
514 Specify a filename for analysis data (see :option:`--analysis-mode`)
515 If no filename is specified, x265_analysis.dat is used.
517 Options which affect the transform unit quad-tree, sometimes referred to
518 as the residual quad-tree (RQT).
520 .. option:: --tu-intra-depth <1..4>
522 The transform unit (residual) quad-tree begins with the same depth
523 as the coding unit quad-tree, but the encoder may decide to further
524 split the transform unit tree if it improves compression efficiency.
525 This setting limits the number of extra recursion depth which can be
526 attempted for intra coded units. Default: 1, which means the
527 residual quad-tree is always at the same depth as the coded unit
530 Note that when the CU intra prediction is NxN (only possible with
531 8x8 CUs), a TU split is implied, and thus the residual quad-tree
532 begins at 4x4 and cannot split any futhrer.
534 .. option:: --tu-inter-depth <1..4>
536 The transform unit (residual) quad-tree begins with the same depth
537 as the coding unit quad-tree, but the encoder may decide to further
538 split the transform unit tree if it improves compression efficiency.
539 This setting limits the number of extra recursion depth which can be
540 attempted for inter coded units. Default: 1. which means the
541 residual quad-tree is always at the same depth as the coded unit
542 quad-tree unless the CU was coded with rectangular or AMP
543 partitions, in which case a TU split is implied and thus the
544 residual quad-tree begins one layer below the CU quad-tree.
546 Temporal / motion search options
547 ================================
549 .. option:: --me <integer|string>
551 Motion search method. Generally, the higher the number the harder
552 the ME method will try to find an optimal match. Diamond search is
553 the simplest. Hexagon search is a little better. Uneven
554 Multi-Hexegon is an adaption of the search method used by x264 for
555 slower presets. Star is a three step search adapted from the HM
556 encoder: a star-pattern search followed by an optional radix scan
557 followed by an optional star-search refinement. Full is an
558 exhaustive search; an order of magnitude slower than all other
559 searches but not much better than umh or star.
567 .. option:: --subme, -m <0..7>
569 Amount of subpel refinement to perform. The higher the number the
570 more subpel iterations and steps are performed. Default 2
572 +----+------------+-----------+------------+-----------+-----------+
573 | -m | HPEL iters | HPEL dirs | QPEL iters | QPEL dirs | HPEL SATD |
574 +====+============+===========+============+===========+===========+
575 | 0 | 1 | 4 | 0 | 4 | false |
576 +----+------------+-----------+------------+-----------+-----------+
577 | 1 | 1 | 4 | 1 | 4 | false |
578 +----+------------+-----------+------------+-----------+-----------+
579 | 2 | 1 | 4 | 1 | 4 | true |
580 +----+------------+-----------+------------+-----------+-----------+
581 | 3 | 2 | 4 | 1 | 4 | true |
582 +----+------------+-----------+------------+-----------+-----------+
583 | 4 | 2 | 4 | 2 | 4 | true |
584 +----+------------+-----------+------------+-----------+-----------+
585 | 5 | 1 | 8 | 1 | 8 | true |
586 +----+------------+-----------+------------+-----------+-----------+
587 | 6 | 2 | 8 | 1 | 8 | true |
588 +----+------------+-----------+------------+-----------+-----------+
589 | 7 | 2 | 8 | 2 | 8 | true |
590 +----+------------+-----------+------------+-----------+-----------+
592 At --subme values larger than 2, chroma residual cost is included
593 in all subpel refinement steps and chroma residual is included in
594 all motion estimation decisions (selecting the best reference
595 picture in each list, and chosing between merge, uni-directional
596 motion and bi-directional motion). The 'slow' preset is the first
597 preset to enable the use of chroma residual.
599 .. option:: --merange <integer>
601 Motion search range. Default 57
603 The default is derived from the default CTU size (64) minus the luma
604 interpolation half-length (4) minus maximum subpel distance (2)
605 minus one extra pixel just in case the hex search method is used. If
606 the search range were any larger than this, another CTU row of
607 latency would be required for reference frames.
609 **Range of values:** an integer from 0 to 32768
611 .. option:: --max-merge <1..5>
613 Maximum number of neighbor (spatial and temporal) candidate blocks
614 that the encoder may consider for merging motion predictions. If a
615 merge candidate results in no residual, it is immediately selected
616 as a "skip". Otherwise the merge candidates are tested as part of
617 motion estimation when searching for the least cost inter option.
618 The max candidate number is encoded in the SPS and determines the
619 bit cost of signaling merge CUs. Default 2
621 .. option:: --temporal-mvp, --no-temporal-mvp
623 Enable temporal motion vector predictors in P and B slices.
624 This enables the use of the motion vector from the collocated block
625 in the previous frame to be used as a predictor. Default is enabled
627 .. option:: --weightp, -w, --no-weightp
629 Enable weighted prediction in P slices. This enables weighting
630 analysis in the lookahead, which influences slice decisions, and
631 enables weighting analysis in the main encoder which allows P
632 reference samples to have a weight function applied to them prior to
633 using them for motion compensation. In video which has lighting
634 changes, it can give a large improvement in compression efficiency.
637 .. option:: --weightb, --no-weightb
639 Enable weighted prediction in B slices. Default disabled
641 Spatial/intra options
642 =====================
644 .. option:: --strong-intra-smoothing, --no-strong-intra-smoothing
646 Enable strong intra smoothing for 32x32 intra blocks. Default enabled
648 .. option:: --constrained-intra, --no-constrained-intra
650 Constrained intra prediction. When generating intra predictions for
651 blocks in inter slices, only intra-coded reference pixels are used.
652 Inter-coded reference pixels are replaced with intra-coded neighbor
653 pixels or default values. The general idea is to block the
654 propagation of reference errors that may have resulted from lossy
655 signals. Default disabled
657 .. option:: --rdpenalty <0..2>
659 When set to 1, transform units of size 32x32 are given a 4x bit cost
660 penalty compared to smaller transform units, in intra coded CUs in P
663 When set to 2, transform units of size 32x32 are not even attempted,
664 unless otherwise required by the maximum recursion depth. For this
665 option to be effective with 32x32 intra CUs,
666 :option:`--tu-intra-depth` must be at least 2. For it to be
667 effective with 64x64 intra CUs, :option:`--tu-intra-depth` must be
670 Note that in HEVC an intra transform unit (a block of the residual
671 quad-tree) is also a prediction unit, meaning that the intra
672 prediction signal is generated for each TU block, the residual
673 subtracted and then coded. The coding unit simply provides the
674 prediction modes that will be used when predicting all of the
675 transform units within the CU. This means that when you prevent
676 32x32 intra transform units, you are preventing 32x32 intra
681 **Values:** 0:disabled 1:4x cost penalty 2:force splits
683 Psycho-visual options
684 =====================
686 Left to its own devices, the encoder will make mode decisions based on a
687 simple rate distortion formula, trading distortion for bitrate. This is
688 generally effective except for the manner in which this distortion is
689 measured. It tends to favor blurred reconstructed blocks over blocks
690 which have wrong motion. The human eye generally prefers the wrong
691 motion over the blur and thus x265 offers psycho-visual adjustments to
692 the rate distortion algorithm.
694 :option:`--psy-rd` will add an extra cost to reconstructed blocks which
695 do not match the visual energy of the source block. The higher the
696 strength of :option:`--psy-rd` the more strongly it will favor similar
697 energy over blur and the more aggressively it will ignore rate
698 distortion. If it is too high, it will introduce visal artifacts and
699 increase bitrate enough for rate control to increase quantization
700 globally, reducing overall quality. psy-rd will tend to reduce the use
701 of blurred prediction modes, like DC and planar intra and bi-directional
704 :option:`--psy-rdoq` will adjust the distortion cost used in
705 rate-distortion optimized quantization (RDO quant), enabled in
706 :option:`--rd` 4 and above, favoring the preservation of energy in the
707 reconstructed image. :option:`--psy-rdoq` prevents RDOQ from blurring
708 all of the encoding options which psy-rd has to chose from. At low
709 strength levels, psy-rdoq will influence the quantization level
710 decisions, favoring higher AC energy in the reconstructed image. As
711 psy-rdoq strength is increased, more non-zero coefficient levels are
712 added and fewer coefficients are zeroed by RDOQ's rate distortion
713 analysis. High levels of psy-rdoq can double the bitrate which can have
714 a drastic effect on rate control, forcing higher overall QP, and can
715 cause ringing artifacts. psy-rdoq is less accurate than psy-rd, it is
716 biasing towards energy in general while psy-rd biases towards the energy
717 of the source image. But very large psy-rdoq values can sometimes be
718 beneficial, preserving film grain for instance.
720 As a general rule, when both psycho-visual features are disabled, the
721 encoder will tend to blur blocks in areas of difficult motion. Turning
722 on small amounts of psy-rd and psy-rdoq will improve the perceived
723 visual quality. Increasing psycho-visual strength further will improve
724 quality and begin introducing artifacts and increase bitrate, which may
725 force rate control to increase global QP. Finding the optimal
726 psycho-visual parameters for a given video requires experimentation. Our
727 recommended defaults (1.0 for both) are generally on the low end of the
730 The lower the bitrate, the lower the optimal psycho-visual settings. If
731 the bitrate is too low for the psycho-visual settings, you will begin to
732 see temporal artifacts (motion judder). This is caused when the encoder
733 is forced to code skip blocks (no residual) in areas of difficult motion
734 because it is the best option psycho-visually (they have great amounts
735 of energy and no residual cost). One can lower psy-rd settings when
736 judder is happening, and allow the encoder to use some blur in these
737 areas of high motion.
739 .. option:: --psy-rd <float>
741 Influence rate distortion optimizated mode decision to preserve the
742 energy of the source image in the encoded image at the expense of
743 compression efficiency. It only has effect on presets which use
744 RDO-based mode decisions (:option:`--rd` 3 and above). 1.0 is a
745 typical value. Default disabled. Experimental
747 **Range of values:** 0 .. 2.0
749 .. option:: --psy-rdoq <float>
751 Influence rate distortion optimized quantization by favoring higher
752 energy in the reconstructed image. This generally improves perceived
753 visual quality at the cost of lower quality metric scores. It only
754 has effect on slower presets which use RDO Quantization
755 (:option:`--rd` 4, 5 and 6). 1.0 is a typical value. Default
756 disabled. High values can be beneficial in preserving high-frequency
757 detail like film grain. Experimental
759 **Range of values:** 0 .. 50.0
762 Slice decision options
763 ======================
765 .. option:: --open-gop, --no-open-gop
767 Enable open GOP, allow I-slices to be non-IDR. Default enabled
769 .. option:: --keyint, -I <integer>
771 Max intra period in frames. A special case of infinite-gop (single
772 keyframe at the beginning of the stream) can be triggered with
773 argument -1. Use 1 to force all-intra. Default 250
775 .. option:: --min-keyint, -i <integer>
777 Minimum GOP size. Scenecuts closer together than this are coded as I
778 or P, not IDR. Minimum keyint is clamped to be at least half of
779 :option:`--keyint`. If you wish to force regular keyframe intervals
780 and disable adaptive I frame placement, you must use
781 :option:`--no-scenecut`.
783 **Range of values:** >=0 (0: auto)
785 .. option:: --scenecut <integer>, --no-scenecut
787 How aggressively I-frames need to be inserted. The higher the
788 threshold value, the more aggressive the I-frame placement.
789 :option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive
790 I frame placement. Default 40
792 .. option:: --rc-lookahead <integer>
794 Number of frames for slice-type decision lookahead (a key
795 determining factor for encoder latency). The longer the lookahead
796 buffer the more accurate scenecut decisions will be, and the more
797 effective cuTree will be at improving adaptive quant. Having a
798 lookahead larger than the max keyframe interval is not helpful.
801 **Range of values:** Between the maximum consecutive bframe count (:option:`--bframes`) and 250
803 .. option:: --b-adapt <integer>
805 Adaptive B frame scheduling. Default 2
807 **Values:** 0:none; 1:fast; 2:full(trellis)
809 .. option:: --bframes, -b <0..16>
811 Maximum number of consecutive b-frames. Use :option:`--bframes` 0 to
812 force all P/I low-latency encodes. Default 4. This parameter has a
813 quadratic effect on the amount of memory allocated and the amount of
814 work performed by the full trellis version of :option:`--b-adapt`
817 .. option:: --bframe-bias <integer>
819 Bias towards B frames in slicetype decision. The higher the bias the
820 more likely x265 is to use B frames. Can be any value between -90
821 and 100 and is clipped to that range. Default 0
823 .. option:: --b-pyramid, --no-b-pyramid
825 Use B-frames as references, when possible. Default enabled
827 .. option:: --ref <1..16>
829 Max number of L0 references to be allowed. This number has a linear
830 multiplier effect on the amount of work performed in motion search,
831 but will generally have a beneficial affect on compression and
832 distortion. Default 3
834 Quality, rate control and rate distortion options
835 =================================================
837 .. option:: --bitrate <integer>
839 Enables single-pass ABR rate control. Specify the target bitrate in
840 kbps. Default is 0 (CRF)
842 **Range of values:** An integer greater than 0
844 .. option:: --crf <0..51.0>
846 Quality-controlled variable bitrate. CRF is the default rate control
847 method; it does not try to reach any particular bitrate target,
848 instead it tries to achieve a given uniform quality and the size of
849 the bitstream is determined by the complexity of the source video.
850 The higher the rate factor the higher the quantization and the lower
851 the quality. Default rate factor is 28.0.
853 .. option:: --crf-max <0..51.0>
855 Specify an upper limit to the rate factor which may be assigned to
856 any given frame (ensuring a max QP). This is dangerous when CRF is
857 used in combination with VBV as it may result in buffer underruns.
860 .. option:: --crf-min <0..51.0>
862 Specify an lower limit to the rate factor which may be assigned to
863 any given frame (ensuring a min compression factor).
865 .. option:: --vbv-bufsize <integer>
867 Specify the size of the VBV buffer (kbits). Enables VBV in ABR
868 mode. In CRF mode, :option:`--vbv-maxrate` must also be specified.
869 Default 0 (vbv disabled)
871 .. option:: --vbv-maxrate <integer>
873 Maximum local bitrate (kbits/sec). Will be used only if vbv-bufsize
874 is also non-zero. Both vbv-bufsize and vbv-maxrate are required to
875 enable VBV in CRF mode. Default 0 (disabled)
877 .. option:: --vbv-init <float>
879 Initial buffer occupancy. The portion of the decode buffer which
880 must be full before the decoder will begin decoding. Determines
881 absolute maximum frame size. May be specified as a fractional value
882 between 0 and 1, or in kbits. In other words these two option pairs
885 --vbv-bufsize 1000 --vbv-init 900
886 --vbv-bufsize 1000 --vbv-init 0.9
890 **Range of values:** fractional: 0 - 1.0, or kbits: 2 .. bufsize
892 .. option:: --qp, -q <integer>
894 Specify base quantization parameter for Constant QP rate control.
895 Using this option enables Constant QP rate control. The specified QP
896 is assigned to P slices. I and B slices are given QPs relative to P
897 slices using param->rc.ipFactor and param->rc.pbFactor unless QP 0
898 is specified, in which case QP 0 is used for all slice types. Note
899 that QP 0 does not cause lossless encoding, it only disables
900 quantization. Default disabled (CRF)
902 **Range of values:** an integer from 0 to 51
904 .. option:: --lossless, --no-lossless
906 Enables true lossless coding by bypassing scaling, transform,
907 quantization and in-loop filter processes. This is used for
908 ultra-high bitrates with zero loss of quality. Reconstructed output
909 pictures are bit-exact to the input pictures. Lossless encodes
910 implicitly have no rate control, all rate control options are
911 ignored. Slower presets will generally achieve better compression
912 efficiency (and generate smaller bitstreams). Default disabled.
914 .. option:: --aq-mode <0|1|2>
916 Adaptive Quantization operating mode. Raise or lower per-block
917 quantization based on complexity analysis of the source image. The
918 more complex the block, the more quantization is used. This offsets
919 the tendency of the encoder to spend too many bits on complex areas
920 and not enough in flat areas.
923 1. AQ enabled **(default)**
924 2. AQ enabled with auto-variance
926 .. option:: --aq-strength <float>
928 Adjust the strength of the adaptive quantization offsets. Setting
929 :option:`--aq-strength` to 0 disables AQ. Default 1.0.
931 **Range of values:** 0.0 to 3.0
933 .. option:: --cutree, --no-cutree
935 Enable the use of lookahead's lowres motion vector fields to
936 determine the amount of reuse of each block to tune adaptive
937 quantization factors. CU blocks which are heavily reused as motion
938 reference for later frames are given a lower QP (more bits) while CU
939 blocks which are quickly changed and are not referenced are given
940 less bits. This tends to improve detail in the backgrounds of video
941 with less detail in areas of high motion. Default enabled
943 .. option:: --nr-intra <integer>, --nr-inter <integer>
945 Noise reduction - an adaptive deadzone applied after DCT
946 (subtracting from DCT coefficients), before quantization. It does
947 no pixel-level filtering, doesn't cross DCT block boundaries, has no
948 overlap, The higher the strength value parameter, the more
949 aggressively it will reduce noise.
951 Enabling noise reduction will make outputs diverge between different
952 numbers of frame threads. Outputs will be deterministic but the
953 outputs of -F2 will no longer match the outputs of -F3, etc.
955 **Values:** any value in range of 0 to 2000. Default 0 (disabled).
957 .. option:: --pass <integer>
959 Enable multi-pass rate control mode. Input is encoded multiple times,
960 storing the encoded information of each pass in a stats file from which
961 the consecutive pass tunes the qp of each frame to improve the quality
962 of the output. Default disabled
964 1. First pass, creates stats file
965 2. Last pass, does not overwrite stats file
966 3. Nth pass, overwrites stats file
968 **Range of values:** 1 to 3
970 .. option:: --stats <filename>
972 Specify file name of of the multi-pass stats file. If unspecified
973 the encoder will use x265_2pass.log
975 .. option:: --slow-firstpass, --no-slow-firstpass
977 Enable a slow and more detailed first pass encode in multi-pass rate
978 control mode. Speed of the first pass encode is slightly lesser and
979 quality midly improved when compared to the default settings in a
980 multi-pass encode. Default disabled (turbo mode enabled)
982 When **turbo** first pass is not disabled, these options are
983 set on the first pass to improve performance:
985 * :option:`--fast-intra`
986 * :option:`--no-rect`
988 * :option:`--early-skip`
989 * :option:`--ref` = 1
990 * :option:`--max-merge` = 1
991 * :option:`--me` = DIA
992 * :option:`--subme` = MIN(2, :option:`--subme`)
993 * :option:`--rd` = MIN(2, :option:`--rd`)
995 .. option:: --cbqpoffs <integer>
997 Offset of Cb chroma QP from the luma QP selected by rate control.
998 This is a general way to spend more or less bits on the chroma
1001 **Range of values:** -12 to 12
1003 .. option:: --crqpoffs <integer>
1005 Offset of Cr chroma QP from the luma QP selected by rate control.
1006 This is a general way to spend more or less bits on the chroma
1009 **Range of values:** -12 to 12
1011 .. option:: --ipratio <float>
1013 QP ratio factor between I and P slices. This ratio is used in all of
1014 the rate control modes. Some :option:`--tune` options may change the
1015 default value. It is not typically manually specified. Default 1.4
1017 .. option:: --pbratio <float>
1019 QP ratio factor between P and B slices. This ratio is used in all of
1020 the rate control modes. Some :option:`--tune` options may change the
1021 default value. It is not typically manually specified. Default 1.3
1023 .. option:: --qcomp <float>
1025 qComp sets the quantizer curve compression factor. It weights the
1026 frame quantizer based on the complexity of residual (measured by
1027 lookahead). Default value is 0.6. Increasing it to 1 will
1028 effectively generate CQP
1030 .. option:: --qstep <integer>
1032 The maximum single adjustment in QP allowed to rate control. Default
1035 .. option:: --ratetol <float>
1037 The degree of rate fluctuation that x265 tolerates. Rate tolerance
1038 is used along with overflow (difference between actual and target
1039 bitrate), to adjust qp. Default is 1.0
1041 .. option:: --qblur <float>
1043 Temporally blur quants. Default 0.5
1045 .. option:: --cplxblur <float>
1047 temporally blur complexity. default 20
1049 Quantization Options
1050 ====================
1052 Note that rate-distortion optimized quantization (RDOQ) is enabled
1053 implicitly at :option:`--rd` 4, 5, and 6 and disabled implicitly at all
1056 .. option:: --signhide, --no-signhide
1058 Hide sign bit of one coeff per TU (rdo). The last sign is implied.
1059 This requires analyzing all the coefficients to determine if a sign
1060 must be toggled, and then to determine which one can be toggled with
1061 the least amount of distortion. Default enabled
1063 .. option:: --qpfile <filename>
1065 Specify a text file which contains frametypes and QPs for some or
1066 all frames. The format of each line is:
1068 framenumber frametype QP
1070 Frametype can be one of [I,i,P,B,b]. **B** is a referenced B frame,
1071 **b** is an unreferenced B frame. **I** is a keyframe (random
1072 access point) while **i** is a I frame that is not a keyframe
1073 (references are not broken).
1075 Specifying QP (integer) is optional, and if specified they are
1076 clamped within the encoder to qpmin/qpmax.
1078 .. option:: --scaling-list <filename>
1080 Quantization scaling lists. HEVC supports 6 quantization scaling
1081 lists to be defined; one each for Y, Cb, Cr for intra prediction and
1082 one each for inter prediction.
1084 x265 does not use scaling lists by default, but this can also be
1085 made explicit by :option:`--scaling-list` *off*.
1087 HEVC specifies a default set of scaling lists which may be enabled
1088 without requiring them to be signaled in the SPS. Those scaling
1089 lists can be enabled via :option:`--scaling-list` *default*.
1091 All other strings indicate a filename containing custom scaling
1092 lists in the HM format. The encode will abort if the file is not
1093 parsed correctly. Custom lists must be signaled in the SPS
1095 .. option:: --lambda-file <filename>
1097 Specify a text file containing values for x265_lambda_tab and
1098 x265_lambda2_tab. Each table requires MAX_MAX_QP+1 (70) float
1101 The text file syntax is simple. Comma is considered to be
1102 white-space. All white-space is ignored. Lines must be less than 2k
1103 bytes in length. Content following hash (#) characters are ignored.
1104 The values read from the file are logged at :option:`--log-level`
1107 Note that the lambda tables are process-global and so the new values
1108 affect all encoders running in the same process.
1110 Lambda values affect encoder mode decisions, the lower the lambda
1111 the more bits it will try to spend on signaling information (motion
1112 vectors and splits) and less on residual. This feature is intended
1113 for experimentation.
1118 .. option:: --deblock=<int>:<int>, --no-deblock
1120 Toggle deblocking loop filter, optionally specify deblocking
1123 <int>:<int> - parsed as tC offset and Beta offset
1124 <int>,<int> - parsed as tC offset and Beta offset
1125 <int> - both tC and Beta offsets assigned the same value
1127 If unspecified, the offsets default to 0. The offsets must be in a
1128 range of -6 (lowest strength) to 6 (highest strength).
1130 To disable the deblocking filter entirely, use --no-deblock or
1131 --deblock=false. Default enabled, with both offsets defaulting to 0
1133 If deblocking is disabled, or the offsets are non-zero, these
1134 changes from the default configuration are signaled in the PPS.
1136 .. option:: --sao, --no-sao
1138 Toggle Sample Adaptive Offset loop filter, default enabled
1140 .. option:: --sao-non-deblock, --no-sao-non-deblock
1142 Specify how to handle depencency between SAO and deblocking filter.
1143 When enabled, non-deblocked pixels are used for SAO analysis. When
1144 disabled, SAO analysis skips the right/bottom boundary areas.
1147 VUI (Video Usability Information) options
1148 =========================================
1150 x265 emits a VUI with only the timing info by default. If the SAR is
1151 specified (or read from a Y4M header) it is also included. All other
1152 VUI fields must be manually specified.
1154 .. option:: --sar <integer|w:h>
1156 Sample Aspect Ratio, the ratio of width to height of an individual
1157 sample (pixel). The user may supply the width and height explicitly
1158 or specify an integer from the predefined list of aspect ratios
1159 defined in the HEVC specification. Default undefined (not signaled)
1178 .. option:: --crop-rect <left,top,right,bottom>
1180 Define the (overscan) region of the image that does not contain
1181 information because it was added to achieve certain resolution or
1182 aspect ratio. The decoder may be directed to crop away this region
1183 before displaying the images via the :option:`--overscan` option.
1184 Default undefined (not signaled)
1186 .. option:: --overscan <show|crop>
1188 Specify whether it is appropriate for the decoder to display or crop
1189 the overscan area. Default unspecified (not signaled)
1191 .. option:: --videoformat <integer|string>
1193 Specify the source format of the original analog video prior to
1194 digitizing and encoding. Default undefined (not signaled)
1203 .. option:: --range <full|limited>
1205 Specify output range of black level and range of luma and chroma
1206 signals. Default undefined (not signaled)
1208 .. option:: --colorprim <integer|string>
1210 Specify color primitive to use when converting to RGB. Default
1211 undefined (not signaled)
1223 .. option:: --transfer <integer|string>
1225 Specify transfer characteristics. Default undefined (not signaled)
1243 .. option:: --colormatrix <integer|string>
1245 Specify color matrix setting i.e set the matrix coefficients used in
1246 deriving the luma and chroma. Default undefined (not signaled)
1260 .. option:: --chromaloc <0..5>
1262 Specify chroma sample location for 4:2:0 inputs. Consult the HEVC
1263 specification for a description of these values. Default undefined
1269 .. option:: --repeat-headers, --no-repeat-headers
1271 If enabled, x265 will emit VPS, SPS, and PPS headers with every
1272 keyframe. This is intended for use when you do not have a container
1273 to keep the stream headers for you and you want keyframes to be
1274 random access points. Default disabled
1276 .. option:: --info, --no-info
1278 Emit an informational SEI with the stream headers which describes
1279 the encoder version, build info, and encode parameters. This is very
1280 helpful for debugging purposes but encoding version numbers and
1281 build info could make your bitstreams diverge and interfere with
1282 regression testing. Default enabled
1284 .. option:: --hrd, --no-hrd
1286 Enable the signalling of HRD parameters to the decoder. The HRD
1287 parameters are carried by the Buffering Period SEI messages and
1288 Picture Timing SEI messages providing timing information to the
1289 decoder. Default disabled
1291 .. option:: --aud, --no-aud
1293 Emit an access unit delimiter NAL at the start of each slice access
1294 unit. If :option:`--repeat-headers` is not enabled (indicating the
1295 user will be writing headers manually at the start of the stream)
1296 the very first AUD will be skipped since it cannot be placed at the
1297 start of the access unit, where it belongs. Default disabled
1299 .. option:: --hash <integer>
1301 Emit decoded picture hash SEI, so the decoder may validate the
1302 reconstructed pictures and detect data loss. Also useful as a
1303 debug feature to validate the encoder state. Default None
1312 .. option:: --recon, -r <filename>
1314 Output file containing reconstructed images in display order. If the
1315 file extension is ".y4m" the file will contain a YUV4MPEG2 stream
1316 header and frame headers. Otherwise it will be a raw YUV file in the
1317 encoder's internal bit depth.
1321 .. option:: --recon-depth <integer>
1323 Bit-depth of output file. This value defaults to the internal bit
1324 depth and currently cannot to be modified.