HOME > MobileHackerz Knowledgebase Wiki > xvidencopt のバックアップ(No.1) |
xvidenc (-xvidencopts)
There are three modes available: constant bitrate (CBR), fixed quantiz- er and two pass.
pass=<1|2> Specify the pass in two pass mode.
turbo (two pass only) Dramatically speeds up pass one using faster algorithms and dis- abling CPU-intensive options. This will probably reduce global PSNR a little bit and change individual frame type and PSNR a little bit more.
bitrate=<value> (CBR or two pass mode) Sets the bitrate to be used in kbits/second if <16000 or in bits/second if >16000. If <value> is negative, XviD will use its absolute value as the target size (in kBytes) of the video and compute the associated bitrate automagically (default: 687 kbits/s).
fixed_quant=<1-31> Switch to fixed quantizer mode and specify the quantizer to be used.
zones=<zone0>[/<zone1>[/...]] (CBR or two pass mode) User specified quality for specific parts (ending, credits, ...). Each zone is <start-frame>,<mode>,<value> where <mode> may be q Constant quantizer override, where value=<2.0-31.0> rep- resents the quantizer value. w Ratecontrol weight override, where value=<0.01-2.00> represents the quality correction in %.
EXAMPLE: zones=90000,q,20 Encodes all frames starting with frame 90000 at constant quantizer 20. zones=0,w,0.1/10001,w,1.0/90000,q,20 Encode frames 0-10000 at 10% bitrate, encode frames 90000 up to the end at constant quantizer 20. Note that the second zone is needed to delimit the first zone, as without it everything up until frame 89999 would be en- coded at 10% bitrate.
me_quality=<0-6> This option controls the motion estimation subsystem. The high- er the value, the more precise the estimation should be (de- fault: 6). The more precise the motion estimation is, the more bits can be saved. Precision is gained at the expense of CPU time so decrease this setting if you need realtime encoding.
(no)interlacing Encode the fields of interlaced video material. Turn this op- tion on for interlaced content. NOTE: Should you rescale the video, you would need an interlace- aware resizer, which you can activate with -vf scale=<width>:<height>:1.
4mv Use 4 motion vectors per macroblock. This might give better compression, but slows down encoding. WARNING: As of XviD-1.0.x, this option is no longer available separately, and its functionality is included in the me_quality option. When me_quality > 4, 4mv is activated.
rc_reaction_delay_factor=<value> This parameter controls the number of frames the CBR rate con- troller will wait before reacting to bitrate changes and compen- sating for them to obtain a constant bitrate over an averaging range of frames.
rc_averaging_period=<value> Real CBR is hard to achieve. Depending on the video material, bitrate can be variable, and hard to predict. Therefore XviD uses an averaging period for which it guarantees a given amount of bits (minus a small variation). This settings expresses the "number of frames" for which XviD averages bitrate and tries to achieve CBR.
rc_buffer=<value> size of the rate control buffer
quant_range=<1-31>-<1-31>[/<1-31>-<1-31>] CBR mode: min & max quantizer for all frames (default: 2-31) two pass mode: min & max quantizer for I/P-frames (default: 2-31/2-31) WARNING: As of XviD-1.0.x, this option is replaced by the [min|max]_[i|p|b]quant options.
min_key_interval=<value> (two pass only) minimum interval between keyframes (default: 0)
max_key_interval=<value> maximum interval between keyframes (default: 10*fps)
mpeg_quant Use MPEG quantizers instead of H.263. For high bitrates, you will find that MPEG quantization preserves more detail. For low bitrates, the smoothing of H.263 will give you less block noise. When using custom matrices, MPEG must be used. WARNING: As of XviD-1.0.x, this option is replaced by the quant_type option.
mod_quant Decide whether to use MPEG or H.263 quantizers on a frame-by- frame basis (two pass mode only). WARNING: This will generate an illegal bitstream, and most like- ly not be decodable by any MPEG-4 decoder besides libavcodec or XviD. WARNING: As of XviD-1.0.x, this option is no longer available.
keyframe_boost=<0-1000> (two pass mode only) Shift some bits from the pool for other frame types to intra frames, thus improving keyframe quality. This amount is an ex- tra percentage, so a value of 10 will give your keyframes 10% more bits than normal (default: 0).
kfthreshold=<value> (two pass mode only) Works together with kfreduction. Determines the minimum dis- tance below which you consider that two frames are considered consecutive and treated differently according to kfreduction (default: 10).
kfreduction=<0-100> (two pass mode only) The above two settings can be used to adjust the size of keyframes that you consider too close to the first (in a row). kfthreshold sets the range in which keyframes are reduced, and kfreduction determines the bitrate reduction they get. The last I-frame will get treated normally (default: 30).
divx5bvop Generate DivX5 compatible B-frames (default: on). This seems to be mandatory only for old versions of DivX's decoder. WARNING: As of XviD-1.0.x, this option is replaced by the closed_gop option.
(no)greyscale Make XviD discard chroma planes so the encoded video is greyscale only. Note that this does not speed up encoding, it just prevents chroma data from being written in the last stage of encoding.
debug Save per-frame statistics in ./xvid.dbg. (This is not the two pass control file.)
The following options are only available with the latest stable releas- es of XviD 1.0.x (api4).
(no)packed This option is meant to solve frame-order issues when encoding to container formats like AVI that cannot cope with out-of-order frames. In practice, most decoders (both software and hardware) are able to deal with frame-order themselves, and may get con- fused when this option is turned on, so you can safely leave if off, unless you really know what you are doing. WARNING: This will generate an illegal bitstream, and will not be decodable by ISO-MPEG-4 decoders except DivX/libavcodec/XviD. WARNING: This will also store a fake DivX version in the file so the bug autodetection of some decoders might be confused.
max_bframes=<0-4> Maximum number of B-frames to put between I/P-frames (default: 2).
bquant_ratio=<0-1000> quantizer ratio between B- and non-B-frames, 150=1.50 (default: 150)
bquant_offset=<-1000-1000> quantizer offset between B- and non-B-frames, 100=1.00 (default: 100)
bf_threshold=<-255-255> This setting allows you to specify what priority to place on the use of B-frames. The higher the value, the higher the probabil- ity of B-frames being used (default: 0). Do not forget that B- frames usually have a higher quantizer, and therefore aggressive production of B-frames may cause worse visual quality.
(no)closed_gop This option tells XviD to close every GOP (Group Of Pictures bounded by two I-frames), which makes GOPs independent from each other. This just implies that the last frame of the GOP is ei- ther a P-frame or a N-frame but not a B-frame. It is usually a good idea to turn this option on (default: on).
frame_drop_ratio=<0-100> (max_bframes=0 only) This setting allows the creation of variable framerate video streams. The value of the setting specifies a threshold under which, if the difference of the following frame to the previous frame is below or equal to this threshold, a frame gets not cod- ed (a so called n-vop is placed in the stream). On playback, when reaching an n-vop the previous frame will be displayed. WARNING: Playing with this setting may result in a jerky video, so use it at your own risks!
(no)qpel MPEG-4 uses a half pixel precision for its motion search by de- fault. The standard proposes a mode where encoders are allowed to use quarter pixel precision. This option usually results in a sharper image. Unfortunately it has a great impact on bitrate and sometimes the higher bitrate use will prevent it from giving a better image quality at a fixed bitrate. It is better to test with and without this option and see whether it is worth acti- vating.
(no)gmc Enable Global Motion Compensation, which makes XviD generate special frames (GMC-frames) which are well suited for Pan/Zoom/ Rotating images. Whether or not the use of this option will save bits is highly dependent on the source material.
(no)trellis Trellis Quantization is a kind of adaptive quantization method that saves bits by modifying quantized coefficients to make them more compressible by the entropy encoder. Its impact on quality is good, and if VHQ uses too much CPU for you, this setting can be a good alternative to save a few bits (and gain quality at fixed bitrate) at a lesser cost than with VHQ (default: on).
(no)cartoon Activate this if your encoded sequence is an anime/cartoon. It modifies some XviD internal thresholds so XviD takes better de- cisions on frame types and motion vectors for flat looking car- toons.
quant_type=<h263|mpeg> Sets the type of quantizer to use. For high bitrates, you will find that MPEG quantization preserves more detail. For low bi- trates, the smoothing of H.263 will give you less block noise. When using custom matrices, MPEG quantization must be used.
(no)chroma_me The usual motion estimation algorithm uses only the luminance information to find the best motion vector. However for some video material, using the chroma planes can help find better vectors. This setting toggles the use of chroma planes for mo- tion estimation (default: on).
(no)chroma_opt Enable a chroma optimizer prefilter. It will do some extra mag- ic on color information to minimize the stepped-stairs effect on edges. It will improve quality at the cost of encoding speed. It reduces PSNR by nature, as the mathematical deviation to the original picture will get bigger, but the subjective image qual- ity will raise. Since it works with color information, you might want to turn it off when encoding in greyscale.
(no)hq_ac Activates high-quality prediction of AC coefficients for intra frames from neighbor blocks (default: on).
vhq=<0-4> The motion search algorithm is based on a search in the usual color domain and tries to find a motion vector that minimizes the difference between the reference frame and the encoded frame. With this setting activated, XviD will also use the fre- quency domain (DCT) to search for a motion vector that minimizes not only the spatial difference but also the encoding length of the block. Fastest to slowest: 0 off 1 mode decision (inter/intra MB) (default) 2 limited search 3 medium search 4 wide search
(no)lumi_mask Adaptive quantization allows the macroblock quantizers to vary inside each frame. This is a 'psychosensory' setting that is supposed to make use of the fact that the human eye tends to no- tice fewer details in very bright and very dark parts of the picture. It compresses those areas more strongly than medium ones, which will save bits that can be spent again on other frames, raising overall subjective quality and possibly reducing PSNR.
min_iquant=<0-31> minimum I-frame quantizer (default: 2)
max_iquant=<0-31> maximum I-frame quantizer (default: 31)
min_pquant=<0-31> minimum P-frame quantizer (default: 2)
max_pquant=<0-31> maximum P-frame quantizer (default: 31)
min_bquant=<0-31> minimum B-frame quantizer (default: 2)
max_bquant=<0-31> maximum B-frame quantizer (default: 31)
quant_intra_matrix=<filename> Load a custom intra matrix file. You can build such a file with xvid4conf's matrix editor.
quant_inter_matrix=<filename> Load a custom inter matrix file. You can build such a file with xvid4conf's matrix editor.
curve_compression_high=<0-100> This setting allows XviD to take a certain percentage of bits away from high bitrate scenes and give them back to the bit reservoir. You could also use this if you have a clip with so many bits allocated to high-bitrate scenes that the low(er)-bi- trate scenes start to look bad (default: 0).
curve_compression_low=<0-100> This setting allows XviD to give a certain percentage of extra bits to the low bitrate scenes, taking a few bits from the en- tire clip. This might come in handy if you have a few low-bi- trate scenes that are still blocky (default: 0).
overflow_control_strength=<0-100> During pass one of two pass encoding, a scaled bitrate curve is computed. The difference between that expected curve and the result obtained during encoding is called overflow. Obviously, the two pass rate controller tries to compensate for that over- flow, distributing it over the next frames. This setting con- trols how much of the overflow is distributed every time there is a new frame. Low values allow lazy overflow control, big rate bursts are compensated for more slowly (could lead to lack of precision for small clips). Higher values will make changes in bit redistribution more abrupt, possibly too abrupt if you set it too high, creating artifacts (default: 5). NOTE: This setting impacts quality a lot, play with it careful- ly!
max_overflow_improvement=<0-100> During the frame bit allocation, overflow control may increase the frame size. This parameter specifies the maximum percentage by which the overflow control is allowed to increase the frame size, compared to the ideal curve allocation (default: 5).
max_overflow_degradation=<0-100> During the frame bit allocation, overflow control may decrease the frame size. This parameter specifies the maximum percentage by which the overflow control is allowed to decrease the frame size, compared to the ideal curve allocation (default: 5).
container_frame_overhead=<0...> Specifies a frame average overhead per frame, in bytes. Most of the time users express their target bitrate for video w/o taking care of the video container overhead. This small but (mostly) constant overhead can cause the target file size to be exceeded. XviD allows users to set the amount of overhead per frame the container generates (give only an average per frame). 0 has a special meaning, it lets XviD use its own default values (de- fault: 24 - AVI average overhead).
profile=<profile_name> Restricts options and VBV (peak bitrate over a short period) ac- cording to the Simple, Advanced Simple and DivX profiles. The resulting videos should be playable on standalone players adher- ing to these profile specifications. unrestricted no restrictions (default) sp0 simple profile at level 0 sp1 simple profile at level 1 sp2 simple profile at level 2 sp3 simple profile at level 3 asp0 advanced simple profile at level 0 asp1 advanced simple profile at level 1 asp2 advanced simple profile at level 2 asp3 advanced simple profile at level 3 asp4 advanced simple profile at level 4 asp5 advanced simple profile at level 5 dxnhandheld DXN handheld profile dxnportntsc DXN portable NTSC profile dxnportpal DXN portable PAL profile dxnhtntsc DXN home theater NTSC profile dxnhtpal DXN home theater PAL profile dxnhdtv DXN HDTV profile NOTE: These profiles should be used in conjunction with an ap- propriate -ffourcc. Generally DX50 is applicable, as some play- ers do not recognize XviD but most recognize DivX.
par=<mode> Specifies the Pixel Aspect Ratio mode (not to be confused with DAR, the Display Aspect Ratio). PAR is the ratio of the width and height of a single pixel. So both are related like this: DAR = PAR * (width/height). MPEG-4 defines 5 pixel aspect ratios and one extended one, giv- ing the opportunity to specify a specific pixel aspect ratio. 5 standard modes can be specified: vga11 It is the usual PAR for PC content. Pixels are a square unit. pal43 PAL standard 4:3 PAR. Pixels are rectangles. pal169 same as above ntsc43 same as above ntsc169 same as above (Do not forget to give the exact ratio.) ext Allows you to specify your own pixel aspect ratio with par_width and par_height. NOTE: In general, setting aspect and autoaspect options is enough.
par_width=<1-255> (par=ext only) Specifies the width of the custom pixel aspect ratio.
par_height=<1-255> (par=ext only) Specifies the height of the custom pixel aspect ratio.
aspect=<x/y | f (float value)> Store movie aspect internally, just like MPEG files. Much nicer solution than rescaling, because quality is not decreased. MPlayer and a few others players will play these files correct- ly, others will display them with the wrong aspect. The aspect parameter can be given as a ratio or a floating point number.
(no)autoaspect Same as the aspect option, but automatically computes aspect, taking into account all the adjustments (crop/expand/scale/etc.) made in the filter chain.
psnr Print the PSNR (peak signal to noise ratio) for the whole video after encoding and store the per frame PSNR in a file with a name like 'psnr_hhmmss.log' in the current directory. Returned values are in dB (decibel), the higher the better.
The following option is only available in XviD 1.1.x.
bvhq=<0|1> This setting allows vector candidates for B-frames to be used for the encoding chosen using a rate distortion optimized opera- tor, which is what is done for P-frames by the vhq option. This produces nicer-looking B-frames while incurring almost no per- formance penalty (default: 1).
The following option is only available in the CVS version of XviD.
threads=<0-n> Create n threads to run the motion estimation (default: 0). The maximum number of threads that can be used is the picture height divided by 16.