最大GOP(Group Of Pictures)サイズ。新しいIDRが強制挿入され、次のGOPが始まる前に連続するフレーム数の上限を指定する。XviDの "Maximum I-frame Interval" に相当するだろう。経験的に10秒分のフレーム数を指定してシーク単位にする人が多い。PAL @ 25 fps なら --keyint 250、NTSC @ 23.976 fps ならちょっと丸めて --keyint 240だ。一般的にGOPは--keyintの指定値を超えない限りは場面転換で始まる。だからこのスイッチを弄る価値があるのは、映像に場面転換や大き な変化が無いなが~い素材だけだ(AMVではそういうのはまず無い)。
*AMV:アニメ・ミュージック・ビデオ。全体的にこのガイドアニメ寄り。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--keyint
Usage: --keyint <integer> (default=250)
This is the maximum GOP (Group Of Pictures) value. It controls the maximum number of frames allowed before a new IDR frame is forced and starts a new GOP. The equivalent to this that you would find in XviD would be "Maximum I-frame Interval". As a rule of thumb people tend to set this at 10 seconds worth of frames to aid seeking. For PAL @ 25 fps it would be --keyint 250, or for NTSC @ 23.976 fps we would just round up and use --keyint 240. A new GOP will usually begin at a scene change, unless the --keyint value is exceeded, so this only really applies for sources with long durations without a scene change or significant change in the image (which will almost never happen in an AMV).
Minimum GOP size
範囲:
最小GOP(Group Of Pictures)サイズ。新しいIDRが強制挿入され、次のGOPが始まる前に連続するフレーム数の下限を指定する。--min-keyintの値より短い間隔で場面転換があったら、x264は場面転換をIフレームとしてエンコードし、新しいGOPを開始しない。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--min-keyint
Usage: --min-keyint <integer> (default=25)
This is the minimum GOP (Group Of Pictures) value. This specifies the minimum number of frames allowed before a new IDR frame and GOP is forced. If a scene change happens within the --min-keyint value, it will simply code the first frame of the scene change as an I frame and prevent it from starting a new GOP.
2007/07/15(日) x264 [15] --b-rdoより
--min-keyint 15 # x264 内部で 8=(15+1)/2 に丸められるので意味がない
*MEncoderのkeyint_min=<1-keyint/2>ってそういう意味だったのか!
How aggressively to insert extra I-frames
範囲:1 - 100
追加的なIフレームを挿入する際の閾値。高くするとたくさん入るが、不必要に入ってbitが無駄になるかもしれない。例えば場面転換と 言うほどでもない画面の変化など。低くするとIの挿入頻度が減るが、やりすぎると --keyint 指定値への依存度が上がって適正箇所にIが入らない。例えば場面転換に非常に大きいPフレームが入るなど(Pは先行するIかPが無いとデコードできない)。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--scenecut
Usage: --scenecut <integer> (default=40) [1 - 100]
Scenecut is the threshold for inserting extra I-frames. Setting a high value will cause it to use I-frames where they perhaps aren't needed (and in turn waste bits), for example a considerable change in the image, but not significant enough to be considered a scene change. Setting the value lower will use fewer I-frames and will rely more on the --keyint value which may end up in non optimal placement of I-frames, for instance you might get a very large P-frame at scene change instead of an I-frame (and P-frames require previous I or P frames to be decoded).
・漏れ自身が勝手に思うに、アニメOPで適当にキーフレームぶち込まれるには、
--scenecut 75ぐらいかなと、感じている。
アニメ作業するなら少なくとも、60ぐらいを使ってもいい気がする。…(3)
default値である40だと、少々足りないということだ。
Faster, less precise scenecut detection.
Required and implied by multi-threading.
高速だがやや不正確な場面転換検出。
マルチスレッドの際に必要となり、使用される。
*自動で切り替わるようにも読める。MEncoderには存在しない。
--threads が 1 よりも大きい場合は pre_scenecut が有効になって(*以下略*)とある。特に意識する必要はなさそう。
Number of B-frames between I and P
範囲:0-16
適正範囲:3~4、--no-b-adapt使用時は0か1
I・Pフレームの間に入るBフレームの最大連続数。
Xvidや他のMPEGエンコーダでBフレームには慣れている人は多いと思う。Xvid でこれに相当するオプションは"Max consecutive B-VOPs"。Bフレームは非常に符号化効率が良いが、たくさん使う程デコード負荷が上がる事に注意。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--bframes
Usage: --bframes <integer> (default=0) [0 - 16]
This simply controls the maximum number of consecutive B-frames between I and P frames. You will be familliar with B-frames from using XviD (and perhaps other MPEG encoders). The same option in XviD is reffered to as "Max consecutive B-VOPs". While B-frames are very nice from a coding efficiency point of view, bear in mind that the more get used, the higher the decoding requirements will be.
このオプションは適応的Bフレーム挿入をdisableにするもの。一般的にはオフはお奨めできない。デフォルトではx264がどこにどれだけのBフレームを使うか自動で決める。最大で何枚使うかは--bframesで決まる。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--no-b-adapt
Usage: --no-b-adapt (default=on)
This option disables adaptive B-frame decision and is generally not recommended. When not disabled (it's enabled by default and --no-b-adapt turns it off) this allows the encoder to automatically decide where B-frames will be used and how many. How many B-frames adaptive B-frame decision will use is defined by --bframes as above.
Influences how often B-frames are used
範囲: -100 - 100
適正範囲:0 (def)
適応的Bフレームの挿入に影響。高いほどBフレームを沢山使う。上限は--bframesで指定した値。低いほどたくさん間引く。Xvid でのB-VOP sensitivityに相当。-100から+100までのスライダがあると思えば良いだろう。-方向がBを減らし、+方向がBを沢山使う。推奨はデフォルトの0(またはスクリプトに書かない)。というのはB使用を強制すると画質が悪くなる事があるからだ。特に暗い領域やフレームで多い。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--b-bias
Usage: --b-bias <integer> (default=0) [-100 - 100]
--b-bias affects adaptive B-frame decision. A higher number will result in using more B-frames up to the specified maximum and the lower number will use less B-frames. There is a similar option to this in XviD called B-VOP sensitivity. You can visualise this as a slider, with -100 at the left with a label "Use less B-frames" and 100 on the right labelled "Use more B-frames". It is recommended to leave --b-bias at 0 (or simply leave it out from your script) since forcing B-frames can be sub-optimal, particularly with trouble sources like dark areas or flames.
Keep some B-frames as references
範囲:-
一部のBフレームを参照フレームに使えるようにする。他のフレームがBを参照できるようになるので符号化効率があがる。2枚以上のBフレームが必要で、デコーダー・ラグが2になる事がある。この機能はデフォルトではオフ。コマンドラインに --b-pyramid と追加すると使えるようになる。
*Decoding Delayについて
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--b-pyramid
Usage: --b-pyramid (default=off)
This allows the encoder to use some B-frames as references. This should help increase efficiency since other frames can now be predicted using B-frames. This feature requires 2 or more B-frames, and may cause a 2 frame decoder lag.
Disable CABAC
CABACはエントロピー符号化で、マクロブロック情報を扱うもの。
マクロブロックのヘッダ、テクスチャ、モーションベクトルといった情報をロスレスにビットストリームに圧縮する。ビットレートにして約10%の削減が可能で、アニメではもっと期待出来る。そのかわりエンコード・デコードとも負荷が増えるが、画質に影響しない事を考えると10%はとても魅力的だ。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--no-cabac
Usage: --no-cabac (default=on)
CABAC (Context-Adaptive Binary Arithmetic Coding) is an entropy encoder. What it does is take the macroblock information, their headers, textures, motion vectors and compresses it to the bitstream losslessly. CABAC can save approximately 10% on bitrate, and possibly more for anime. The downside is that it increases encoding and decoding requirements, however a 10% bitrate reduction is a significant advantage considering it doesn't degrade quality.
Number of reference frames
範囲:1 - 16
参照フレームの数を指定。
これにより、P/Bフレームの予測に使う参照フレームを、デコード済みフレームをさかのぼって選べるようになる(指定した枚数まで)。
高くすると一定ポイントまで圧縮効率があがる。これは原理的にアニメに非常に効果的だ。というのは、キャラクタが喋る時に口だけが同じような動きを繰り返してあとは変化しない場面、とか、風になびく髪のように同じ動きがループするような場面はよくあるから。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--ref
Usage: --ref <integer> (default=1) [1 - 16]
This is for setting the number of reference frames. It allows new P and B frames to be predicted by using a previously decoded frames (up to the number specified in --ref). Setting a higher value will increase efficiency up to a point. Naturally this is a very beneficial feature for anime since you often get many similar frames say for when a character is speaking and only the mouth is changing, or for loops where something is repeated like hair swaying in the wind.
http://www.marumo.ne.jp/db2007_7.htm#10
H.264 では、MPEG-1/2/4 までとは異なり、動き補償 (予測) の際に複数の参照フレームを利用することができる。x264 の --ref オプションでは、何枚のフレームを参照するかを指定するためのもの。
複数参照フレームが最も効果を発揮するのはフラッシュが多用されている映像。次に効果が出るのは背景の上で物体が動いてるような場合。直前フレームにはボールがあったけど、現在のフレームでは背景だけになっている部分。専門用語でこーゆーのを uncovered background (覆いがはずれた背景) とか呼ぶのだけど、これは複数参照フレームでさらに前のフレームを参照してしまえばよく似た部分が見つかる。
規格上、参照フレームはMB全体の他に8x8 サブブロック単位で別々の参照フレームを見ることもできる。--mixed-refs はその切り替えオプション。
フラッシュのシーンだけ救えれば十分だという場合は --mixed-refs を指定する必要はないだろうけど、uncovered backgroud を救いたい場合は --mixed-refs を指定した方がよいはず。MB の一部だけに差し掛かる物体の場合は 8x8 単位で別々の参照フレームを使えた方がより効率の良い符号化ができるはずなので。
まるも製作所:2007/07/15(日) x264 [15] --b-rdoより
--ref 1 # 参照フレームは 1 枚に制限 (マルチレフ無効)
インループ・デブロッキングのオフ。-f, --deblockの項参照。
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--nf
Usage: --nf (default=on)
Disables inloop deblocking. Read --filter below for more information
デブロックフィルタ使ってると、細部が潰れるので気になるときがある。
そういう時は、コレ使ってデブロックフィルタ切ったほうがいいかもしれない。
通常、インループ・デブロッキングは圧縮効率、ひいては画質の向上になる。効果が気に入らない時は単に値を下げると良い。このオプションのねらいは、Xvidのハイモーション箇所で見られたようなブロックノイズのスムーシングだ。AlphaC0 は強度、Betaは閾値。デフォルトの0:0は最適値として考えられたものだが、Sharktoothによればアニメは3:3が良いとの事。短いクリップをいくつか用意して実験すると良いだろう。
*参考:まるも製作所さんの日記『07/07/31(火) H.264/AVC のデブロックフィルタ詳細』
http://aflux.deltaanime.net/Zero1/MP4/x264.html#frame-type-options
--filter
Usage: --filter <alpha:beta> (default=0:0) [-6:-6 - 6:6]
The inloop deblocking usually improves compressability and therefore quality. If you do not like the effect simply turn it down. What it tends to do is smooth an image as opposed to letting it block in high motion areas like you may have seen in XviD. The AlphaC0 parameter controls the strength, and Beta controls the threshold. The default value of 0:0 is thought to be optimal, although Sharktooth has suggested to me that anime would look good at 3:3. Experiment on short varied clips and see what works for you.
*x264はインターレースにMBAFFを使う。PicAFFは無い。
*インタレ保持