X264 parameter settings

Source: Internet
Author: User
X264 core: 65 r1074m b6bb3d4
Syntax: x264 [Options]-o outfile infile [widthxheight]
Syntax (command line): x264 [parameter]-O output file name input file name [width x height]
Example:
X264 -- CRF 26 -- ref 3 -- mixed-Refs -- bframes 3 -- B-adapt 2 -- B-pyramid -- weightb -- deblock-1: -1 -- trellis 2 -- partitions all -- 8x8dct -- Me umh -- threads auto -- thread-input -- aud -- Progress -- no-SNR -- no-SSIM-O output.mp4 input. AVS 720x480

Infile can be raw YUV (in which case resolution is required ),
Or yuv4mpeg (*. y4m ),
Or AVI or avisynth if compiled with Avis support (yes ).
The input file can be raw YUV (resolution is required in some cases)
Or yuv4mpeg (*. y4m)
Or AVI or avisynth (the following Yes instructions support AVS input)

OUTFILE type is selected by filename:
. 264-> raw bytestream
. MKV-> matroska
. MP4-> MP4 if compiled with gpac support (yes)
The output file type is specified by the output file name:
. 264-> raw format
. MKV-> MKV format
. MP4-> MP4 format (Yes indicates MP4 output is supported) Options:
Optional parameters:

-H, -- help list the more commonly used options
-- Longhelp list all options
-H, -- help display common parameters
-- Longhelp: Display All Parameters
Note:-h, -- help indicates that both-H and -- help can be used.-H is a simplified writing method.
For example:
X264-H and x264 -- help are equivalent.

--------------------------------------

Frame-type options:
Frame-type options:

-I, -- keyint <integer> maximum GOP size [250]
Description: maximum interval between two IDR frames. The default value is 250.
Recommended Value: default value or 10 times of FPS
Example: -- keyint 300
Note: [250] indicates that the default value is 250.
Tip: If you want to use the default value, do not use the parameter.

-I, -- Min-keyint <integer> Minimum GOP size [25]
Description: minimum interval between two IDR frames. The default value is 25.
Recommended Value: default or FPS size
Example: -- Min-keyint 30

Q: How to view FPS?
Http://mediainfo.sourceforge.net/zh-CN
Download mediainfo from the above website.

-- Scenecut <integer> how aggressively to insert extra I-Frames [40]
Description: Specifies the threshold value for forced use of IDR frames. The larger the value, the higher the intensity. The default value is 40.
Recommended Value: Default
Example: -- scenecut 40

-- Pre-scenecut faster, less precise scenecut detection.
Required and implied by multi-threading.
Note: The effect is the same as that of scenecut. The speed is faster than scenecut, but the accuracy is slightly lower. The default value is to always use -- pre-scenecut when threads> 1.
Recommended Value: Default

-B, -- bframes <integer> Number of B-frames between I and P [0]
Description: sets the maximum number of B frames between frames I and P, ranging from 0 ~ 16
Recommended Value: 3-6
Example: -- bframes 3

-- B-adapt adaptive B-frame demo-method [1]
Higher values may lower threading efficiency.
-0: Disabled
-1: fast
-2: optimal (slow with high -- bframes)
Description: B-frame adaptive method. The default value is 1.
-0: Disable
-1: High Speed
-2: optimization (-- the higher the bframes value, the slower the speed)
Recommended Value: 2
Example: -- B-adapt 2

-- B-bias <integer> influences how often B-frames are used [0]
Note: The frequency of B frames is affected. The default value is 0.
Recommended Value: 0
Example: -- B-bias 0

-- B-pyramid keep some B-frames as references
Note: Other frames are allowed to refer to frame B, which is not used by default.
Recommended Value: Enabled
Example: -- B-pyramid

-- No-cabac disable cabac
: Disable cabac. It is not used by default.

-R, -- ref <integer> Number of reference frames [1]
Description: sets the number of reference frames, ranging from 0 ~ 16. The default value is 1. If the value is too large, hard decoding may fail. For details, refer to the following formula to calculate the maximum reference frame of a good hard solution.
Calculation Formula for the maximum number of reference frames: Maximum ref = 12288*1024/(width * height * 1.5)
Recommended Value: 3-6
Example: -- ref 3

-- No-deblock disable loop filter
Deblock filter is disabled. It is not used by default.
Recommended Value: Default
Example: -- no-deblock

-F, -- deblock <ALPHA: Beta> loop filter alphac0 and beta parameters [0: 0]
Description: Set the deblock filter parameter. The Alpha parameter is deblocking strength and the beta parameter is deblockingthreshold. The greater the value, the better the deblocking effect. The cleaner the screen, but it will lose some details and make a little confused, and vice versa. The upper and lower limits must not exceed-3, and the default value is 0, 0.
Recommended Value: Default
Example: -- deblock 0: 0

