高速1st passモード。
2(以上)パスエンコードの1stパスは、取るに足りない、あるいは、最終出力品質に影響しないオプションを切って高速化できる。
Level 1 の1stパス速度は最大2倍。最終出力のグローバルPSNRは等速1stパスと同じ。
Level 2 は最大4倍速。最終出力のグローバルPSNRは概ね +/- 0.05dB。
framerefのデフォルトは1ですが、妥当な理由があるわけではありません。
・frameref=2にしただけでもPSNRは約0.15db向上し、5-15%の速度低下があります。これは良い取引だと思います。
・frameref=3ではPSNR向上は約0.25db(frameref=1に対して)、これは目で見て解る違いです。速度低下は約15%(これも frameref=1に対して)。残念ながら、ここから効果は急速に減少していきます。
・frameref=6のPSNRはframeref=3に対してたった0.05-0.1 dBくらいしか向上しません。一方、速度低下は約15%追加です。
・frameref=6より上となると画質向上は非常に僅かです(とはいえ素材次第で全く異なる事に注意して下さい)。一般論としては、frameref=12のPSNRはframeref=6に対してたった0.02dB、速度低下は約15-20%追加です。こうした大きなframeref指定について言えそうな事は「PSNRが下がる事はまず確実に無い、画質向上は計測できるギリギリで、目で見てわかるかどうか」くらいです。
ノート:
CABACオフの場合、不必要にframerefを高くすると符号化効率が落ちる可能性があり、実際、通常は落ちます。
CABACオンの場合(デフォルト)、いまのところframerefを「高くしすぎる」心配はしなくて良いようですが今後の開発の進捗で変わる可能性があります。
速度を考えて妥協するなら、subqとframerefを 1stパス では低く抑えて 2nd で上げるという手があります。一般的に最終的な画質低下は無視できる範囲におさまります。PSNRにして0.1dB 以下。これは目で見て解るには小さ過ぎます。しかし、1st と 2nd で frameref を変えると、フレームタイプの決定に影響が出る事があります。例外的なケースのようではありますが、確実を期すなら、素材映像にスクリーン全体を覆うフラッシング・パターンや、Iフレームが入りそうな非常に長いシーンの繰り返しが無いかを確認し、1stパスのframerefをフラッシュサイクルや繰り返しが入るくらいに大きくして下さい。例えば、3フレームに渡るフラッシュ有りとナシの繰り返しがあったら、1stパスのframerefを3以上に。実写素材では非常に稀なケースだと思いますが、ビデオゲームのキャプチャではよくあります。
frameref is set to 1 by default, but this should not be taken to imply that it is reasonable to set it to 1. Merely raising frameref to 2 gains around 0.15dB PSNR with a 5-10% speed penalty; this seems like a good tradeoff. frameref=3 gains around 0.25dB PSNR over frameref=1, which should be a visible difference. frameref=3 is around 15% slower than frameref=1. Unfortunately, diminishing returns set in rapidly. frameref=6 can be expected to gain only 0.05-0.1 dB over frameref=3 at an additional 15% speed penalty. Above frameref=6, the quality gains are usually very small (although you should keep in mind throughout this whole discussion that it can vary quite a lot depending on your source). In a fairly typical case, frameref=12 will improve global PSNR by a tiny 0.02dB over frameref=6, at a speed cost of 15%-20%. At such high frameref values, the only really good thing that can be said is that increasing it even further will almost certainly never harm PSNR, but the additional quality benefits are barely even measurable, let alone perceptible.
Note:
Raising frameref to unnecessarily high values can and usually does hurt
coding efficiency if you turn CABAC off. With CABAC on (the default
behavior), the possibility of setting frameref “too high“ currently
seems too remote to even worry about, and in the future, optimizations
may remove the possibility altogether.
If you care about speed, a reasonable compromise is to use low subq and frameref values on the first pass, and then raise them on the second pass. Typically, this has a negligible negative effect on the final quality: You will probably lose well under 0.1dB PSNR, which should be much too small of a difference to see. However, different values of frameref can occasionally affect frametype decision. Most likely, these are rare outlying cases, but if you want to be pretty sure, consider whether your video has either fullscreen repetitive flashing patterns or very large temporary occlusions which might force an I-frame. Adjust the first-pass frameref so it is large enough to contain the duration of the flashing cycle (or occlusion). For example, if the scene flashes back and forth between two images over a duration of three frames, set the first pass frameref to 3 or higher. This issue is probably extremely rare in live action video material, but it does sometimes come up in video game captures.
本ガイドの冒頭で2パスの常用を推奨しましたが、それが不適当なケースも存在します。例えば、TVキャプチャをリアルタイムでエンコードしているような場合は、1パスしか使えません。また当然ですが1パスは2パスよりはやいです。各パスを同一設定で走らせれば、ちょうど倍の時間がかかります。
それでも2パスにはメリットがあります。
第一に、シングルパスのレートコントロールは人間の印象にそぐうものではありません。重要な絵とそうでないものの区別を付けられないので、妥当な判断ができない事が多いです。例えば2分のビデオがあるとします。前半1分は非常に動きが多く、キレイに圧縮するなら 2500kbps は必要な場面、それに続く一分はローモーション場面で 300kbps で充分だったとしましょう。
これは普通に考えれば 1400kbps で充分なはずですがシングルパスの場合、前半には非常に高い量子化が掛かかって、堪え難く、妥当とも言い難いほどブロックノイズにまみれます。後半は非常に低い量子化が掛かかります。見た目はパーフェクトでしょうが、その為に費消されるビットレートはまったく妥当とは言えないものです。
さらに、両場面の境目という難しい問題があります。ローモーション場面の冒頭数秒間ではレートコントロールが前場面のようなハイモーションが来ると思っているままですから、非常に高い量子化が掛かかります。
こうした「誤認区間」は相当に目障りで、ビットレートも必要な300kbpsに達する事がありません。シングルパスエンコードの欠点を補う方法はいろいろありますが、そうした手段はビットレート予測の誤差が増える傾向があります。
シングルパスに比べると、マルチパスのレートコントロールは大きなメリットがあります。
1st パスで集めた統計ファイルを使って、qp設定値がいくつでも、各フレームに与えるべきコスト(bit)を妥当な精度で予測できます。これにより、(コストの高い)ハイモーション場面と(コストの安い)ローモーション場面の間のビット配分を、より合理的に行う事ができます。このビット配分方針を調整するには、後述の qcomp を読んで下さい。
なお、2パスに2倍の時間を掛けなくても可能です。1stパスのオプションを弄って高速、かつ低画質化する事ができます。調整するオプションを選べば1stは非常に速くなります。サイズ予測の精度が落ちるので最終的な2ndパスの画質はやや落ちますが、通常は目で見て解るほどではありません。
一例を上げると:
1st subq=1:frameref=1
2nd subq=6:frameref=15:partitions=all:me=umh