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.
33 Standalone Executable Options
34 =============================
36 .. option:: --help, -h
42 .. option:: --version, -V
44 Display version details
48 .. option:: --asm <integer:false:string>, --no-asm
50 x265 will use all detected CPU SIMD architectures by default. You can
51 disable all assembly by using :option:`--no-asm` or you can specify
52 a comma separated list of SIMD architectures to use, matching these
53 strings: MMX2, SSE, SSE2, SSE3, SSSE3, SSE4, SSE4.1, SSE4.2, AVX, XOP, FMA4, AVX2, FMA3
55 Some higher architectures imply lower ones being present, this is
58 One may also directly supply the CPU capability bitmap as an integer.
60 .. option:: --threads <integer>
62 Number of threads to allocate for the worker thread pool This pool
63 is used for WPP and for distributed analysis and motion search:
64 :option:`--wpp` :option:`--pmode` and :option:`--pme` respectively.
66 If :option:`--threads`=1 is specified, then no thread pool is
67 created. When no thread pool is created, all the thread pool
68 features are implicitly disabled. If all the pool features are
69 disabled by the user, then the pool is implicitly disabled.
71 Default 0, one thread is allocated per detected hardware thread
74 .. option:: --pmode, --no-pmode
76 Parallel mode decision, or distributed mode analysis. When enabled
77 the encoder will distribute the analysis work of each CU (merge,
78 inter, intra) across multiple worker threads. Only recommended if
79 x265 is not already saturating the CPU cores. In RD levels 3 and 4
80 it will be most effective if --rect was enabled. At RD levels 5 and
81 6 there is generally always enough work to distribute to warrant the
82 overhead, assuming your CPUs are not already saturated.
84 --pmode will increase utilization without reducing compression
85 efficiency. In fact, since the modes are all measured in parallel it
86 makes certain early-outs impractical and thus you usually get
87 slightly better compression when it is enabled (at the expense of
88 not skipping improbable modes).
90 This feature is implicitly disabled when no thread pool is present.
94 .. option:: --pme, --no-pme
96 Parallel motion estimation. When enabled the encoder will distribute
97 motion estimation across multiple worker threads when more than two
98 references require motion searches for a given CU. Only recommended
99 if x265 is not already saturating CPU cores. :option:`--pmode` is
100 much more effective than this option, since the amount of work it
101 distributes is substantially higher. With --pme it is not unusual
102 for the overhead of distributing the work to outweigh the
103 parallelism benefits.
105 This feature is implicitly disabled when no thread pool is present.
107 --pme will increase utilization on many core systems with no effect
108 on the output bitstream.
112 .. option:: --preset, -p <integer|string>
114 Sets parameters to preselected values, trading off compression efficiency against
115 encoding speed. These parameters are applied before all other input parameters are
116 applied, and so you can override any parameters that these values control.
123 5. medium **(default)**
129 .. option:: --tune, -t <string>
131 Tune the settings for a particular type of source or situation. The changes will
132 be applied after :option:`--preset` but before all other parameters. Default none
134 **Values:** psnr, ssim, zero-latency, fast-decode.
136 .. option:: --frame-threads, -F <integer>
138 Number of concurrently encoded frames. Using a single frame thread
139 gives a slight improvement in compression, since the entire reference
140 frames are always available for motion compensation, but it has
141 severe performance implications. Default is an autodetected count
142 based on the number of CPU cores and whether WPP is enabled or not.
144 Over-allocation of frame threads will not improve performance, it
145 will generally just increase memory use.
147 .. option:: --log-level <integer|string>
149 Logging level. Debug level enables per-frame QP, metric, and bitrate
150 logging. If a CSV file is being generated, debug level makes the log
151 be per-frame rather than per-encode. Full level enables hash and
152 weight logging. -1 disables all logging, except certain fatal
153 errors, and can be specified by the string "none".
157 2. info **(default)**
161 .. option:: --csv <filename>
163 Writes encoding results to a comma separated value log file. Creates
164 the file if it doesnt already exist, else adds one line per run. if
165 :option:`--log-level` is debug or above, it writes one line per
168 .. option:: --cu-stats, --no-cu-stats
170 Records statistics on how each CU was coded (split depths and other
171 mode decisions) and reports those statistics at the end of the
172 encode. Default disabled
174 .. option:: --output, -o <filename>
176 Bitstream output file name. If there are two extra CLI options, the
177 first is implicitly the input filename and the second is the output
178 filename, making the :option:`--output` option optional.
180 The output file will always contain a raw HEVC bitstream, the CLI
181 does not support any container file formats.
185 .. option:: --no-progress
187 Disable CLI periodic progress reports
191 Quality reporting metrics
192 =========================
194 .. option:: --ssim, --no-ssim
196 Calculate and report Structural Similarity values. It is
197 recommended to use :option:`--tune` ssim if you are measuring ssim,
198 else the results should not be used for comparison purposes.
201 .. option:: --psnr, --no-psnr
203 Calculate and report Peak Signal to Noise Ratio. It is recommended
204 to use :option:`--tune` psnr if you are measuring PSNR, else the
205 results should not be used for comparison purposes. Default
211 .. option:: --input <filename>
213 Input filename, only raw YUV or Y4M supported. Use single dash for
214 stdin. This option name will be implied for the first "extra"
215 command line argument.
221 Parse input stream as YUV4MPEG2 regardless of file extension,
222 primarily intended for use with stdin (ie: :option:`--input` -
223 :option:`--y4m`). This option is implied if the input filename has
228 .. option:: --input-depth <integer>
230 YUV only: Bit-depth of input file or stream
232 **Values:** any value between 8 and 16. Default is internal depth.
238 Enable high quality downscaling. Dithering is based on the diffusion
239 of errors from one row of pixels to the next row of pixels in a
240 picture. Only applicable when the input bit depth is larger than
241 8bits and internal bit depth is 8bits. Default disabled
245 .. option:: --nr <integer>
247 Noise reduction - an adaptive deadzone applied after DCT
248 (subtracting from DCT coefficients), before quantization, on inter
249 blocks. It does no pixel-level filtering, doesn't cross DCT block
250 boundaries, has no overlap, doesn't affect intra blocks. The higher
251 the strength value parameter, the more aggressively it will reduce
254 Enabling noise reduction will make outputs diverge between different
255 numbers of frame threads. Outputs will be deterministic but the
256 outputs of -F2 will no longer match the outputs of -F3, etc.
258 **Values:** any value in range of 100 to 1000. Default disabled.
260 .. option:: --input-res <wxh>
262 YUV only: Source picture size [w x h]
266 .. option:: --input-csp <integer|string>
268 YUV only: Source color space. Only i420, i422, and i444 are
269 supported at this time. The internal color space is always the
270 same as the source color space (libx265 does not support any color
274 1. i420 **(default)**
280 .. option:: --fps <integer|float|numerator/denominator>
282 YUV only: Source frame rate
284 **Range of values:** positive int or float, or num/denom
286 .. option:: --interlaceMode <false|tff|bff>, --no-interlaceMode
288 **EXPERIMENTAL** Specify interlace type of source pictures.
290 0. progressive pictures **(default)**
292 2. bottom field first
294 HEVC encodes interlaced content as fields. Fields must be provided to
295 the encoder in the correct temporal order. The source dimensions
296 must be field dimensions and the FPS must be in units of fields per
297 second. The decoder must re-combine the fields in their correct
298 orientation for display.
300 .. option:: --seek <integer>
302 Number of frames to skip at start of input file. Default 0
306 .. option:: --frames, -f <integer>
308 Number of frames to be encoded. Default 0 (all)
312 .. option:: --qpfile <filename>
314 Specify a text file which contains frametypes and QPs for some or
315 all frames. The format of each line is:
317 framenumber frametype QP
319 Frametype can be one of [I,i,P,B,b]. **B** is a referenced B frame,
320 **b** is an unreferenced B frame. **I** is a keyframe (random
321 access point) while **i** is a I frame that is not a keyframe
322 (references are not broken).
324 Specifying QP (integer) is optional, and if specified they are
325 clamped within the encoder to qpmin/qpmax.
327 .. option:: --scaling-list <filename>
329 Quantization scaling lists. HEVC supports 6 quantization scaling
330 lists to be defined; one each for Y, Cb, Cr for intra prediction and
331 one each for inter prediction.
333 x265 does not use scaling lists by default, but this can also be
334 made explicit by :option:`--scaling-list` *off*.
336 HEVC specifies a default set of scaling lists which may be enabled
337 without requiring them to be signaled in the SPS. Those scaling
338 lists can be enabled via :option:`--scaling-list` *default*.
340 All other strings indicate a filename containing custom scaling
341 lists in the HM format. The encode will abort if the file is not
342 parsed correctly. Custom lists must be signaled in the SPS
344 .. option:: --lambda-file <filename>
346 Specify a text file containing values for x265_lambda_tab and
347 x265_lambda2_tab. Each table requires MAX_MAX_QP+1 (70) float
350 The text file syntax is simple. Comma is considered to be
351 white-space. All white-space is ignored. Lines must be less than 2k
352 bytes in length. Content following hash (#) characters are ignored.
353 The values read from the file are logged at :option:`--log-level`
356 Note that the lambda tables are process-global and so the new values
357 affect all encoders running in the same process.
359 Lambda values affect encoder mode decisions, the lower the lambda
360 the more bits it will try to spend on signaling information (motion
361 vectors and splits) and less on residual. This feature is intended
367 .. option:: --profile <string>
369 Enforce the requirements of the specified profile, ensuring the
370 output stream will be decodable by a decoder which supports that
371 profile. May abort the encode if the specified profile is
372 impossible to be supported by the compile options chosen for the
373 encoder (a high bit depth encoder will be unable to output
374 bitstreams compliant with Main or Mainstillpicture).
376 API users must use x265_param_apply_profile() after configuring
377 their param structure. Any changes made to the param structure after
378 this call might make the encode non-compliant.
380 **Values:** main, main10, mainstillpicture, main422-8, main422-10, main444-8, main444-10
384 .. option:: --level-idc <integer|float>
386 Minimum decoder requirement level. Defaults to 0, which implies
387 auto-detection by the encoder. If specified, the encoder will
388 attempt to bring the encode specifications within that specified
389 level. If the encoder is unable to reach the level it issues a
390 warning and aborts the encode. If the requested requirement level is
391 higher than the actual level, the actual requirement level is
394 Beware, specifying a decoder level will force the encoder to enable
395 VBV for constant rate factor encodes, which may introduce
398 The value is specified as a float or as an integer with the level
399 times 10, for example level **5.1** is specified as "5.1" or "51",
400 and level **5.0** is specified as "5.0" or "50".
402 Annex A levels: 1, 2, 2.1, 3, 3.1, 4, 4.1, 5, 5.1, 5.2, 6, 6.1, 6.2
404 .. option:: --high-tier, --no-high-tier
406 If :option:`--level-idc` has been specified, the option adds the
407 intention to support the High tier of that level. If your specified
408 level does not support a High tier, a warning is issued and this
409 modifier flag is ignored.
412 :option:`--profile`, :option:`--level-idc`, and
413 :option:`--high-tier` are only intended for use when you are
414 targeting a particular decoder (or decoders) with fixed resource
415 limitations and must constrain the bitstream within those limits.
416 Specifying a profile or level may lower the encode quality
417 parameters to meet those requirements but it will never raise
423 .. option:: --wpp, --no-wpp
425 Enable Wavefront Parallel Processing. The encoder may begin encoding
426 a row as soon as the row above it is at least two CTUs ahead in the
427 encode process. This gives a 3-5x gain in parallelism for about 1%
428 overhead in compression efficiency. Default: Enabled
430 .. option:: --ctu, -s <64|32|16>
432 Maximum CU size (width and height). The larger the maximum CU size,
433 the more efficiently x265 can encode flat areas of the picture,
434 giving large reductions in bitrate. However this comes at a loss of
435 parallelism with fewer rows of CUs that can be encoded in parallel,
436 and less frame parallelism as well. Because of this the faster
437 presets use a CU size of 32. Default: 64
439 .. option:: --tu-intra-depth <1..4>
441 The transform unit (residual) quad-tree begins with the same depth
442 as the coding unit quad-tree, but the encoder may decide to further
443 split the transform unit tree if it improves compression efficiency.
444 This setting limits the number of extra recursion depth which can be
445 attempted for intra coded units. Default: 1, which means the
446 residual quad-tree is always at the same depth as the coded unit
449 Note that when the CU intra prediction is NxN (only possible with
450 8x8 CUs), a TU split is implied, and thus the residual quad-tree
451 begins at 4x4 and cannot split any futhrer.
453 .. option:: --tu-inter-depth <1..4>
455 The transform unit (residual) quad-tree begins with the same depth
456 as the coding unit quad-tree, but the encoder may decide to further
457 split the transform unit tree if it improves compression efficiency.
458 This setting limits the number of extra recursion depth which can be
459 attempted for inter coded units. Default: 1. which means the
460 residual quad-tree is always at the same depth as the coded unit
461 quad-tree unless the CU was coded with rectangular or AMP
462 partitions, in which case a TU split is implied and thus the
463 residual quad-tree begins one layer below the CU quad-tree.
465 Temporal / motion search options
466 ================================
468 .. option:: --me <integer|string>
470 Motion search method. Generally, the higher the number the harder
471 the ME method will try to find an optimal match. Diamond search is
472 the simplest. Hexagon search is a little better. Uneven
473 Multi-Hexegon is an adaption of the search method used by x264 for
474 slower presets. Star is a three step search adapted from the HM
475 encoder: a star-pattern search followed by an optional radix scan
476 followed by an optional star-search refinement. Full is an
477 exhaustive search; an order of magnitude slower than all other
478 searches but not much better than umh or star.
486 .. option:: --subme, -m <0..7>
488 Amount of subpel refinement to perform. The higher the number the
489 more subpel iterations and steps are performed. Default 2
491 +----+------------+-----------+------------+-----------+-----------+
492 | -m | HPEL iters | HPEL dirs | QPEL iters | QPEL dirs | HPEL SATD |
493 +====+============+===========+============+===========+===========+
494 | 0 | 1 | 4 | 0 | 4 | false |
495 +----+------------+-----------+------------+-----------+-----------+
496 | 1 | 1 | 4 | 1 | 4 | false |
497 +----+------------+-----------+------------+-----------+-----------+
498 | 2 | 1 | 4 | 1 | 4 | true |
499 +----+------------+-----------+------------+-----------+-----------+
500 | 3 | 2 | 4 | 1 | 4 | true |
501 +----+------------+-----------+------------+-----------+-----------+
502 | 4 | 2 | 4 | 2 | 4 | true |
503 +----+------------+-----------+------------+-----------+-----------+
504 | 5 | 1 | 8 | 1 | 8 | true |
505 +----+------------+-----------+------------+-----------+-----------+
506 | 6 | 2 | 8 | 1 | 8 | true |
507 +----+------------+-----------+------------+-----------+-----------+
508 | 7 | 2 | 8 | 2 | 8 | true |
509 +----+------------+-----------+------------+-----------+-----------+
511 .. option:: --merange <integer>
513 Motion search range. Default 57
515 The default is derived from the default CTU size (64) minus the luma
516 interpolation half-length (4) minus maximum subpel distance (2)
517 minus one extra pixel just in case the hex search method is used. If
518 the search range were any larger than this, another CTU row of
519 latency would be required for reference frames.
521 **Range of values:** an integer from 0 to 32768
523 .. option:: --max-merge <1..5>
525 Maximum number of neighbor (spatial and temporal) candidate blocks
526 that the encoder may consider for merging motion predictions. If a
527 merge candidate results in no residual, it is immediately selected
528 as a "skip". Otherwise the merge candidates are tested as part of
529 motion estimation when searching for the least cost inter option.
530 The max candidate number is encoded in the SPS and determines the
531 bit cost of signaling merge CUs. Default 2
533 .. option:: --temporal-mvp, --no-temporal-mvp
535 Enable temporal motion vector predictors in P and B slices.
536 This enables the use of the motion vector from the collocated block
537 in the previous frame to be used as a predictor. Default is enabled
539 Spatial/intra options
540 =====================
542 .. option:: --rdpenalty <0..2>
544 When set to 1, transform units of size 32x32 are given a 4x bit cost
545 penalty compared to smaller transform units, in intra coded CUs in P
548 When set to 2, transform units of size 32x32 are not even attempted,
549 unless otherwise required by the maximum recursion depth. For this
550 option to be effective with 32x32 intra CUs,
551 :option:`--tu-intra-depth` must be at least 2. For it to be
552 effective with 64x64 intra CUs, :option:`--tu-intra-depth` must be
555 Note that in HEVC an intra transform unit (a block of the residual
556 quad-tree) is also a prediction unit, meaning that the intra
557 prediction signal is generated for each TU block, the residual
558 subtracted and then coded. The coding unit simply provides the
559 prediction modes that will be used when predicting all of the
560 transform units within the CU. This means that when you prevent
561 32x32 intra transform units, you are preventing 32x32 intra
566 **Values:** 0:disabled 1:4x cost penalty 2:force splits
568 .. option:: --b-intra, --no-b-intra
570 Enables the evaluation of intra modes in B slices. Default disabled.
572 .. option:: --tskip, --no-tskip
574 Enable evaluation of transform skip (bypass DCT but still use
575 quantization) coding for 4x4 TU coded blocks.
577 Only effective at RD levels 3 and above, which perform RDO mode
578 decisions. Default disabled
580 .. option:: --tskip-fast, --no-tskip-fast
582 Only evaluate transform skip for NxN intra predictions (4x4 blocks).
583 Only applicable if transform skip is enabled. For chroma, only
584 evaluate if luma used tskip. Inter block tskip analysis is
585 unmodified. Default disabled
587 .. option:: --strong-intra-smoothing, --no-strong-intra-smoothing
589 Enable strong intra smoothing for 32x32 intra blocks. Default enabled
591 .. option:: --constrained-intra, --no-constrained-intra
593 Constrained intra prediction. When generating intra predictions for
594 blocks in inter slices, only intra-coded reference pixels are used.
595 Inter-coded reference pixels are replaced with intra-coded neighbor
596 pixels or default values. The general idea is to block the
597 propagation of reference errors that may have resulted from lossy
598 signals. Default disabled
600 Mode decision / Analysis
601 ========================
603 .. option:: --rect, --no-rect
605 Enable analysis of rectangular motion partitions Nx2N and 2NxN
606 (50/50 splits, two directions). Default disabled
608 .. option:: --amp, --no-amp
610 Enable analysis of asymmetric motion partitions (75/25 splits, four
611 directions). At RD levels 0 through 4, AMP partitions are only
612 considered at CU sizes 32x32 and below. At RD levels 5 and 6, it
613 will only consider AMP partitions as merge candidates (no motion
614 search) at 64x64, and as merge or inter candidates below 64x64.
616 The AMP partitions which are searched are derived from the current
617 best inter partition. If Nx2N (vertical rectangular) is the best
618 current prediction, then left and right asymmetrical splits will be
619 evaluated. If 2NxN (horizontal rectangular) is the best current
620 prediction, then top and bottom asymmetrical splits will be
621 evaluated, If 2Nx2N is the best prediction, and the block is not a
622 merge/skip, then all four AMP partitions are evaluated.
624 This setting has no effect if rectangular partitions are disabled.
627 .. option:: --early-skip, --no-early-skip
629 Measure full CU size (2Nx2N) merge candidates first; if no residual
630 is found the analysis is short circuited. Default disabled
632 .. option:: --fast-cbf, --no-fast-cbf
634 Short circuit analysis if a prediction is found that does not set
635 the coded block flag (aka: no residual was encoded). It prevents
636 the encoder from perhaps finding other predictions that also have no
637 residual but require less signaling bits or have less distortion.
638 Only applicable for RD levels 5 and 6. Default disabled
640 .. option:: --fast-intra, --no-fast-intra
642 Perform an initial scan of every fifth intra angular mode, then
643 check modes +/- 2 distance from the best mode, then +/- 1 distance
644 from the best mode, effectively performing a gradient descent. When
645 enabled 10 modes in total are checked. When disabled all 33 angular
646 modes are checked. Only applicable for :option:`--rd` levels 3 and
647 below (medium preset and faster).
649 .. option:: --weightp, -w, --no-weightp
651 Enable weighted prediction in P slices. This enables weighting
652 analysis in the lookahead, which influences slice decisions, and
653 enables weighting analysis in the main encoder which allows P
654 reference samples to have a weight function applied to them prior to
655 using them for motion compensation. In video which has lighting
656 changes, it can give a large improvement in compression efficiency.
659 .. option:: --weightb, --no-weightb
661 Enable weighted prediction in B slices. Default disabled
663 .. option:: --rd <0..6>
665 Level of RDO in mode decision. The higher the value, the more
666 exhaustive the analysis and the more rate distortion optimization is
667 used. The lower the value the faster the encode, the higher the
668 value the smaller the bitstream (in general). Default 3
670 Note that this table aims for accuracy, but is not necessarily our
671 final target behavior for each mode.
673 +-------+---------------------------------------------------------------+
674 | Level | Description |
675 +=======+===============================================================+
676 | 0 | sa8d mode and split decisions, intra w/ source pixels |
677 +-------+---------------------------------------------------------------+
678 | 1 | recon generated (better intra), RDO merge/skip selection |
679 +-------+---------------------------------------------------------------+
680 | 2 | RDO splits and merge/skip selection |
681 +-------+---------------------------------------------------------------+
682 | 3 | RDO mode and split decisions |
683 +-------+---------------------------------------------------------------+
684 | 4 | Adds RDO Quant |
685 +-------+---------------------------------------------------------------+
686 | 5 | Adds RDO prediction decisions |
687 +-------+---------------------------------------------------------------+
688 | 6 | Currently same as 5 |
689 +-------+---------------------------------------------------------------+
691 **Range of values:** 0: least .. 6: full RDO analysis
693 .. option:: --cu-lossless, --no-cu-lossless
695 For each CU, evaluate lossless (transform and quant bypass) encode
696 of the best non-lossless mode option as a potential rate distortion
697 optimization. If the global option :option:`--lossless` has been
698 specified, all CUs will be encoded as lossless unconditionally
699 regardless of whether this option was enabled. Default disabled.
701 Only effective at RD levels 3 and above, which perform RDO mode
704 .. option:: --signhide, --no-signhide
706 Hide sign bit of one coeff per TU (rdo). The last sign is implied.
707 This requires analyzing all the coefficients to determine if a sign
708 must be toggled, and then to determine which one can be toggled with
709 the least amount of distortion. Default enabled
711 Psycho-visual options
712 =====================
714 Left to its own devices, the encoder will make mode decisions based on a
715 simple rate distortion formula, trading distortion for bitrate. This is
716 generally effective except for the manner in which this distortion is
717 measured. It tends to favor blurred reconstructed blocks over blocks
718 which have wrong motion. The human eye generally prefers the wrong
719 motion over the blur and thus x265 offers psycho-visual adjustments to
720 the rate distortion algorithm.
722 :option:`--psy-rd` will add an extra cost to reconstructed blocks which
723 do not match the visual energy of the source block. The higher the
724 strength of :option:`--psy-rd` the more strongly it will favor similar
725 energy over blur and the more aggressively it will ignore rate
726 distortion. If it is too high, it will introduce visal artifacts and
727 increase bitrate enough for rate control to increase quantization
728 globally, reducing overall quality. psy-rd will tend to reduce the use
729 of blurred prediction modes, like DC and planar intra and bi-directional
732 :option:`--psy-rdoq` will adjust the distortion cost used in
733 rate-distortion optimized quantization (RDO quant), enabled in
734 :option:`--rd` 4 and above, favoring the preservation of energy in the
735 reconstructed image. :option:`--psy-rdoq` prevents RDOQ from blurring
736 all of the encoding options which psy-rd has to chose from. At low
737 strength levels, psy-rdoq will influence the quantization level
738 decisions, favoring higher AC energy in the reconstructed image. As
739 psy-rdoq strength is increased, more non-zero coefficient levels are
740 added and fewer coefficients are zeroed by RDOQ's rate distortion
741 analysis. High levels of psy-rdoq can double the bitrate which can have
742 a drastic effect on rate control, forcing higher overall QP, and can
743 cause ringing artifacts. psy-rdoq is less accurate than psy-rd, it is
744 biasing towards energy in general while psy-rd biases towards the energy
745 of the source image. But very large psy-rdoq values can sometimes be
746 beneficial, preserving film grain for instance.
748 As a general rule, when both psycho-visual features are disabled, the
749 encoder will tend to blur blocks in areas of difficult motion. Turning
750 on small amounts of psy-rd and psy-rdoq will improve the perceived
751 visual quality. Increasing psycho-visual strength further will improve
752 quality and begin introducing artifacts and increase bitrate, which may
753 force rate control to increase global QP. Finding the optimal
754 psycho-visual parameters for a given video requires experimentation. Our
755 recommended defaults (1.0 for both) are generally on the low end of the
756 spectrum. And generally the lower the bitrate, the lower the optimal
757 psycho-visual settings.
759 .. option:: --psy-rd <float>
761 Influence rate distortion optimizated mode decision to preserve the
762 energy of the source image in the encoded image at the expense of
763 compression efficiency. It only has effect on presets which use
764 RDO-based mode decisions (:option:`--rd` 3 and above). 1.0 is a
765 typical value. Default disabled. Experimental
767 **Range of values:** 0 .. 2.0
769 .. option:: --psy-rdoq <float>
771 Influence rate distortion optimized quantization by favoring higher
772 energy in the reconstructed image. This generally improves perceived
773 visual quality at the cost of lower quality metric scores. It only
774 has effect on slower presets which use RDO Quantization
775 (:option:`--rd` 4, 5 and 6). 1.0 is a typical value. Default
776 disabled. High values can be beneficial in preserving high-frequency
777 detail like film grain. Experimental
779 **Range of values:** 0 .. 50.0
782 Slice decision options
783 ======================
785 .. option:: --open-gop, --no-open-gop
787 Enable open GOP, allow I-slices to be non-IDR. Default enabled
789 .. option:: --keyint, -I <integer>
791 Max intra period in frames. A special case of infinite-gop (single
792 keyframe at the beginning of the stream) can be triggered with
793 argument -1. Use 1 to force all-intra. Default 250
795 .. option:: --min-keyint, -i <integer>
797 Minimum GOP size. Scenecuts closer together than this are coded as I
798 or P, not IDR. Minimum keyint is clamped to be at least half of
799 :option:`--keyint`. If you wish to force regular keyframe intervals
800 and disable adaptive I frame placement, you must use
801 :option:`--no-scenecut`.
803 **Range of values:** >=0 (0: auto)
805 .. option:: --scenecut <integer>, --no-scenecut
807 How aggressively I-frames need to be inserted. The higher the
808 threshold value, the more aggressive the I-frame placement.
809 :option:`--scenecut` 0 or :option:`--no-scenecut` disables adaptive
810 I frame placement. Default 40
812 .. option:: --rc-lookahead <integer>
814 Number of frames for slice-type decision lookahead (a key
815 determining factor for encoder latency). The longer the lookahead
816 buffer the more accurate scenecut decisions will be, and the more
817 effective cuTree will be at improving adaptive quant. Having a
818 lookahead larger than the max keyframe interval is not helpful.
821 **Range of values:** Between the maximum consecutive bframe count (:option:`--bframes`) and 250
823 .. option:: --b-adapt <integer>
825 Adaptive B frame scheduling. Default 2
827 **Values:** 0:none; 1:fast; 2:full(trellis)
829 .. option:: --bframes, -b <0..16>
831 Maximum number of consecutive b-frames. Use :option:`--bframes` 0 to
832 force all P/I low-latency encodes. Default 4. This parameter has a
833 quadratic effect on the amount of memory allocated and the amount of
834 work performed by the full trellis version of :option:`--b-adapt`
837 .. option:: --bframe-bias <integer>
839 Bias towards B frames in slicetype decision. The higher the bias the
840 more likely x265 is to use B frames. Can be any value between -90
841 and 100 and is clipped to that range. Default 0
843 .. option:: --b-pyramid, --no-b-pyramid
845 Use B-frames as references, when possible. Default enabled
847 .. option:: --ref <1..16>
849 Max number of L0 references to be allowed. This number has a linear
850 multiplier effect on the amount of work performed in motion search,
851 but will generally have a beneficial affect on compression and
852 distortion. Default 3
854 Quality, rate control and rate distortion options
855 =================================================
857 .. option:: --bitrate <integer>
859 Enables single-pass ABR rate control. Specify the target bitrate in
860 kbps. Default is 0 (CRF)
862 **Range of values:** An integer greater than 0
864 .. option:: --crf <0..51.0>
866 Quality-controlled variable bitrate. CRF is the default rate control
867 method; it does not try to reach any particular bitrate target,
868 instead it tries to achieve a given uniform quality and the size of
869 the bitstream is determined by the complexity of the source video.
870 The higher the rate factor the higher the quantization and the lower
871 the quality. Default rate factor is 28.0.
873 .. option:: --crf-max <0..51.0>
875 Specify an upper limit to the rate factor which may be assigned to
876 any given frame (ensuring a max QP). This is dangerous when CRF is
877 used in combination with VBV as it may result in buffer underruns.
880 .. option:: --crf-min <0..51.0>
882 Specify an lower limit to the rate factor which may be assigned to
883 any given frame (ensuring a min QP). This is dangerous when CRF is
884 used in combination with VBV as it may result in buffer underruns.
887 .. option:: --vbv-bufsize <integer>
889 Specify the size of the VBV buffer (kbits). Enables VBV in ABR
890 mode. In CRF mode, :option:`--vbv-maxrate` must also be specified.
891 Default 0 (vbv disabled)
893 .. option:: --vbv-maxrate <integer>
895 Maximum local bitrate (kbits/sec). Will be used only if vbv-bufsize
896 is also non-zero. Both vbv-bufsize and vbv-maxrate are required to
897 enable VBV in CRF mode. Default 0 (disabled)
899 .. option:: --vbv-init <float>
901 Initial buffer occupancy. The portion of the decode buffer which
902 must be full before the decoder will begin decoding. Determines
903 absolute maximum frame size. May be specified as a fractional value
904 between 0 and 1, or in kbits. In other words these two option pairs
907 :option:`--vbv-bufsize` 1000 :option:`--vbv-init` 900
908 :option:`--vbv-bufsize` 1000 :option:`--vbv-init` 0.9
912 **Range of values:** fractional: 0 - 1.0, or kbits: 2 .. bufsize
914 .. option:: --qp, -q <integer>
916 Specify base quantization parameter for Constant QP rate control.
917 Using this option enables Constant QP rate control. The specified QP
918 is assigned to P slices. I and B slices are given QPs relative to P
919 slices using param->rc.ipFactor and param->rc.pbFactor unless QP 0
920 is specified, in which case QP 0 is used for all slice types. Note
921 that QP 0 does not cause lossless encoding, it only disables
922 quantization. Default disabled (CRF)
924 **Range of values:** an integer from 0 to 51
926 .. option:: --ipratio <float>
928 QP ratio factor between I and P slices. This ratio is used in all of
929 the rate control modes. Some :option:`--tune` options may change the
930 default value. It is not typically manually specified. Default 1.4
932 .. option:: --pbratio <float>
934 QP ratio factor between P and B slices. This ratio is used in all of
935 the rate control modes. Some :option:`--tune` options may change the
936 default value. It is not typically manually specified. Default 1.3
938 .. option:: --lossless, --no-lossless
940 Enables true lossless coding by bypassing scaling, transform,
941 quantization and in-loop filter processes. This is used for
942 ultra-high bitrates with zero loss of quality. Reconstructed output
943 pictures are bit-exact to the input pictures. Lossless encodes
944 implicitly have no rate control, all rate control options are
945 ignored. Slower presets will generally achieve better compression
946 efficiency (and generate smaller bitstreams). Default disabled.
948 .. option:: --aq-mode <0|1|2>
950 Adaptive Quantization operating mode. Raise or lower per-block
951 quantization based on complexity analysis of the source image. The
952 more complex the block, the more quantization is used. This offsets
953 the tendency of the encoder to spend too many bits on complex areas
954 and not enough in flat areas.
958 2. AQ enabled with auto-variance **(default)**
960 .. option:: --aq-strength <float>
962 Adjust the strength of the adaptive quantization offsets. Setting
963 :option:`--aq-strength` to 0 disables AQ. Default 1.0.
965 **Range of values:** 0.0 to 3.0
967 .. option:: --cutree, --no-cutree
969 Enable the use of lookahead's lowres motion vector fields to
970 determine the amount of reuse of each block to tune adaptive
971 quantization factors. CU blocks which are heavily reused as motion
972 reference for later frames are given a lower QP (more bits) while CU
973 blocks which are quickly changed and are not referenced are given
974 less bits. This tends to improve detail in the backgrounds of video
975 with less detail in areas of high motion. Default enabled
977 .. option:: --cbqpoffs <integer>
979 Offset of Cb chroma QP from the luma QP selected by rate control.
980 This is a general way to spend more or less bits on the chroma
983 **Range of values:** -12 to 12
985 .. option:: --crqpoffs <integer>
987 Offset of Cr chroma QP from the luma QP selected by rate control.
988 This is a general way to spend more or less bits on the chroma
991 **Range of values:** -12 to 12
993 .. option:: --pass <integer>
995 Enable multipass rate control mode. Input is encoded multiple times,
996 storing the encoded information of each pass in a stats file from which
997 the consecutive pass tunes the qp of each frame to improve the quality
998 of the output. Default disabled
1000 1. First pass, creates stats file
1001 2. Last pass, does not overwrite stats file
1002 3. Nth pass, overwrites stats file
1004 **Range of values:** 1 to 3
1006 .. option:: --slow-firstpass, --no-slow-firstpass
1008 Enable a slow and more detailed first pass encode in Multipass rate
1009 control mode. Speed of the first pass encode is slightly lesser and
1010 quality midly improved when compared to the default settings in a
1011 multipass encode. Default disabled (turbo mode enabled)
1013 When **turbo** first pass is not disabled, these options are
1014 set on the first pass to improve performance:
1016 * :option:`--fast-intra`
1017 * :option:`--no-rect`
1018 * :option:`--no-amp`
1019 * :option:`--early-skip`
1020 * :option:`--ref` = 1
1021 * :option:`--max-merge` = 1
1022 * :option:`--me` = DIA
1023 * :option:`--subme` = MIN(2, :option:`--subme`)
1024 * :option:`--rd` = MIN(2, :option:`--rd`)
1026 .. option:: --analysis-mode <string|int>
1028 Specify whether analysis information of each frame is output by encoder
1029 or input for reuse. By reading the analysis data writen by an
1030 earlier encode of the same sequence, substantial redundant work may
1033 The following data may be stored and reused:
1034 I frames - split decisions and luma intra directions of all CUs.
1035 P/B frames - motion vectors are dumped at each depth for all CUs.
1037 **Values:** off(0), save(1): dump analysis data, load(2): read analysis data
1039 .. option:: --analysis-file <filename>
1041 Specify a filename for analysis data (see :option:`--analysis-mode`)
1042 If no filename is specified, x265_analysis.dat is used.
1047 .. option:: --lft, --no-lft
1049 Toggle deblocking loop filter, default enabled
1051 .. option:: --sao, --no-sao
1053 Toggle Sample Adaptive Offset loop filter, default enabled
1055 .. option:: --sao-non-deblock, --no-sao-non-deblock
1057 Specify how to handle depencency between SAO and deblocking filter.
1058 When enabled, non-deblocked pixels are used for SAO analysis. When
1059 disabled, SAO analysis skips the right/bottom boundary areas.
1062 VUI (Video Usability Information) options
1063 =========================================
1065 x265 emits a VUI with only the timing info by default. If the SAR is
1066 specified (or read from a Y4M header) it is also included. All other
1067 VUI fields must be manually specified.
1069 .. option:: --sar <integer|w:h>
1071 Sample Aspect Ratio, the ratio of width to height of an individual
1072 sample (pixel). The user may supply the width and height explicitly
1073 or specify an integer from the predefined list of aspect ratios
1074 defined in the HEVC specification. Default undefined (not signaled)
1093 .. option:: --crop-rect <left,top,right,bottom>
1095 Define the (overscan) region of the image that does not contain
1096 information because it was added to achieve certain resolution or
1097 aspect ratio. The decoder may be directed to crop away this region
1098 before displaying the images via the :option:`--overscan` option.
1099 Default undefined (not signaled)
1101 .. option:: --overscan <show|crop>
1103 Specify whether it is appropriate for the decoder to display or crop
1104 the overscan area. Default unspecified (not signaled)
1106 .. option:: --videoformat <integer|string>
1108 Specify the source format of the original analog video prior to
1109 digitizing and encoding. Default undefined (not signaled)
1118 .. option:: --range <full|limited>
1120 Specify output range of black level and range of luma and chroma
1121 signals. Default undefined (not signaled)
1123 .. option:: --colorprim <integer|string>
1125 Specify color primitive to use when converting to RGB. Default
1126 undefined (not signaled)
1138 .. option:: --transfer <integer|string>
1140 Specify transfer characteristics. Default undefined (not signaled)
1158 .. option:: --colormatrix <integer|string>
1160 Specify color matrix setting i.e set the matrix coefficients used in
1161 deriving the luma and chroma. Default undefined (not signaled)
1175 .. option:: --chromalocs <0..5>
1177 Specify chroma sample location for 4:2:0 inputs. Consult the HEVC
1178 specification for a description of these values. Default undefined
1184 .. option:: --repeat-headers, --no-repeat-headers
1186 If enabled, x265 will emit VPS, SPS, and PPS headers with every
1187 keyframe. This is intended for use when you do not have a container
1188 to keep the stream headers for you and you want keyframes to be
1189 random access points. Default disabled
1191 .. option:: --info, --no-info
1193 Emit an informational SEI with the stream headers which describes
1194 the encoder version, build info, and encode parameters. This is very
1195 helpful for debugging purposes but encoding version numbers and
1196 build info could make your bitstreams diverge and interfere with
1197 regression testing. Default enabled
1199 .. option:: --hrd, --no-hrd
1201 Enable the signalling of HRD parameters to the decoder. The HRD
1202 parameters are carried by the Buffering Period SEI messages and
1203 Picture Timing SEI messages providing timing information to the
1204 decoder. Default disabled
1206 .. option:: --aud, --no-aud
1208 Emit an access unit delimiter NAL at the start of each slice access
1209 unit. If option:`--repeat-headers` is not enabled (indicating the
1210 user will be writing headers manually at the start of the stream)
1211 the very first AUD will be skipped since it cannot be placed at the
1212 start of the access unit, where it belongs. Default disabled
1214 .. option:: --hash <integer>
1216 Emit decoded picture hash SEI, so the decoder may validate the
1217 reconstructed pictures and detect data loss. Also useful as a
1218 debug feature to validate the encoder state. Default None
1227 .. option:: --recon, -r <filename>
1229 Output file containing reconstructed images in display order. If the
1230 file extension is ".y4m" the file will contain a YUV4MPEG2 stream
1231 header and frame headers. Otherwise it will be a raw YUV file in the
1232 encoder's internal bit depth.
1236 .. option:: --recon-depth <integer>
1238 Bit-depth of output file. This value defaults to the internal bit
1239 depth and currently cannot to be modified.