-- Interlaced enable pure-interlaced Mode
Description: interlace encoding mode, which is disabled by default.
Example: -- interlaced

--------------------------------------

Ratecontrol:
Compression ratio control:

-Q, -- QP <integer> set QP (0 = lossless) [26]
Note: Fixed quantization mode. The smaller the value, the better the quality. The default value is 26. QP = CRF + -- qcomp 1.
Recommended Value: use CRF. For details, see section CRF.
Example: -- QP 26

-B, -- bitrate <integer> set bitrate (kbit/s)
Description: target bit rate mode. The generated video bit rate is the value of the specified bitrate. It is generally used together with -- pass.
Recommended value: the bit rate below P is between-kbps, P is 3-6 Mbps, and P is 8-15 Mbps or above
Example: -- bitrate 1000

-- CRF <float> quality-based VBR (nominal QP)
Note: Fixed compression factor mode. The smaller the value, the better the quality. It is generally used together with qcomp.
Recommended Value: 16-26
Example: -- CRF 26

-- Qcomp <float> QP curve compression: 0.0 => CBR, 1.0 => CQP [0.60]
Description: Compression Curve, ranging from 0 ~ 1, the smaller the value, the smoother the curve, and used with CRF. The default value is 0.6.
Recommended Value: Default
Example: -- qcomp 0.6

-- Vbv-maxrate <integer> MAX local bitrate (kbit/s) [0]
Description: sets the maximum bit rate of the vbv mode. If you need to enable the vbv mode for hard decoding, the default value is 0.
Example: -- vbv-maxrate 50000

-- Vbv-bufsize <integer> enable CBR and set size of the vbv buffer (kbit) [0]
Description: sets the maximum vbv buffer size. The size is generally determined by the hardware device. The default value is 0.
Example: -- vbv-bufsize 50000

-- Vbv-init <float> initial vbv buffer occupancy [0, 0.9]
Description: sets the initial filling size of the vbv buffer. The default value is 0.9.
Example: -- vbv-init 0.9

-- Qpmin <integer> set min QP [10]
Note: Set the lower limit of QP. The default value is 10.
Example: -- qpmin 10

-- Qpmax <integer> Set max QP [51]
Note: set the maximum QP value. The default value is 51.
Example: -- qpmax 51

-- Qpstep <integer> Set max QP step [4]
Description: sets the maximum step of QP. The default value is 4.
Example: -- qpstep 4

