当前位置:文档之家› x264命令行参数解释

x264命令行参数解释

x264命令行参数解释使用格式:x264 默认选项 -o 输出文件输入文件 [长x宽]输入支持格式:RAW/y4m/avi/avs(编译时可选)输出支持格式:264/mkv/mp4(编译时可选)x264的许多参数可以有-/--两种输入法,笔者也不知道为什么。

以下等价参数用“参数1/参数2 <必需数值格式>”表示,参数尾部()内为个人推荐。

-h/--help 帮助帧类型选项:-I/--keyint <整数> 最大IDR帧间距,默认250-i/--min-keyint <整数> 最小IDR帧间距,默认25--scenecut <整数> 画面动态变化限,当超出此值时插入I帧,默认40-b/--bframes <整数> 在IP帧之间可插入的B帧数量最大值,范围0~16,默认0--no-b-adapt 关闭自适应B帧判定(-b设为1时可用,其他不推荐)--b-bias <整数> 控制插入B帧判定,范围-100~+100,越高越容易插入B帧,默认0--b-pyramid 允许B帧做参考帧--no-cabac 关闭内容自适应二进制算术编码(CABAC,高效率的熵编码)(会提高速度,但严重影响质量)-r/--ref <整数> 最大参考帧数,范围0~16,默认1--nf 关闭环路滤波(一种除马赛克算法)-f/--filter <alpha:beta>设置环路滤波的AlphaC和Beta的参数,范围-6-6,默认都为0码率控制选项:-q/--qp <整数> 固定量化模式并设置使用的量化值,范围0~51,0为无损压缩,默认26-B/--bitrate <整数> 设置平均码率--crf <整数> 质量模式,量化值动态可变(目前不太成熟,质量不如设置固定量化值)--qpmin <整数> 设置最小量化值,范围0~51,默认10--qpmax <整数> 设置最大量化值,范围0~51,默认51--qpstep <整数> 设置相邻帧之间的量化值差,范围0~50,默认4--ratetol <小数> 平均码率模式下,瞬时码率可以偏离的倍数,范围0.1~100.0,默认1.0 --vbv-maxrate <整数> 平均码率模式下,最大瞬时码率,默认0(与-B设置相同)--vbv-bufsize <整数> 码率控制缓冲区的大小,单位kbit,默认0--vbv-init <小数> 码率控制缓冲区数据保留的最大数据量与缓冲区大小之比,范围0~1.0,默认0.9--ipratio <小数> I帧和P帧之间的量化系数,默认1.40--pbratio <小数> P帧和B帧之间的量化系数,默认1.30--色度-qp-offset <整数> 色度和亮度之间的量化差,范围-12~+12,默认0-p/--pass <1|2|3> 多次压缩码率控制1:第一次压缩,创建统计文件2:按建立的统计文件压缩并输出,不覆盖统计文件,3:按建立的统计文件压缩,优化统计文件--stats <字符串> 统计文件的名称,默认"x264_2pass.log"--rceq <字符串> 速率控制公式,默认"blurCplx^(1-qComp)"--qcomp <小数> 线性量化控制,0.0为固定码率,1.0为固定量化值,默认0.6,只用于2-pass 和质量模式--cplxblur <小数> 根据相邻帧平滑量化值比例的最大值,范围0~99.9,默认20.0,只用于2-pass和质量模式--qblur <小数> 对统计文件结果平滑量化值比例的最大值,范围0~99.9,默认0.5,只用于2-pass--zones <z0>/<z1>/…分段量化,格式为:<开始帧>,<结束帧>,<选项>,可选项为:q=<整数>(量化值)或b=<小数>(码率倍数)分析选项:-A/--analyse <字符串> 动态块划分方法,默认"p8x8,b8x8,i8x8,i4x4"。

可选项:p8x8/p4x4/b8x8/i8x8/i4x4;none/all(p4x4需要p8x8. i8x8需要--8x8dct)--direct <字符串> 动态预测方式,默认"spatial"。

