Sie sind auf Seite 1von 1

x264 Settings

Last update: 01 September 2012


..::MAIN::..
Encoding Mode
This is the method by which x264 attempts to allocate bits to frames over time. There are multiple methods that x264 can use.
Values: ABR (--bitrate value), Constant Quantizer (--qp value), 2 (or 3) pass (--pass value --bitrate value), Constant Quality (--crf value)
Recommendation: 2-pass or CRF ***Note: These are the only two methods that gain AHD Gold status.
Additional Notes:
*When bitrate is specified, output filesize is known but quality is not. When quality is specified, quality is know, but output filesize is not.
ABR or Average BitRate: A single-pass method that is based on bitrate, rather than quality. This method is NEVER RECOMMENDED, unless you MUST have both speed and predicted file
size. This is because since x264 only performs one pass (and is bitrate contrained), it has no way of knowing what else is contained in the video, and thus, cannot allocate bits efficiently
over the duration of the video, only over the frame.
Constant Quantizer or QP Mode: A single-pass method that is based on quanitizer, a measure for the amount of data loss (the higher the value, the more data lost). The H.264 quantizer scale
has a range of 0 to 52. The default value is 26. Setting --qp 0 will enable x264 to encode "losslessly", meaning no degradation in quality. It is advised to only use this mode when absolutely
required.
2-pass (and similarly, 3-pass): 3-pass is pointless, do not use it. On the first pass of the encode, x264 scans over the entire video so that it knows what to expect and determines what CRF
value will achieve the desired bitrate. The second pass is CRF at the determined value. **Note: This was not always true - in the early days of x264, 2-pass and CRF had different
bit-distribution algorithms.**
Constant Quality / Constant Ratefactor or CRF: CRF will run a single pass over the duration of the video. It aims to have an average quanitizer value, rather than constant. This proves to be
much more efficient than QP Mode. Unlike QP Mode, AQ (Adaptive Quantizer) is enabled.
CRF and 2 pass use the same algorithms, but it has been shown in our forums that they do produce identical results at the same bitrates. (links missing atm)
For HD encodes, you should always be using High@L4.1
..::FRAME-TYPE::..
..::H.264 FEATURES::..
Deblocking | --no-deblock (to disable)
What is it? - Controls the loop filter of H.264.
How it behaves: see Deblocking Strength and Treshold
Values: enabled or disabled
Default: enabled
Recommendation: enabled
Additional Notes: Improves compressibility, so no reason to disable. For more, see http://forum.doom9.org/showthread.php?t=109747
Deblocking Strength and Treshold | --deblock alpha (strength) value:beta (threshold strength) value
What is it? - The way the deblocking filter behaves, separated into alpha and beta deblocking, or strength and threshold, respectively.
How it behaves: Strength: Alpha deblocking controls how much the deblocking will smooth the video, and will affect sharpness. Negative values result in a sharper video, but increases possible
artifacts while positive values result in smoother video but removes more details.Treshold: Beta deblocking controls the treshold for block detection, negative values will "save" more detail, but
may miss some blocks, and the opposite applies for positive values.
Values: From -6 to 6
Default: 0:0
Recommendation: -3:-3 for live action, positive values from 0 to 3 for animation With newer, modern x264 builds, there are new recommendations for deblock values. For generally "clean"
sources, meaning little to no grain, the default deblock values of 0:0 will work properly. As level of grain increases, you may wish to decrease the values for deblock, down to -3:-3, or any
combination of values between -3 and 0. As always, use your own discretion to determine proper values for each source material. If you find higher or lower values give you a better result, use
them.
Additional Notes: For more, see http://forum.doom9.org/showthread.php?t=109747
..::GOP SIZE::..
Maximum GOP Size | --keyint value
What is it? - Sets the maximum interval between IDR-frames (aka keyframes) in x264's output. You can specify "infinite" to never insert non-scenecut IDR-frames.
How it behaves: It just does what it does.
Values: pretty much anything, 0=infinite
Default: 250
Recommendation: 250
Additional Notes: Note that I-frames are very large!
Minimum GOP Size | --min-keyint value
What is it? - Sets the minimum length between IDR-frames.
How it behaves: It just does what it does.
Values: The maximum allowed value for min-keyint is --keyint/2+1
Default: auto (MIN(--keyint / 10,--fps))
Recommendation: 23, 24, or 25
Additional Notes: n/a
If bitrate constrained, e.g. 2 pass, a small GOP will may reduce overall quality, but in constant quality, e.g. CRF, smaller GOP may increase overall quality. This is because a smaller GOP will may
cause more I frames to be used, which are the least compressed.
Open GOP | --open-gop (to enable)
What is it? - Open-GOP is an encoding technique which increases efficiency. Some decoders don't fully support open-GOP streams, which is why it hasn't been enabled by default.
How it behaves: http://forum.doom9.org/showthread.php?p=1300124#post1300124
Values: enabled or disabled
Default: disabled
Recommendation: disabled
Additional Notes: n/a
..::B-FRAMES::..
Weighted Prediction for B-Frame | --no-weightb (to disable)
What is it? - H.264 allows you to 'weight' references in B-frames, which allows you to change how much each reference affects the predicted picture.
How it behaves: This disables Weighted Prediction for B-Frames.
Values: enabled or disabled
Default: enabled
Recommendation: enabled
Additional Notes: Enabling this feature allows the encoder to produce more accurate B-Frames by weighting the reference frames in a none-symmetric way. This comes at the cost of some
encoding speed.
Number of B-frames | --bframes value
What is it? - Sets the max amount of b-frames that x264 can use. B-frames are very efficient as they only store information that has changed and can reference both the previous and following I/P
frames.
How it behaves: Allows the max to be what you set.
Values: 0 to 16
Default: 3
Recommendation: Check x264 stats file from test stages to decide value.
Additional Notes: You can set 16 as the max without any degredation in quality, but encoding speed will suffer greatly. You are only setting the max, x264 still decides how many to use. Setting to
0 disables b-frames, do not disable!
Adaptive B-frames | --b-adapt value
What is it? - This controls how x264 chooses the number of consecutive b-frames.
How it behaves: Regardless of setting, x264 will not violate the max consecutive b-frames limit that is set, but it can use less. Using 0-Disabled, adaptive b-frame decision is disabled. Using
1-Fast, x264 uses a fast and suboptimal algorithim. It will usually end with a low number of b-frames, regardless of the max amount allowed. Using 2-Optimal, a.k.a Trellis B-Frame decision (no
relation to trellis), x264 will find the optimal number of b-frames and fades are handled much better. Much slower than 1-Fast, and even slower when the max number of consecutive b-frames is
large.
Values: 0-Off, 1-Fast, 2-Optimal
Default: 1-Fast
Recommendation: 2-Optimal
Additional Notes: n/a
B-Pyramid | --b-pyramid value
What is it? - Allow the use of B-frames as references for other frames. Without this setting, frames can only reference I- or P-frames.
How it behaves: None/disabled: Don't use b-frames as references. Strict: Strictly hierarchical B-Pyramid. This mode is fully BluRay compatible. Normal/non-strict: Normal B-Pyramid mode. Gives
better results than the strict mode, but it's not BluRay compatible.
Values: none (disabled), strict, normal
Default: normal
Recommendation: normal
Additional Notes: Although I/P-frames are more valued as references because of their higher quality, B-frames can also be useful. B-frames designated as references will get a quantizer halfway
between P-frames and normal B-frames. You need to use at least two B-frames before B-pyramid will work. Requires High Profile.
..:: OTHER::..
Number of Reference Frames | --ref value
What is it? - H.264 allows multiple reference frames. This setting controls how many frames can be referenced by P and B frames.
How it behaves: Higher values tend to result in more efficient compression, however take more time to encode. Anime and cartoons can benefit greatly from more reference frames.
Values: 1 to 16
Default: 1
Recommendation: 4 if 1080p, 9 if 720p | can be more depending on total number of pixels while maintaining DXVA compliancy
Additional Notes: n/a
..::RATE CONTROL::..
..::QUANTIZERS::..
Min/Max/Delta (change/steps) of Quantizer | --qpmin value --qpmax value --qpstep value
What is it? - Specifies the minimum and maximum quanitzer allowed, and specifies how much the quantizer can change between two consecutive frames.
How it behaves: Minimum means every frame gets at least this amount of data loss. Maximum means no frame gets more than this amount of data loss. Delta ensures that the quanitizer
between two consecutive frames are not too different, as to prevent erractic change in visual quality.
Values: 0 to 51 (min), 1 to 69 (max), 1 to 51 (delta)
Default: 0/69/4
Recommendation: 10/51/4 OR default
Additional Notes: 51 is mentioned often as the max quantizer available in H.264, but x264 allows you to set it to 69 for some reason.
Quantizers Ratio (I:P / P:B) | --ipratio value --pbratio value
What is it? - Sets the factor/ratio between the quantizers for I, P, and B frames.
How it behaves: A factor of 1 means frames are all equally compressed, which is not optimal. A factor of 2 (for I:P ratio) would mean P frames are compressed twice as much as I frames, and
similar for P:B ratio.
Values: 1 to 10
Default: 1.4 and 1.3, respectively
Recommendation: 1.4 and 1.3, respectively
Additional Notes: High values of I:P ratio increase quality of I-frames. High values of P:B ratio decrease quality of B frames. P:B is not used with mbtree, which calculates the optimum value
automatically.
Deadzones (Inter / Intra) | --deadzone-inter value --deadzone-intra value
What is it? - Set the size of the inter/intra luma quantization deadzone.
How it behaves: The deadzone value sets the level of fine detail that x264 will arbitrarily drop without attempting to preserve.
Values: 0 to 100
Default: 21,11
Recommendation: default is forced if using trellis, 8,6 if trellis=0, but this is a value to play around with.
Additional Notes: Very fine detail is both hard to see and expensive to encode, dropping this detail without attempting to preserve it stops wasting bits on such a low-return section of the video.
Deadzones should be in the range of 0 to 32, but for AHD Gold status, deadzones must be lower than 10,10 unless trellis=2. For info on the incompatibility with trellis, see
http://forum.doom9.org/showthread.php?p=1031142#post1031142
Chroma QP Offset | --chroma-qp-offset value
What is it? - This setting controls how much stronger the color information (chroma) will be compressed compared to the brightness information (luma).
How it behaves: Positive values will cause chroma to have much stronger compression than luma.
Values: -12 to 12
Default: 0
Recommendation: 0
Additional Notes: Sometimes it makes sense to compress the color information stronger than the brightness information, as data loss in the color information is less visible to the human eye than
data loss in the brightness information. The specified offset will be added to the chroma quantizers. Note that both, Psy-RDO and Psy-Trellis, will lower the offset by one or by two, if enabled. So
you may end up with an offset of -4 by using Psy optimizations. Note that both, Psy-RDO and Psy-Trellis, will lower the offset by one or by two, if enabled. So you may end up with an offset of -4
by using Psy optimizations.
..::ADAPTIVE QUANTIZERS::..
AQ Mode | --aq-mode value
What is it? - AQ is used to better distribute the available bits between all macroblocks in the video.
How it behaves: 0 (disabled): Do not use AQ at all. 1 (variance): Allows AQ to redistribute bits across the whole video and within frames. 2 (auto-variance): Auto-variance AQ (experimental)
which attempts to adapt strength per-frame.
Values: 0 (disabled), 1 (variance), 2 (auto-variance)
Default: 1
Recommendation: 1 or 2, decide through testing
Additional Notes: Without AQ, x264 tends to underallocate bits to less-detailed sections. Although some say to disable AQ when encoding animation, it is more often better to simply set a low AQ
strength. See VAQ vs No AQ; http://i18.tinypic.com/82u8c9j.gif
AQ Strength | --aq-strength value
What is it? - Sets the strength of AQ bias towards low detail ('flat') macroblocks. Negative values are not allowed.
How it behaves: Higher values allocate more bits into "flat" macroblocks.
Values: 0 to 2.0
Default: 1.0
Recommendation: 0.8 to 1.2 for film, 0.5 to 0.7 for animation
Additional Notes: Values more than +/-100% from 1.0 are probably a bad idea.
..::RATE CONTROL::..
VBV Buffer Size | --vbv-bufsize value
What is it? - Specifies the buffer size of the device/player (in kilobit). This is the maximum amount of data that can be hold inside the buffer. Usually this is pre-defined by the individual
device/player you are encoding for.
How it behaves: n/a
Values: 0 to 100,000
Default: 0
Recommendation: 30,000 (to ensure playback on hardware devices
Additional Notes: http://avidemux.org/admWiki/doku.php?id=tutorial:h.264#advanced
http://mewiki.project357.com/wiki/X264_Encoding_Suggestions#VBV_Encoding
VBV Maximum Bitrate | --vbv-maxrate value
What is it? - Specifies the maximum bitrate (in kbit/s) at which data enters the buffer.
How it behaves: n/a
Values: 0 to 100,000
Default: 0
Recommendation: 38000
Additional Notes: This setting does not restrict the maximum (local) video bitrate. The (local) video bitrate is allowed to exceed the maximum VBV bitrate as long as there's enough data left in the
buffer.
Quantizer Compression | --qcomp value
What is it? - It controls how much the bitrate can fluctuate over the entire video.
How it behaves: Setting this to 0% would enforce a constant bitrate stream, while a value of 100% would result in a constant quantizer stream. When used with mbtree, it affects the strength of
mbtree. (Higher qcomp = weaker mbtree).
Values: 0.0 to 1.0
Default: 0.6
Recommendation: 0.6 to 0.8, determine with testing
Additional Notes: If enabled with CRF, --qcomp 1.0 would be essential --qp at the --crf value, but AQ is still enabled.
Number of Frames for Lookahead (rc_lookahead) | --rc-lookahead value
What is it? - Sets the number of frames to use for mb-tree ratecontrol and vbv-lookahead.
How it behaves: The more frames MB-Tree uses for lookahead, the more efficiently it works.
Values: 0 to 250
Default: 40
Recommendation: 60 or as high as you can handle
Additional Notes: How high you can set this is dependent on how much memory you have; if you run out of memory because of a high value, you will crash! For the vbv-lookahead portion of this,
increasing the frame count generates better stability and accuracy when using vbv.
MB-Tree | --no-mbtree (to disable)
What is it? - It tracks the propagation of information from future blocks to past blocks across motion vectors. It could be described as localizing qcomp (quantizer curve compression) to act on
individual blocks instead of whole scenes.
How it behaves: instead of lowering quality in high-complexity scenes (like x264 does without MB-Tree), it'll only lower quality on the complex part of the scene, while for example a static
background will remain high-quality.
Values: enabled or disabled
Default: enabled
Recommendation: TEST
Additional Notes: http://forum.doom9.org/showthread.php?t=148686
..::ANALYSIS::..
..::MOTION ESTIMATION::..
Chroma M.E. | --no-chroma-me (to disable)
What is it? - It takes color information, i.e. chroma, into account for motion detection.
How it behaves: Motion detection becomes more accurate and produces a better quality at the price of speed.
Values: enabled or disabled
Default: enabled
Recommendation: enabled, but you can disable this for slight speed increase with B&W movies
Additional Notes: n/a
M.E. Range | --merange value
What is it? - Defines how many pixels are analyzed for M.E.
How it behaves: Higher values result in more accurate analysis.
Values: 4 to 16 with --me dia or hex; 16 to 256 with --me umh, esa, tesa
Default: 16
Recommendation: 64 or higher (rarely higher) with --me umh, 48 or higher with --me esa, 24 or higher with --me tesa. Using 64 always is a good rule of thumb.
Additional Notes: Increasing merange with umh, esa, and tesa will cause severe slow down in encoding speed.
M.E. Algorithm | --me value
What is it? - The algorithm used to search for motion and calcluate motion vectors.
How it behaves: There are five different values available:
dia (diamond): the simplest search, consisting of starting at the best predictor, checking the motion vectors at one pixel upwards, left, down, and to the right, picking the best, and repeating the
process until it no longer finds any better motion vector (four sided shape analysis).
hex (hexagonal): similar strategy, except it uses a range-2 search of 6 surrounding points, thus the name. It is considerably more efficient than dia and hardly any slower.
umh (uneven multi-hex): considerably slower than hex, but searches a complex multi-hexagon pattern in order to avoid missing harder-to-find motion vectors. Unlike hex and dia, the merange
parameter directly controls umh's search radius, allowing one to increase or decrease the size of the wide search.
esa (exhaustive): highly optimized intelligent search of the entire motion search space within merange of the best predictor. It is mathematically equivalent to the bruteforce method of searching
every single motion vector in that area, though faster.
tesa (transformed exhaustive): algorithm which attempts to approximate the effect of running a Hadamard transform comparison at each motion vector; like exhaustive, but a little bit better and a
little bit slower.
Values: dia, hex, umh, esa, tesa
Default: hex
Recommendation: umh, use esa or tesa if you have the CPU power and don't mind the slower speeds
Additional Notes: --me umh, esa, tesa is affected greatly by --merange
Subpixel Refinement | --subme vaule
What is it? - This controls the precision of the M.E. process.
How it behaves: Higher values mean greater precision, offering better results.
0. fullpel only
1. QPel SAD 1 iteration
2. QPel SATD 2 iterations
3. HPel on MB then QPel
4. Always QPel
5. Multi QPel + bi-directional motion estimation
6. RD on I/P frames
7. RD on all frames
8. RD refinement on I/P frames
9. RD refinement on all frames
10. QP-RD (requires --trellis=2, --aq-mode > 0)
11. Full RD
Values: 0 to 11
Default: 7
Recommendation: 9 if using trellis=0, 10 for all else; 11 perhaps, once new trellis developments have been made (it is intended to work with a new trellis feature)
Additional Notes: --subme 11 is very new, as of writing (Aug 2, 2011) and as such, it's effects and benefits are not well known; it is unnecessary to use now, until the development and release of
a new trellis feature
..::EXTRA::..
MV Prediction Mod | --direct value
What is it? - This feature allows B-frames to use predicted motion vectors instead of actually coding each frame's motion.
How it behaves: None: disabled. Auto: x264 decides optimal setting for each frame. Temporal: Enforces prediction from neighboring frames. Spatial: Enforces prediction from neighboring blocks
within the current frame.
Values: none, spatial, temporal, auto
Default: spatial
Recommendation: auto
Additional Notes: n/a
Trellis | --trellis 2
What is it? - Trellis quantization occurs and attempts to keep certain details that would have otherwise been discarded, and will also discard certain details that otherwise would have been kept.
How it behaves: 0: disabled. 1: Performs trellis quantization on the final macroblock only. 2: Performs trellis quantization all the time.
Values: 0, 1, 2
Default: 1
Recommendation: 2, unless encoding animation, in which case 0 may be a better choice
Additional Notes: Trellis explanation and pseudocode by the x264-author: http://akuvian.org/src/x264/trellis.txt
Psy-RD Strength | --psy-rd psyr-rd value:psy-trellis value
What is it? - This controls the strength of Psy-RDO, the purpose of which is to keep the complexity of an encoded block simlar to the complexity of the original. This allows Psy-RDO to produce
an image that is sharper and more detailed compared to an image without Psy-RDO, all else equal.
How it behaves: Higher values increase strength of Psy-RDO and lower values decrease it.
Values: 0.0 to 2.0
Default: 1.0
Recommendation: 0.95 to 1.15 for film material, 0.4 to 0.6 for animation material (although 1.0 can work fine in many cases)
Additional Notes: Psy-RDO can help preserve film grain greatly, but will hurt metrics such as PSNR and SSIM (when psycho-visual optimizations occur, classical metrics become useless).
Psy-RDO works only when --subme 6 or greater is set. Psy-RDO strength is also affected internally based on the quantizer of the frame, so this is only one factor affecting the strength of
Psy-RDO.
Psy-Trellis Strength | --psy-rd psyr-rd value:psy-trellis value
What is it? - This controls the strength of Psy-Trellis, which attempts to improve the sharpness beyond the regular trellis algorithm.
How it behaves: Higher values increase strength of Psy-Trellis and lower values decrease it.
Values: 0 to 100
Default: 0
Recommendation: 0 to 0.15 for film material, 0 for animation material
Additional Notes: Still an experimental setting.
No DCT Decimation | --no-dct-decimate
What is it? - Turns DCT decimation off.
How it behaves: DCT decimation allows x264 to discard unnecessary DCT blocks, saving bitrate and improving efficiency. Causes slight but negligible loss in quality.
Values: enabled or disabled
Default: enabled
Recommendation: enabled (i.e. don't set this option)
Additional Notes: Rumors say that DCT Decimation shouldn't be use together with Trellis quantization, but this has been refuted!
No Fast P-Skip | --no-fast-pskip
What is it? - Turns off early skip detection on P-frames.
How it behaves: Fast P-Skip is an optimization that will speedup the encoding process at the cost of some visual quality, although it can be considered a negligible loss, compared to a
non-negligible increase in speed.
Values: enabled or disabled
Default: enabled
Recommendation: enabled (i.e. don't set this option), or disabled if you have the CPU power
Additional Notes: In rare cases Fast P-Skip causes artifacts in flat scenes
No Psychovisual Enhancements | --no-psy
What is it? - Disables all visual optimizations that reduce PSNR or SSIM.
How it behaves: This also disables some internal psy optimizations that aren't settable via x264's command line arguments.
Values: enabled or disabled
Default: disabled (i.e. psy optimizations are performed)
Recommendation: disabled (i.e. psy optimizations are performed)
Additional Notes: n/a
..::MACROBLOCKS::..
Partitions; Adaptive DCT, I4x4, P4x4, I8x8, P8x8, B8x8 | --partitions partition values, save adaptive dct; --partitions all (for all partitions, obviously)
What is it? - H.264 video is split up into 16x16 macroblocks during compression. These blocks can be further split up into smaller partitions, which is what this option controls.
How it behaves: Turn partitions on and off.
Values: Adaptive DCT,p8x8,b8x8,i8x8,i4x4,p4x4
Default: p8x8,b8x8,i8x8,i4x4
Recommendation: p8x8,b8x8,i8x8,i4x4 (DXVA requires this)
Additional Notes: Setting Adaptive DCT forces I8x8
http://avidemux.org/admWiki/doku.php?id=tutorial:h.264#partition
http://mewiki.project357.com/wiki/X264_Settings#partitions

Das könnte Ihnen auch gefallen