-- Ratetol <float> allowed variance of average bitrate [1, 1.0
Note: The percentage of the final bit rate that is allowed to deviate from the specified average bit rate is only used for 1 pass. The default value is 1.0.
Example: -- ratetol 1.0

-- Ipratio <float> QP factor between I and P [1.40]
Description: sets the quantization ratio of an I frame to a P frame.
Recommended Value: Default
Sample: -- ipratio 1.40

-- Pbratio <float> QP factor between P and B [1.30]
Description: sets the quantization ratio of P frames to B frames.
Recommended Value: Default
Sample: -- ipratio 1.30

-- Chroma-QP-offset <integer> QP difference between chroma and Luma [0]
Note: The QP difference between chroma and Luma will be automatically adjusted to-2 with the use of -- psy-Rd
Recommended Value: Default
Example: -- chroma-QP-offset 0

-- AQ-mode <integer> AQ method [1]
-0: Disabled
-1: variance AQ (complexity mask)
Note: The adaptive quantization method can improve the problem of over-blur in some scenarios. It is enabled by default.

-0: Disable
-1: Variable AQ
Recommended Value: Default
Example: -- AQ-mode 1

-- AQ-Strength <float> reduces blocking and blurring in flat and
Textured areas. [1.0]
-0.5: weak AQ
-1.5: Strong AQ
Description: Specify the AQ strength to reduce the quantization value of the Low-Detail macro block. The default value is 1.0.
-0.5: relatively weak AQ
-1.5: relatively strong AQ
Recommended Value: Default
Example: -- AQ-strength 1.0

-P, -- pass <1 | 2 | 3> enable multipass ratecontrol
-1: first pass, creates stats File
-2: Last pass, does not overwrite stats File
-3: nth pass, overwrites stats File
Note: In the multi-compression mode, 1 pass or N pass generates the stats file, and 2 pass calls the generated stats file to optimize the compression to allocate the bit rate more rationally. Generally, N pass is unnecessary.
-1: 1st pass, generating the stats File
-2: The final pass does not overwrite the stats file.
-3: nth pass, overwrite the stats File
Recommended Value: 2
Example: -- pass 2

-- Stats <string> filename for 2 pass stats ["x264_2pass.log"]
Description: Specifies the stats file name. The default value is "x264_2pass.log"
Recommended Value: Default
Example: -- stats "x264_2pass.log"

-- Cplxblur <float> reduce fluctuations in QP (before curve compression) [20.0]
Note: The QP fluctuation is reduced (before curve compression) in the range of 0 ~ 999
Recommended Value: Default
Example: -- cplxblur 20

-- Qblur <float> reduce fluctuations in QP (after curve compression) [0.5]
Note: The QP fluctuation is reduced (after the curve is compressed) in the range of 0 ~ 99
Recommended Value: Default
Example: -- qblur 0.5

-- Zones <zone0>/<zone1>/... tweak the bitrate of some regions of the video
Each zone is of the form
<Start frame>, <End frame>, <option>
Where <option> is either
Q = <integer> (Force QP)
Or B = <float> (bitrate multiplier)
Adjusts the bit rate within a certain range of the video.
Each region has the following format
<Start frame>, <End frame>, <option>
<Option> Any of the following
Q = <integer> (Force QP)
Or B = <float> (specify bitrate)
Example: -- Zone 30/30000, qP = 32000, 0.5, B =

-- Qpfile <string> force frametypes and QPS
Note: Force specify the frame type and qP

Recommended Value: Default

Analysis:
Analysis:

-A, -- partitions <string> partitions to consider ["p8x8, b8x8, i8x8, i4x4"]
-P8x8, p4x4, b8x8, i8x8, i4x4
-None, all
(P4x4 requires p8x8. i8x8 requires -- 8x8dct .)
Description: macro block segmentation method. The default value is ["p8x8, b8x8, i8x8, i4x4"].
-P8x8, p4x4, b8x8, i8x8, i4x4
-None, all
(P4x4 requires p8x8. i8x8 -- 8x8dct .)
Recommended Value: Default
Example: -- partitions "p8x8, b8x8, i8x8, i4x4"

-- Direct <string> direct MV prediction mode ["spatial"]
-None, spatial, temporal, auto
Description: direct prediction method. The default value is "spatial"
-None, spatial, temporal, auto
Recommended Value: "Auto"
Example: -- direct "Auto"

-Direct-8x8 <-1 | 0 | 1> direct prediction size [1]
-0: 4x4
-1: 8x8
--1: smallest possible according to level
Description: direct prediction size. The default value is-1.
-0: 4x4
-1: 8x8
--1: determine a minimum value based on level.
Example: -- direct 1

-W, -- weightb weighted prediction for B-Frames
Description: weighted prediction of B frames is allowed.
Example: -- weightb

-- Me <string> integer pixel motion estimation method ["hex"]
-Dia: Diamond Search, radius 1 (FAST)
-Hex: hexagonal search, radius 2
-Umh: Uneven multi-hexagon search
-ESA: exhaustive search
-TeSA: Hadamard exhaustive search (slow)
Note: the more accurate the full pixel dynamic prediction method is, the slower the speed is. The default value is "hex"
-Dia: Diamond Search, radius 1 (high speed)
-Hex: hexagonal search, radius 2
-Umh: irregular polygon search
-ESA: comprehensive search
-TeSA: Hadamard Transform full search (slowest)
Recommended Value: "umh"
Example: -- Me "umh"

-- Merange <integer> maximum motion vector search range [16]
Note: The maximum range of dynamic vector search is used in combination with-me. For Dia and hex, the range allowed is 4 ~ 16. umh and above can exceed 16. The larger the value, the slower the encoding speed. The default value is 16.
Example: -- merange 16

-- Mvrange <integer> maximum motion vector length [-1 (auto)]
Description: Maximum length of dynamic vectors.
Recommended Value: Default
Example: -- mvrange-1

-- Mvrange-thread <int> minimum buffer between threads [-1 (auto)]
Minimum buffer size between threads
Recommended Value: Default
Example: -- mvrange-thread-1

-M, -- subme <integer> subpixel motion estimation and mode demo-[ 6]
-0: fullpel only (not recommended)
-1: Sad mode demo-, one qpel Iteration
-2: satd mode demo-
-3-5: progressively more qpel
-6: RD mode demo-for I/p-Frames
-7: RD mode demo-for all frames
-8: RD refinement for I/p-Frames
-9: RD refinement for all frames
Note: The sub-pixel dynamic prediction mode is used. The higher the value, the better the effect, and the slower the speed. The default value is 6.
-0: fullpel only (not recommended)
-1: Sad Mode Policy, 1 qpel Iteration
-2: satd Mode Policy
-3-5: Increase qpel in sequence
-6: I/p-frame RD Mode Policy
-7: All frame RD mode policies
-8: I/p-frame RD refinement Mode Policy
-9: RD refinement Mode Policy for all frames
Recommended Value: 6 or more
Example: -- subme 7

-- Psy-rd strength of psychovisual optimization ["1.0: 0.0"]
#1: RD (requires subme> = 6)
#2: trellis (requires trellis, experimental)
(Visual optimization, -- psy-rd 1.0: 0.0 stands for #1 as 1.0, #2 is 0.0, #2 is still in the test phase, default value: 1.0: 0.0)
#1: RD (subme required> = 6)
#2: trellis (trellis required, test phase)
Recommended Value: #1 (0 ~ 1.0), #2 0.0
Example: -- psy-rd 1.0: 0.0

-- Mixed-Refs decide references on a per partition basis
Note: frame-based judgment is performed for each Macro Block area to Improve the quality but reduce the speed.
Recommended Value: Enabled
Example: -- mixed-refs

-- No-chroma-me ignore chroma in Motion Estimation
Note: chroma is ignored in dynamic prediction.
Recommended Value: Default
Example: -- no-chroma-me

-8, -- 8x8dct adaptive spatial transform size
Note: Adaptive Space Transformation
Recommended Value: Use
Example: -- 8x8dct

-T, -- trellis <integer> trellis RD quantization. Requires cabac. [0]
-0: Disabled
-1: enabled only on the final encode of a MB
-2: enabled on all mode decisions
Note: trllis RD quantization. cabac is required. The greater the value, the slower the speed. The default value is 0.
-0: Disable
-1: Based on macro Blocks
-2: Used in all mode policies
Recommended Value: 1
Example: -- trellis 1

-- No-fast-pskip disables early skip detection on p-Frames
Note: disabling the early p-frame quick detection can improve the quality, but reduce the speed. It is not used by default.
Recommended Value: Use
Example: -- no-fast-pskip

-- No-DCT-decimate disables coefficient thresholding on p-Frames
Note: The coefficient threshold of P frame is disabled. It is not used by default.
Recommended Value: Default
Example: -- no-DCT-decimate

-- Nr <integer> noise ction [0]
Description: Noise Reduction. The default value is 0.
Recommended Value: Default
Example: -- Nr 0

-- Deadzone-Inter <int> set the size of the Inter Luma quantization deadzo
Ne [21]
-- Deadzone-intra <int> set the size of the Intra Luma quantization deadzo
Ne [11]
Deadzones shocould be in the range 0-32.
Description: sets the quantitative value of inter/intra Luma deadzone. The value ranges from 0 to 32.
Recommended Value: Default
Example: -- deadzone-Inter 21 -- deadzone-intra 11

-- CQM <string> preset quant matrices ["flat"]
-JVT, flat
Description: preset quantization matrix-JVT, flat
Recommended Value: Default
Example: -- CQM "flat"

-- Cqmfile <string> Read custom quant matrices from a JM-compatible File
Overrides any other -- CQM * options.
Description: reads the custom JM-compatible quantization matrix file and ignores any parameters starting with -- CQM.
Example: -- CQM "mycqm"

-- Cqm4 <list> set all 4x4 quant Matrices
Takes a comma-separated list of 16 integers.
Description: sets all the 4x4 quantization matrices. It is a table of 16 integers separated by commas (,).
Example: -- CQM "16,16, 16,16, 16,16, 16,16, 16,16, 16,16, 16,16, 16,16"

-- Cqm8 <list> set all 8x8 quant Matrices
Takes a comma-separated list of 64 integers.
Description: sets all 8x8 quantization matrices. It is a table of 64 integers separated by commas (,).
Example: see -- cqm4

-- Cqm4i, -- cqm4p, -- cqm8i, -- cqm8p
Set both luma and chroma quant Matrices
Sets the quantization matrix of luma and chroma.
Example: see -- cqm4

-- Cqm4iy, -- cqm4ic, -- cqm4py, -- cqm4pc
Set individual quant Matrices
Description: separately sets the quantization matrix.
Example: see -- cqm4

Video usability Info (Annex E ):
The VUI settings are not used by the encoder but are merely suggestions
The playback equipment. See Doc/vui.txt for details. Use at your own risk.
Video Availability Information:
VUI settings are not used for encoding. They only apply to playback devices. For details, see Doc/vui.txt. The risks arising therefrom shall be borne by the user.

-- Overscan <string> specify crop overscan setting ["UNDEF"]
-UNDEF, show, crop
Description: This parameter specifies the scanning setting for cropping. The default value is "UNDEF"
-UNDEF, show, crop
Example: -- overscan "UNDEF"

-- Videoformat <string> specify video format ["UNDEF"]
-Component, pal, NTSC, SECAM, Mac, UNDEF
Description: Specifies the video format. The default value is "UNDEF"
-Component, pal, NTSC, SECAM, Mac, UNDEF
Example: -- videoformat "UNDEF"

-- Fullrange <string> specify full range samples setting ["off"]
-Off, on
Description: Specifies the full range of color sample settings. The default value is "off"
-Off, on
Example: -- fullrange "off"

-- Colorprim <string> specify color primaries ["UNDEF"]
-UNDEF, bt709, bt470m, bt470bg
Smpte170m, smpte240m, film
Description: Specifies the primary color. The default value is "UNDEF"
-UNDEF, bt709, bt470m, bt470bg
Smpte170m, smpte240m, film
Example: -- colorprim "bt470bg"

-- Transfer <string> specify transfer characteristics ["UNDEF"]
-UNDEF, bt709, bt470m, bt470bg, linear,
Log100, log316, smpte170m, smpte240m
Description: Specifies the conversion feature. The default value is "UNDEF"
-UNDEF, bt709, bt470m, bt470bg, linear,
Log100, log316, smpte170m, smpte240m
Example: -- transfer "UNDEF"

-- Colormatrix <string> specify color matrix setting ["UNDEF"]
-UNDEF, bt709, FCC, bt470bg
Smpte170m, smpte240m, GBR, ycgco
Description: Specifies the color matrix. The default value is "UNDEF"
-UNDEF, bt709, bt470m, bt470bg, linear,
Log100, log316, smpte170m, smpte240m
Example: -- colormatrix "UNDEF"

-- Chromaloc <integer> specify chroma sample location (0 to 5) [0]
Note: The chroma sample location is specified. if the source is MPEG2 or MPEG4, it is set to 1 when the source is mpeg1, And the range is 0 ~ 5. The default value is 0.
Example: -- chromaloc 0

--------------------------------------

Input/output:
Input/output:

-O, -- output specify output file
Description: Specifies the output file.
Example: -- output output.mp4

-- SAR width: height specify sample Aspect Ratio
Description: Specify sar. For details about SAR, see here.
Http://www.sonature.com.cn/thread-572-1-1.html
Example: -- SAR 40: 33

-- FPS <float | rational> specify framerate
Description: Specifies the frame rate of a video.
Recommended Value: Default
Example: -- FPS 29.97

-- Seek <integer> first frame to encode
Description: Specifies the encoding start frame. frames before this frame will be discarded.
Example: -- seek 100

-- Frames <integer> maximum number of frames to encode
Description: Total number of frames of the specified encoding.
Example: -- frames 200

-- Level <string> Specify level (as defined by Annex)
Note: specify the level. If you do not need it, try to keep the level below 4.1.
Example: -- level 4.1

-V, -- verbose print stats for each frame
Description: displays the status of all frames.
Example: -- verbose

-- Progress show a progress indicator while Encoding
Progress bar displayed during encoding
Example: -- Progress

-- Quiet Mode
Note: Quiet Mode
Example: -- quiet

-- No-SNR disable SNR Computation
Note: No SNR is calculated.
Example: -- no-SNR

-- No-SSIM disable SSIM Computation
Note: SSIM is not calculated.
Example: -- no-SSIM

-- Threads <integer> parallel encoding
Description: Number of encoding threads.
Example: -- threads 8

-- Thread-input run avisynth in its own thread
Note: Run AVS on a separate thread.
Example: -- thread-Input

-- Non-deterministic slightly improve quality of SMP, at the cost of Repeatability
Note: The SMP quality is slightly improved.
Example: -- non-deterministic

-- ASM <integer> override CPU Detection
Description: overwrite CPU detection data.
Example: -- ASM 120

-- No-ASM disable all CPU Optimizations
Note: Do not use all CPU optimization parameters
Example: -- no-ASM

-- Visualize show MB types overlayed on the encoded video
Description: displays the macro block type of the encoded video.
Example: -- Visualize

-- Dump-YUV <string> Save reconstructed Frames
Note: Save the reconstructed frame.
Example: -- dump-YUV "file name"

-- SPS-id <integer> set SPS and pps id numbers [0]
Note: The SPS and pps id are set.
Example: -- SPS-ID 0

-- Aud use access unit delimiters
Note: The access unit qualifier is used.
Example: -- aud

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.