可选项:none/spatial/temporal/auto-w/--weightb 允许B帧加权预测(可以减少相邻B帧质量低的影响)--me <字符串> 对全像素块动态预测搜索的方式,默认"hex",可选项:dia:菱形搜索,半径1 (快)hex:正六边形搜索,半径2umh:可变半径六边形搜索esa:全面搜索(很慢,而且效果与umh几乎相同)--merange <整数> --me为umh/esa时的搜索半径,最大64,默认16-m/--subme <整数> 动态预测和分区方式,可选项1~7,默认5(与压缩质量和时间关系密切,1是7速度的四倍以上)1:用全像素块进行动态搜索,对每个块再用快速模式进行四分之一像素块精确搜索2:用半像素块进行动态搜索,对每个块再用快速模式进行四分之一像素块精确搜索3:用半像素块进行动态搜索,对每个块再用质量模式进行四分之一像素块精确搜索4:用快速模式进行四分之一像素块精确搜索5:用质量模式进行四分之一像素块精确搜索6:进行I、P帧像素块的速率失真最优化(rdo)7:进行I、P帧运动矢量及块内部的速率失真最优化(质量最好)--b-rdo B帧也进行rdo,需要--subme在6以上--mixed-refs 可以在一帧内使用不同参考帧--no-chroma-me 不进行色度的动态预测--bime 可以平均B帧参考块的运动矢量-8/--8x8dct 可以使用8x8的离散余弦变换(DCT)-t/--trellis <整数> Trellis量化,对每个8x8的块寻找合适的量化值,需要CABAC,默认00:关闭1:只在最后编码时使用2:一直使用--no-fast-pskip 关闭快速P帧跳过检测--no-dct-decimate 关闭P帧联合编码(可以增加细节,但也会增大体积)--nr <整数> 噪声去除,范围0~100000,默认0--cqm <字符串> 设置外部量化矩阵格式,默认"flat",可选项:jvt/flat--cqmfile <字符串> 读取JM格式的外部量化矩阵文件,自动忽略其他--cqm*选项--cqm4 <list> 设置4x4的量化矩阵,用逗号分开,范围1~255的16个整数--cqm8 <list> 设置8x8的量化矩阵,用逗号分开,范围1~255的64个整数--cqm4i/--cqm4p/--cqm8i/--cqm8p 设置I、P帧不同的量化矩阵--cqm4iy/--cqm4ic/--cqm4py/--cqm4pc 设置亮度、色度不同的量化矩阵视频标准化选项:这些选项与编码无关,不过如果要用mp4之类的播放器,可以设置,风险自担--sar width:height 设置长宽比--overscan <字符串> 过扫描线,默认"undef"(不设置),可选项:show(观看)/crop(去除) --videoformat <字符串> 视频格式,默认"undef",可选项:component/pal/ntsc/secam/mac/undef--fullrange <字符串> Specify full range samples setting,默认"off",可选项:off/on(我也不明白这是干什么的,请高手指点)--colorprim <字符串> 原始色度格式,默认"undef",可选项:undef/bt709/bt470m/bt470bg,smpte170m/smpte240m/film--transfer <字符串> 转换方式,默认"undef",可选项:undef/bt709/bt470m/bt470bg/linear,log100/log316/smpte170m/smpte240m--colormatrix <字符串> 色度矩阵设置,默认"undef",undef/bt709/fcc/bt470bg,smpte170m/smpte240m/GBR/YCgCo--chromaloc <整数> 色度样本指定,范围0~5,默认0输入、输出选项:--level <字符串> 设定等级(as defined by Annex A)(不明白,请高手指点)--fps <小数> 设定帧率--seek <整数> 设定起始帧--frames <整数> 最大编码帧数-o/--output 指定输出文件--threads <整数> 编码线程(使用分片技术)--thread-input 在编码线程中运行Avisynth--no-asm 关闭全部CPU优化指令--no-psnr 关闭PSNR计算--quiet 安静模式-v/--verbose 显示每一个帧的信息--progress 显示编码进程--visualize 显示运动矢量--sps-id <整数> 设置SPS和PPS的ID值,默认0--aud 使用数据单元定义符号-----------------------------------------------------------------------------------------------------------------------------------------------2006-9-14 03:00 PM adminx264编码器参数设置详解bitrate=<value>Sets the average bitrate to be used in kbits/second (default: off). Since local bitrate may vary, this average may be inaccurate for very short videos (see ratetol). Constant bitrate can be achieved by combining this with vbv_maxrate, at significant reduction in quality.qp_constant=<0?51>This selects the quantizer to use for P-frames. I- and B-frames are offset from this value by ip_factor and pb_factor, respectively. 20?40 is a useful range (default: 26). Lower values result in better fidelity, but higher bitrates. 0 is lossless. Note that quantization in H.264 works differently from MPEG-1/2/4: H.264’s quantization parameter (QP) is on a logarithmic scale. The mapping is approximately H264QP = 12 + 6*log2(MPEGQP). For example, MPEG at QP=2 is equivalent to H.264 at QP=18.crf=<1?50>Enables constant quality mode, and selects the quality. The scale is similar to QP. Like the bitrate-based modes, this allows each frame to use a different QP based on the frame’s complexity.pass=<1?3>Enable 2 or 3-pass mode. It is recommended to always encode in 2 or 3-pass mode as it leads to a better bit distribution and improves overall quality.1first passsecond pass (of two pass encoding)3Nth pass (second and third passes of three pass encoding)Here is how it works, and how to use it:The first pass (pass=1) collects statistics on the video and writes them to a file. You might want to deactivate some CPU-hungry options, apart from the ones that are on by default.In two pass mode, the second pass (pass=2) reads the statistics file and bases ratecontrol decisions on it.In three pass mode, the second pass (pass=3, that is not a typo) does both: It first reads the statistics, then overwrites them. You can use all encoding options, except very CPU-hungry options.The third pass (pass=3) is the same as the second pass, except that it has the second pass’ statistics to work from. You can use all encoding options, including CPU-hungry ones.The first pass may use either average bitrate or constant quantizer. ABR is recommended, since it does not require guessing a quantizer. Subsequent passes are ABR, and must specify bitrate.turbo=<0?2>Fast first pass mode. During the first pass of a two or more pass encode it is possible to gain speed by disabling some options with negligible or even no impact on the final pass output quality.disabled (default)1Reduce subq, frameref and disable some inter-macroblock partition analysis modes.2Reduce subq and frameref to 1, use a diamond ME search and disable all partition analysis modes.Level 1 can increase first pass speed up to 2x with no change in the global PSNR of the final pass compared to a full quality first pass.Level 2 can increase first pass speed up to 4x with about +/- 0.05dB change in the global PSNR of the final pass compared to a full quality first pass.keyint=<value>Sets maximum interval between IDR-frames (default: 250). Larger values save bits, thus improve quality, at the cost of seeking precision. Unlike MPEG-1/2/4, H.264 does not suffer from DCT drift with large values of keyint.keyint_min=<1?keyint/2>Sets minimum interval between IDR-frames (default: 25). If scenecuts appear within this interval, they are still encoded as I-frames, but do not start a new GOP. In H.264, I-frames do not necessarily bound a closed GOP because it is allowable for a P-frame to be predicted from more frames than just the one frame before it (also see frameref). Therefore, I-frames are not necessarily seekable. IDR-frames restrict subsequent P-frames from referring to any frame prior to the IDR-frame.scenecut=<-1?100>Controls how aggressively to insert extra I-frames (default: 40). With small values of scenecut, the codec often has to force an I-frame when it would exceed keyint. Good values of scenecut may find a better location for the I-frame. Large values use more I-frames than necessary, thus wasting bits. -1 disables scene-cut detection, so I-frames are inserted only once every other keyint frames, even if a scene-cut occurs earlier. This is not recommended and wastes bitrate as scenecuts encoded as P-frames are just as big as I-frames, but do not reset the "keyint counter".frameref=<1?16>Number of previous frames used as predictors in B- and P-frames (default: 1). This is effective in anime, but in live-action material the improvements usually drop off very rapidly above 6 or so reference frames. This has no effect on decoding speed, but does increase the memory needed for decoding. Some decoders can only handle a maximum of 15 reference frames.bframes=<0?16>maximum number of consecutive B-frames between I- and P-frames (default: 0)(no)b_adaptAutomatically decides when to use B-frames and how many, up to the maximum specified above (default: on). If this option is disabled, then the maximum number of B-frames is used.b_bias=<-100?100>Controls the decision performed by b_adapt. A higher b_bias produces more B-frames (default: 0).(no)b_pyramidAllows B-frames to be used as references for predicting other frames. For example, consider 3 consecutive B-frames: I0 B1 B2 B3 P4. Without this option, B-frames follow the same pattern as MPEG-[124]. So they are coded in the order I0 P4 B1 B2 B3, and all the B-frames are predicted from I0 and P4. With this option, they are coded as I0 P4 B2 B1 B3. B2 is the same as above, but B1 is predicted from I0 and B2, and B3 is predicted from B2 and P4. This usually results in slightly improved compression, at almost no speed cost. However, this is an experimental option: it is not fully tuned and may not always help. Requires bframes >= 2. Disadvantage: increases decoding delay to 2 frames.(no)deblockUse deblocking filter (default: on). As it takes very little time compared to its quality gain, it is not recommended to disable it.deblockalpha=<-6?6>AlphaC0 parameter of deblocking filter (default: 0). This adjusts thresholds for the H.264 in-loop deblocking filter. First, this parameter adjusts the maximum amount of change that the filter is allowed to cause on any one pixel. Secondly, this parameter affects the threshold for difference across the edge being filtered. A positive value reduces blocking artifacts more, but will also smear details. The default behavior of the filter almost always achieves optimal quality, so it is best to either leave it alone, or make only small adjustments. However, if your source material already has some blocking or noise which you would like to remove, it may be a good idea to turn it up a little bit.deblockbeta=<-6?6>Beta parameter of deblocking filter (default: 0). Affects the detail threshold. Very detailed blocks are not filtered, since the smoothing caused by the filter would be more noticeable than the original blocking.(no)cabacUse CABAC (Context-Adaptive Binary Arithmetic Coding) (default: on). Slightly slows down encoding and decoding, but should save 10-15% bitrate. Unless you are looking for decoding speed, you should not disable it.qp_min=<1?51> (ABR or two pass)Minimum quantizer, 10?30 seems to be a useful range (default: 10).qp_max=<1?51> (ABR or two pass)maximum quantizer (default: 51)qp_step=<1?50> (ABR or two pass)maximum value by which the quantizer may be incremented/decremented between frames (default: 2)ratetol=<0.1?100.0> (ABR or two pass)allowed variance in average bitrate (no particular units) (default: 1.0)vbv_maxrate=<value> (ABR or two pass)maximum local bitrate, in kbits/second (default: disabled)vbv_bufsize=<value> (ABR or two pass)averaging period for vbv_maxrate, in kbits (default: none, must be specified if vbv_maxrate is enabled)vbv_init=<0.0?1.0> (ABR or two pass)initial buffer occupancy, as a fraction of vbv_bufsize (default: 0.9)ip_factor=<value>quantizer factor between I- and P-frames (default: 1.4)pb_factor=<value>quantizer factor between P- and B-frames (default: 1.3)qcomp=<0?1> (ABR or two pass)quantizer compression (default: 0.6). A lower value makes the bitrate more constant, while a higher value makes the quantization parameter more constant.cplx_blur=<0?999> (two pass only)Temporal blur of the estimated frame complexity, before curve compression (default: 20). Lower values allow the quantizer value to jump around more, higher values force it to vary more smoothly. cplx_blur ensures that each I-frame has quality comparable to the following P-frames, and ensures that alternating high and low complexity frames (e.g. low fps animation) do not waste bits on fluctuating quantizer.qblur=<0?99> (two pass only)Temporal blur of the quantization parameter, after curve compression (default: 0.5). Lower values allow the quantizer value to jump around more, higher values force it to vary more smoothly.zones=<zone0>[/<zone1>[/...]]User specified quality for specific parts (ending, credits, ...) (ABR or two pass). Each zone is <start-frame>,<end-frame>,<option> where option may beq=<0?51>quantizerb=<0.01?100.0>bitrate multiplierNOTE: The quantizer option is not strictly enforced. It affects only the planning stage of ratecontrol, and is still subject to overflow compensation and qp_min/qp_max.direct_pred=<0?3>Determines the type of motion prediction used for direct macroblocks in B-frames.None: Direct macroblocks are not used.1Spatial: Motion vectors are extrapolated from neighboring blocks. (default)2Temporal: Motion vectors are interpolated from the following P-frame.3Auto: The codec selects between spatial and temporal for each frame.Spatial and temporal are approximately the same speed and PSNR, the choice between them depends on the video content. Auto is slightly better, but slower. direct_pred=0 is both slower and lower quality.(no)weight_bUse weighted prediction in B-frames. Without this option, bidirectionally predicted macroblocks give equal weight to each reference frame. With this option, the weights are determined by the temporal position of the B-frame relative to the references. Requires bframes > 1.(no)i4x4Use additional macroblock type i4x4 (default: enabled). Without this option, P- and B-frames will use only i16x16 and the inter types specified below.(no)i8x8Use additional macroblock type i8x8 (default: enabled). This option has no effect unless 8x8dct is enabled.(no)b8x8mvUse additional macroblock types b16x8, b8x16, b8x8 (default: enabled). Without this option, B-frames will use only types i16x16, i8x8, i4x4, b16x16, skip, direct. See 4x4mv for details.(no)8x8mvUse additional macroblock types p16x8, p8x16, p8x8 (default: enabled). Without this option, P-frames will use only types i16x16, i8x8, i4x4, p16x16, skip. This option is provided for experimentation only. It is not recommended to disable 8x8mv in a real encode.(no)4x4mvUse additional macroblock types p8x4, p4x8, p4x4 (default: disabled). Without this option, P-frames will use only types i16x16, i8x8, i4x4, p16x16, p16x8, p8x16, p8x8, skip. Requires 8x8mv.The idea is to find the type and size that best describe a certain area of the picture. For example, a global pan is better represented by 16x16 blocks, while small moving objects are better represented by smaller blocks.4x4mv is recommended only with subq >= 3.(no)8x8dctAdaptive spatial transform size: allows macroblocks to choose between 4x4 and 8x8 DCT. Also allows the i8x8 macroblock type. Without this option, only 4x4 DCT is used.me=<1?4>Select fullpixel motion estimation algorithm.1diamond search, radius 1 (fast)2hexagon search, radius 2 (default)3uneven multi-hexagon search (slow)4exhaustive search (very slow, and no better than 3)me_range=<4?64>radius of exhaustive or multi-hexagon motion search (default: 16)subq=<1?7>Adjust subpel refinement quality. This parameter controls quality versus speed tradeoffs involved in the motion estimation decision process. subq=5 can compress up to 10% better than subq=1.1Runs fullpixel precision motion estimation on all candidate macroblock types. Then selects the best type. Then refines the motion of that type to fast quarterpixel precision (fastest).2Runs halfpixel precision motion estimation on all candidate macroblock types. Then selects the best type. Then refines the motion of that type to fast quarterpixel precision.3As 2, but uses a slower quarterpixel refinement.4Runs fast quarterpixel precision motion estimation on all candidate macroblock types. Then selects the best type. Then finishes the quarterpixel refinement for that type.5Runs best quality quarterpixel precision motion estimation on all candidate macroblock types, before selecting the best type (default).6Enables rate-distortion optimization of macroblock types in I- and P-frames.7Enables rate-distortion optimization of motion vectors and intra modes. (best)In the above, "all candidates" does not exactly mean all enabled types: 4x4, 4x8, 8x4 are tried only if 8x8 is better than 16x16.(no)chroma_meTakes into account chroma information during subpixel motion search (default: enabled). Requires subq>=5.(no)mixed_refsAllows each 8x8 or 16x8 motion partition to independently select a reference frame. Without this option, a whole macroblock must use the same reference. Requires frameref>1.(no)brdoEnables rate-distortion optimization of macroblock types in B-frames. Requires subq>=6.(no)bimeRefine the two motion vectors used in bidirectional macroblocks, rather than re-using vectors from the forward and backward searches. This option has no effect without B-frames.trellis=<0?2>rate-distortion optimal quantizationdisabled1enabled only for the final encode (default)2enabled during all mode decisions (slow, requires subq>=6)(no)fast_pskipPerforms early skip detection in P-frames (default: enabled). This usually improves speed at no cost, but it can sometimes produce artifacts in areas with no details, like sky.(no)dct_decimateEliminate dct blocks in P-frames containing only a small single coefficient (default: enabled). This will remove some details, so it will save bits that can be spent again on other frames, hopefully raising overall subjective quality. If you are compressing non-anime content with a high target bitrate, you may want to disable this to preserve as much detail as possible.nr=<0?100000>Noise reduction, 0 means disabled. 100?1000 is a useful range for typical content, but you may want to turn it up a bit more for very noisy content (default: 0). Given its small impact on speed, you might want to prefer to use this over filtering noise away with video filters like denoise3d or hqdn3d.chroma_qp_offset=<-12?12>Use a different quantizer for chroma as compared to luma. Useful values are in the range <-2?2> (default: 0).cqm=<flat|jvt|<filename>>Either uses a predefined custom quantization matrix or loads a JM format matrix file.flatUse the predefined flat 16 matrix (default).jvtUse the predefined JVT matrix.<filename>Use the provided JM format matrix file.NOTE: Windows CMD.EXE users may experience problems with parsing the command line if they attempt to use all the CQM lists. This is due to a command line length limitation. In this case it is recommended the lists be put into a JM format CQM file and loaded as specified above.cqm4iy=<list> (also see cqm)Custom 4x4 intra luminance matrix, given as a list of 16 comma separated values in the 1?255 range.cqm4ic=<list> (also see cqm)Custom 4x4 intra chrominance matrix, given as a list of 16 comma separated values in the 1?255 range.cqm4py=<list> (also see cqm)Custom 4x4 inter luminance matrix, given as a list of 16 comma separated values in the 1?255 range.cqm4pc=<list> (also see cqm)Custom 4x4 inter chrominance matrix, given as a list of 16 comma separated values in the 1?255 range.cqm8iy=<list> (also see cqm)Custom 8x8 intra luminance matrix, given as a list of 64 comma separated values in the 1?255 range.cqm8py=<list> (also see cqm)Custom 8x8 inter luminance matrix, given as a list of 64 comma separated values in the 1?255 range.level_idc=<10?51>Set the bitstream’s level as defined by annex A of the H.264 standard (default: 51 - Level 5.1). This is used for telling the decoder what capabilities it needs to support. Use this parameter only if you know what it means, and you have a need to set it.threads=<1?4>Split each frame into slices and encode them in parallel (default: 1). Also allows multithreaded decoding if the decoder supports it (lavc does not). This has a slight penalty to compression. Requires that libx264 was compiled with pthread support; if not, this option will produce a warning and enables slices but not multithreading.(no)globalheaderCauses SPS and PPS to appear only once, at the beginning of the bitstream (default: disabled). Some players, such as the Sony PSP, require the use of this option. The default behavior causes SPS and PPS to repeat prior to each IDR frame.log=<-1?3>Adjust the amount of logging info printed to the screen.-1nonePrint errors only.1warnings2PSNR and other analysis statistics when the encode finishes (default)3PSNR, QP, frametype, size, and other statistics for every frame(no)psnrPrint signal-to-noise ratio statistics.NOTE: The ’Y’, ’U’, ’V’, and ’Avg’ PSNR fields in the summary are not mathematically sound (they are simply the average of per-frame PSNRs). They are kept only forcomparison to the JM reference codec. For all other purposes, please use either the ’Global’ PSNR, or the per-frame PSNRs printed by log=3.(no)visualizeEnable x264 visualizations during encoding. If the x264 on your system supports it, a new window will be opened during the encoding process, in which x264 will attempt to present an overview of how each frame gets encoded. Each block type on the visualized movie will be colored as follows:red/pinkintra blockblueinter blockgreenskip blockyellowB-blockThis feature can be considered experimental and subject to change. In particular, it depends on x264 being compiled with visualizations enabled. Note that as of writing this, x264 pauses after encoding and visualizing each frame, waiting for the user to press a key, at which point the next frame will be encoded.。

相关主题