Pフレームの量子化値を固定。I/Bフレームの量子化値は --ipratio と --pbratio の指定値を元にここから計算される。XviDでは量子化値が低いほど画質が良かったが、XviDのQP2はx264のQP18に相当するので注意が必要だ。これはH.264規格が対数尺(*logarithmic scale*)を使っているから。概算の換算式は、QP AVC qp = 12 + 6*log2(ASP qp)。0でロスレスになる。
*1パス画質固定エンコードにはCRFの方が向いている。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--qp
Usage: --qp <integer> (default=26) [1 - 51] (0 = Lossless)
This sets a constant P-frame quantizer. The quantizer for I and B-frames are then calculated by the QP factor set in --ipratio and --pbratio. As with XviD, the lower the quantizer, the higher the quality, but this one of the features that I warned you about. QP 2 in x264 is NOT like QP 2 in XviD, in fact the equivalent to XviD's QP 2 in x264, is QP 18. This is owing to H.264 using a logarithmic scale. The formula to find the approximate equivalent QP is as follows: QP AVC qp = 12 + 6*log2(ASP qp). x264 is also capable of lossless encoding, to enable this mode set the QP to 0.
・default値のQ値には少し不満が出る。
過去のコーダ同様に、少しビットレートを増やす程度に変更すると、納得いくかもしれない。
画質と容量とを、自分の用途にあわせて煮詰め、Q値を設定したい。
30より大きい数字は、劣化具合がカナリ強くなる傾向になる。気をつけよう。
平均ビットレートで使うビットレートの指定。単位はキロビット/second ( kbps )。
特定のファイルサイズに収めたければ2パスを推奨。画質と特定のファイルサイズを両立できる。概ね1分以下の短いクリップでは3パスが有効かもしれない。x264の--bitrateは本質的にABR(平均ビットレート)だ。ストリーミング以外にCBR(固定ビットレート)を使う理由はあまり無いが、使う場合は--vbv-maxrateも調整すること。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--bitrate
Usage: --bitrate <integer> (default=off)
Allows you to specify an average bitrate in kilobits per second (Kbps). If you are trying to meet a filesize, it is recommended you use 2 pass encoding, this will increase quality as well as help you meet the target bitrate. For short clips around 1 minute or less, a third pass may be beneficial. x264's --bitrate is inherently ABR, if you must use CBR (there are few goods reasons for this other than streaming) then you will need to change the --vbv-maxrate accordingly.
Constant Rate Factor。名目上のQPに基づく1パス ABR。
*Zero1氏原文では整数指定だが、今回元にしたrev. 663では<float>、少数。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--crf
Usage: --crf <integer> (default=off) [1 - 51]
Constant Rate Factor. This is a one pass VBR mode based on a nominal QP.
保存用で普通に1passQ値エンコさせるなら、こちらを使ったほうが、感じいい気がします。
ローカルビットレートの最大値。単位はkbits/second。
CBRモードを起動して、VBVバッファサイズを指定する(kbit)
VBVバッファ占有率の初期値。
x264が使う最小quantizerの指定。
高いquantizerを使ってもあまり見た目が変わらない場面でbitの浪費を抑える。XviDで最小quantizerを2にするようなものだが、H.264との量子化スケーリングの違いを忘れない事。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--qpminSimply sets the minimum quantizer that x264 is allowed to use. This will prevent bit squandering where using a higher quantizer makes little or no visual difference. This is similar to using XviD in as much that you used to cap the minimum quantizers at 2, but do bear in mind the differences in quantization with H.264.
・--qpmin,--qpmaxで設定された可能な範囲で、--bitrateを実現させようとエンコする。
だから。指定しない方が、融通は利く。
しかし、マックス値を制限させた方が、画質は安定傾向になる。
max値を無理が無いように、美味く設定したい
x264が使う最大quantizerの指定。
quantizerが自分の好みより高くなるフレームがあったらこれでキャップをかけることができる。一般的にx264のレートコントロールはとても優秀で、キチガイじみて高い/低い量子化値を使う事はあまりない。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--qpmax
Usage: --qpmax<integer> (default=51) [1 - 51]
Sets the maximum quantizer that x264 is allowed to use. You can cap this if you find that some frames are being quantized too high for your liking. In general the ratecontrol of x264 is very good and won't tend to use insanely high or low quants.
隣接フレーム間におけるquantizerの変動幅を調整。理論上、大きくするとquantizerの変動幅が大きくなり、短い間隔で画質がおおきく変動する。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--qpstep
Usage: --qpstep <integer> (default=4) [1 - 50]
This controls the maximum amount by which the quantizer may change between frames. Setting a large value will in theory allow the quantizer to fluctuate more between frames, in turn producing a large variation in quality in a short time.
・適用Q値の変化できる、Q値幅。
明るいシーン → 暗いシーン となったときなどで、ビットレート変化を
大幅に行ってほしいのであれば、この数値を増やしておく。
漏れ個人が考えるに、このdefault値4って、小さいなと考えます。
*なるPさんはアニメで8程度を使っている模様。
Allowed variance of average bitrate
範囲:0.1-100.0
ABRにおけるビットレートの逸脱許容範囲。1.0より大きくするとファイルサイズが目標より大きくなる事がある。同様に1.0より小さくすると目標より小さくなる事がある。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--ratetol
Usage: --ratetol <float> (default=1.0) [0.1 - 100.0]
Defines the allowed deviation in the average bitrate. Setting it higher than 1.0 may result in files larger than your target, and likewise setting it less than 1.0 may result in undersized files.
I-Pフレーム間のquantizer換算係数。
1.00でPとIに同じquantizerを使う。これは推奨しない。bitの無駄に等しいからだ。素材のAMV(*アニメ・ミュージック・ビデオ*)があまりBフレームを生成しないようだったら1.40より高くしても良いだろう。Pフレームの画質を落とす事になるが(その程度は--ipratioの指定値による)、その代わりハイ・モーション・エリアなどで画質のバラツキやブロックノイズが減り、安定する。
*ハイ・モーション・エリア:動きの多い部分。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--ipratio
Usage: --ipratio <float> (default=1.40)
Defines the quantizer factor between I and P frames. Setting this to 1.00 will mean that P frames will get the same quantizer as I frames which is not recommended because it amounts to wasting bits. You could try setting this above 1.40 if you find your AMV isn't making much use of B-frames, this should decrease the quality of the P-frames (how much is dependant on the --ipratio) but in turn result in a more consistant quality, as opposed to it fluctuating and blocking in high motion areas etc.
I-Pフレーム間のquantizer換算係数。
ここでも、1.00でPとBに同じquantizerを使う。--ipratioも1.00なら I, P, Bが全て同じ量子化値を使う。一般的にBフレームはPフレームよりもっと高い量子化値を使っても良いので、ここは1.30より高くしたいケースもあるだろう。特に--brdo (VHQ for B-frames)を使っている場合とか。I, P, Bフレームをどのくらい使ったかはエンコード終了後、コンソールに表示される。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--pbratio
Usage: --pbratio <float> (default=1.30)
Sets the quantizer factor between P and B frames. Again, setting to 1.00 will cause B frames to be quantized the same amount as P frames, and therefore is --ipratio is set at 1.00, I, P and B-frames will all be quantized equally. In general you can compress B frames even more than P frames, so you might want to try values higher than 1.30, particularly if you enable --brdo (VHQ for B-frames). I, P and B-frame usage is printed in the console when the encode is complete.
彩度情報と輝度情報に別のquantizerを使う。人間の視覚認識をダマすと言う点で面白いオプションだ。人間の視覚は輝度変化に比べると彩度変化の認識が鈍い。しかし、YV12素材では彩度情報は既に間引かれているので僅かな輝度画質の向上のために大量の彩度情報を捨てる事になる。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--chroma-qp-offset
Usage: --chroma-qp-offset <integer> (default=0) [-12 - 12]
Allows you to use a different quantizer for Chroma as opposed to Luma. This is an interesting option because it allows you to exploit the human visual system, since it is more sensitive to changes in luma than chroma. The downside though, is because the chroma has less information to start with, what with it being subsampled for YV12, is that you have to sacrifice a lot of chroma quality in return for a little luma quality.
・色部分(chroma U・V)を輝度部分(LUMA)とQの差を発生させて、エンコする事ができる。
基本的には、差を用意したいのであれば、マトリクス側で行えば用が足りる。
マトリクスをLUMA・CHROMA間で差を用意していないのであれば、このオプションを使ってもいいかもしれない。
--pass
マルチパスモードの起動。
XviDで馴染みのある1st, 2ndに、"nth pass" というものが加わっている。これはまず1stパスで統計を取り、次に"nth pass" を走らせるというものだ。そしてもし結果が気に入らなかったり目標ファイルサイズに合わなかったら、2回目のパスで使った設定でもう一回走らせる事ができる。この場合"nth pass"は3回目のパスを行う。"nth pass"を走らせる度に統計ファイルはアップデートされてゆく。一方2nd passは最終出力専用で統計ファイルをアップデートしない。
--pass 1
映像を分析してstats(*統計*)をファイルに書き出す。XviDの "2 pass - First pass" のようなものだ。デフォルトではこのオプションはmuxできるファイルを書き出す。ビットレートを指定してあれば1 pass ABRに --qp 18 を指定してあればXviDの first pass modeの最高画質とほぼ同等の画質になる。一般的には--pass 1はビットレート指定の方が後続パスの画質が良くなる。
--pass 2
--pass 1で作った統計ファイルの内容に応じてレートコントロールを行った映像を出力する。このモードはXviDの "2 pass - Second pass" に相当し、統計ファイルのアップデートはしない。よりよい画質とより小さなファイルサイズになるので、一般的には2パスがお奨めだ。内部動作を視覚化する方法は後述。
(1回目) --pass 1 = 最初の統計ファイルを作る
(2回目) --pass 2 = 1回目 の統計を使って出力
--pass 3
--pass 3
はやや特別で、「3回目に走らせるパス」という意味ではない。何回でも走らせる事ができる。画質向上は大した事がないので10パスとか試みないように。これはおおむね1000フレーム以下の短い素材、即ちビットレートの平均をうまくだすには短すぎる素材に向いている。--pass 3は--pass 1と--pass 2を合わせたようなもので、--pass 1の統計を読み込み、それを参考にファイルを書き出しつつ、同時に統計ファイルにアップデートをかける。つまり "nth pass" モードを使ってエンコードすると、2回目のパスより良い統計ファイルを使う事ができるわけだ。これは内部動作を視覚化すると解り易い。視覚化(*--visualize*)は1回目の統計ファイルをベースにするが2回目を走らせるとそのリファインぶりを確かめることができる。
(1回目) --pass 1 = 最初の統計ファイルを作る
(2回目) --pass 3 = 1回目 の統計を使って出力 + 統計ファイルのアップデート
(3回目) --pass 3 = 2回目 の統計を使って出力 + 統計ファイルのアップデート
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--pass
Usage: --pass <1|2|3>
This is where you enable multi pass mode. In addition to first and second pass as you will be familliar with from using XviD, it also features "nth pass". This means that you can run a first pass to collect the stats, then run the nth pass to give you the second pass. If you are not happy with the results, or are not meeting the filesize, you can run the settings you used for the second pass again, and nth pass now does a pass 3. Nth pass works by updating the stats file each time, 2nd pass just performs a final pass and doesn't update the stats.
--pass 1
Pass 1 is the where the video is analysed and the stats are written to
a file. This is just like the "2 pass - First pass" mode in XviD. By
default this outputs a muxable file that you can use. If you specify
the bitrate at this stage it will produce a 1 pass ABR, if you use --qp
18 instead, it will output a file which should be visually the same as
XviD's full quality first pass mode. Specifying the target bitrate at
this stage as opposed to using --qp 18 will usually result in a better
quality 2nd and nth pass.
--pass 2
Pass 2 generates output based on the complexity stats collected by the
first pass, and makes ratecontrol decisions based on this. This mode is
equivalent to "2 pass - Second pass" in XviD, and does not update or
modify the stats file. 2 pass usually brings about higher quality and
lower filesizes and is always recommended. To visualise how it works,
see below.
(Pass 1) --pass 1 = Initial stats collection
(Pass 2) --pass 2 = Output using Pass 1 stats
--pass 3
--pass 3 is somewhat special. It isn't referred to as Second or Third
pass, since the amount of passes you can do with it are infinate. The
quality gain isn't, so don't go doing 10 pass encodes. It is really
only useful for sources around 1000 frames or less where it doesn't
have much time to average the bitrate properly. It essentially does the
job of -pass 1 and --pass 2, but pass 1 is still required for initial
stats collection. Instead of just reading from the stats file and
providing output, it reads from the stats file, outputs and updates it.
This means that if you do a 3 pass encode using the nth pass mode, it
will be using refined stats from pass 2. The easy way to understand
this is to visualise it.it will work from the stats from pass 1 that
have been refined when you ran pass 2.
(Pass 1) --pass 1 = Initial stats collection
(Pass 2) --pass 3 = Output using Pass 1 stats + update stats file
(Pass 3) --pass 3 = Output using Pass 2 stats + update stats
file
マルチパスエンコードで使う統計ファイルの場所を名前を指定。全てのパスが同じログファイルを参照しない限り、正しく動作しない。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--stats
Usage: --stats <string> (default="x264_2pass.log")
Simply specify the location and file name of the log file to be used in multi pass encoding. All passes must refer to the same logfile otherwise it will not work correctly.
QP curve compression(*QPカーブコンプレッション*)。
低くするとビットレートの変動幅が減り、0.00でCBRになる。高くするとquantizerの変動幅が減り、1.0でCQPになる。
推奨はデフォルトの0.60のまま。特にAMVでは0.00のCBRは非常に良く無い。ローモーション/複雑さの少ない場面でbitを節約して、ハイモーション/複雑な場面に回すx264のレートコントロール機能を阻害するからだ。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--qcomp
Usage: --qcomp <float> (default=0.60) [0.00 - 1.00]
This is QP curve compression. Setting lower values will result in a more constant bitrate encode, 0.00 should be CBR. Higher values will result in a more constant QP encode. It is suggested to use the default of 0.60. Setting 0.00 for CBR is a very bad idea, especially for AMVs, because you cripple the encoders ability to use rate control, which saves bits in low motion/complexity areas, and re-allocates them to high motion/complexity areas.
フレームの複雑さを見積り、それに応じた時間軸スムージングを行うもの。カーブコンプレッションの前に時間軸上のQPのバラツキを抑えるのに使う。低くするとQPの変動幅が増え、高くするとQPの変動幅がスムースになる。このオプションは統計ファイルを使う為、有効なのはtwo and nth パスモードだけだ。わからなかったらデフォルトの20.0のままにしておくのが良い。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--cplxblur
Usage: --cplxblur <float> (default=20.0) [0 - 999]
--cplxblur controls the temporal smoothing of the estimated frame complexity and is used to reduce fluctuations in QP over time before curve compression. Setting this value low will allow the QP to fluctuate more, and setting it high would cause the QP to vary smoothly. This option is only applicable for two and nth pass mode since it makes use of the stats file. Unless you understand this option, you should leave it at the default 20.0
映像の特定部分のビットレート調整。
ゾーンの指定書式は
<start frame>,<end frame>,<option>
<option>の中身は
q=<integer> (QPの強制)
または b=<float> (ビットレートの係数)。/で区切ると複数のゾーン指定ができる。
例:
--zones 200,900,b=0.50/1000,1200,b=2.0
これでフレーム番号200-900の区間のビットレートは平均の約半分に、フレーム番号1000-1200の区間のビットレートが平均の概ね倍になる。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#rate-control
--zonesZones allows you to override bitrate or quantizer at a certain point in the video. A zone is specified as:
Start frame, End frame, Option
Options are q=<integer> (forced QP) or b=<float> (bitrate multiplier).
To start a new zone you need a "/" before the new one begins. To see an example:
--zones 200,900,b=0.50/1000,1200,b=2.0
This means that frames 200 through to 900 will use approximately half the specified average bitrate, and frames 1000 to 1200 will use twice the average bitrate.