x264預設類參數詳解

來源:互聯網
上載者:User

x264預設類參數詳解

 

  x264版本——

x264 core:116 r2074 2641b9e

 

  加上“fullhelp”參數可以查看x264的完全版協助——

x264 --fullhelp

 

  其中對預設類參數的說明是—— 

Presets:

--profile <string> Force the limits of an H.264 profile
Overrides all settings.
- baseline:
--no-8x8dct --bframes 0 --no-cabac
--cqm flat --weightp 0
No interlaced.
No lossless.
- main:
--no-8x8dct --cqm flat
No lossless.
- high:
No lossless.
- high10:
No lossless.
Support for bit depth 8-10.
--preset <string> Use a preset to select encoding settings [medium]
Overridden by user settings.
- ultrafast:
--no-8x8dct --aq-mode 0 --b-adapt 0
--bframes 0 --no-cabac --no-deblock
--no-mbtree --me dia --no-mixed-refs
--partitions none --rc-lookahead 0 --ref 1
--scenecut 0 --subme 0 --trellis 0
--no-weightb --weightp 0
- superfast:
--no-mbtree --me dia --no-mixed-refs
--partitions i8x8,i4x4 --rc-lookahead 0
--ref 1 --subme 1 --trellis 0 --weightp 1
- veryfast:
--no-mixed-refs --rc-lookahead 10
--ref 1 --subme 2 --trellis 0 --weightp 1
- faster:
--no-mixed-refs --rc-lookahead 20
--ref 2 --subme 4 --weightp 1
- fast:
--rc-lookahead 30 --ref 2 --subme 6
--weightp 1
- medium:
Default settings apply.
- slow:
--b-adapt 2 --direct auto --me umh
--rc-lookahead 50 --ref 5 --subme 8
- slower:
--b-adapt 2 --direct auto --me umh
--partitions all --rc-lookahead 60
--ref 8 --subme 9 --trellis 2
- veryslow:
--b-adapt 2 --bframes 8 --direct auto
--me umh --merange 24 --partitions all
--ref 16 --subme 10 --trellis 2
--rc-lookahead 60
- placebo:
--bframes 16 --b-adapt 2 --direct auto
--slow-firstpass --no-fast-pskip
--me tesa --merange 24 --partitions all
--rc-lookahead 60 --ref 16 --subme 11
--trellis 2
--tune <string> Tune the settings for a particular type of source
or situation
Overridden by user settings.
Multiple tunings are separated by commas.
Only one psy tuning can be used at a time.
- film (psy tuning):
--deblock -1:-1 --psy-rd <unset>:0.15
- animation (psy tuning):
--bframes {+2} --deblock 1:1
--psy-rd 0.4:<unset> --aq-strength 0.6
--ref {Double if >1 else 1}
- grain (psy tuning):
--aq-strength 0.5 --no-dct-decimate
--deadzone-inter 6 --deadzone-intra 6
--deblock -2:-2 --ipratio 1.1
--pbratio 1.1 --psy-rd <unset>:0.25
--qcomp 0.8
- stillimage (psy tuning):
--aq-strength 1.2 --deblock -3:-3
--psy-rd 2.0:0.7
- psnr (psy tuning):
--aq-mode 0 --no-psy
- ssim (psy tuning):
--aq-mode 2 --no-psy
- fastdecode:
--no-cabac --no-deblock --no-weightb
--weightp 0
- zerolatency:
--bframes 0 --force-cfr --no-mbtree
--sync-lookahead 0 --sliced-threads
--rc-lookahead 0

 

  文字太多看起來有點暈,於是我整理為表格。

  

1 profile(檔次)

 

 

name 名稱 8x8dct cqm bframes cabac weightp interlaced
1 baseline 基準 no flat 0 no 0 no
2 main 主要 no flat 不限 不限 不限 不限
3 high 不限 不限 不限 不限 不限 不限
4 high10 高10位 不限 不限 不限 不限 不限 不限

bframes:在I幀與P幀之間可插入B幀數量(Number of B-frames)的最大值,範圍0-16。

cqm:自訂量化矩陣(custom quantization matrices)。預設有flat和JVT。

weightp:使x264能夠使用明確加權預測(explicit weighted prediction)來改善P幀的壓縮。亦改善淡入/淡出的品質。模式越高越慢。

8x8dct:彈性8x8離散餘弦轉換(Adaptive 8x8 DCT)。

cabac:彈性內容的二進位算數編碼(CABAC:Context Adaptive Binary Arithmetic Coder)。

interlaced:隔行掃描。 

 

 

2 preset(預設)

 

 

name 名稱 b-adapt bframes direct me merange partitions rc-lookahead ref subme trellis weightp other
1 ultrafast 極快 0 0   dia   none 0 1 0 0 0 no-8x8dct aq-mode0 no-cabac no-deblock no-mbtree no-mixed-refs scenecut0   no-weightb
2 superfast 超快       dia   i8x8,i4x4 0 1 1 0 1 no-mixed-refsno-mbtree
3 veryfast 很快             10 1 2 0 1 no-mixed-refs
4 faster 較快             20 2 4   1 no-mixed-refs
5 fast             30 2 6   1  
6 medium                        
7 slow 2   auto umh     50 5 8      
8 slower 較慢 2   auto umh   all 60 8 9 2    
9 veryslow 很慢 2 8 auto umh 24 all 60 16 10 2    
10 placebo   2 16 auto tesa 24 all 60 16 11 2   slow-firstpass no-fast-pskip

b-adapt:設定彈性B幀位置決策演算法。此設定控制x264如何決定要放置P幀或B幀。

bframes:在I幀與P幀之間可插入B幀數量(Number of B-frames)的最大值,範圍0-16。

direct:"direct"動態向量(motion vectors)的預測模式。有兩種模式可用:spatial和temporal。可以指定none來停用direct動態向量,和指定auto來允許x264在兩者之間切換為適合的模式。

me:全像素(full-pixel)運動估計(motion estimation)的演算法。

merange:控制運動估計的最大範圍(單位是像素)。對於hex和dia,範圍限制在4~16。對於umh和esa,它可以增加到超過預設值16來允許範圍更廣的動態搜尋,對於HD視訊和高動態鏡頭很有用。注意,對於umh、esa和tesa,增加merange會大幅減慢編碼速度。

partitions:H.264視訊在壓縮過程中劃分為16x16的宏區塊。這些區塊可以進一步劃分為更小的分割,這就是此選項要控制的部分。

rc-lookahead:設定mb-tree位元率控制和vbv-lookahead使用的幀數。最大允許值是250。對於mb-tree部分,增加幀數帶來更好的效果但也會更慢。mb-tree使用的最大緩衝值是MIN(rc-lookahead, --keyint)。

ref:控制解碼圖片緩衝(DPB:Decoded Picture Buffer)的大小。範圍是從0到16。總之,此值是每個P幀可以使用先前多少幀作為參照幀的數目(B幀可以使用的數目要少一或兩個,取決於它們是否作為參照幀)。可以被參照的最小ref數是1。

subme:設定子像素(subpixel)估算複雜度。值越高越好。層級1~5隻是控制子像素細分(refinement)強度。層級6為模式決策啟用RDO,而層級8為動態向量和內部預測模式啟用RDO。RDO層級明顯慢於先前的層級。

trellis:執行Trellis quantization來提高效率。

weightp:使x264能夠使用明確加權預測(explicit weighted prediction)來改善P幀的壓縮。亦改善淡入/淡出的品質。模式越高越慢。

no-8x8dct:停用彈性8x8離散餘弦轉換(Adaptive 8x8 DCT)。

aq-mode:彈性量化模式。沒有AQ時,x264很容易分派不足的位元數到細節較少的部分。AQ是用來更好地分配視訊裡所有宏區塊之間的可用位元數。

no-cabac:停用彈性內容的二進位算數編碼(CABAC:Context Adaptive Binary Arithmetic Coder)資料流壓縮,切換回效率較低的彈性內容的可變長度編碼(CAVLC:Context Adaptive Variable Length Coder)系統。大幅降低壓縮效率(通常10~20%)和解碼的硬體需求。

no-deblock:停用迴圈篩選(loop filter。亦稱為持續迴圈去區塊(inloop deblocker))。

no-mbtree:停用宏區塊樹(macroblock tree)位元率控制。使用宏區塊樹位元率控制會改善整體壓縮率,藉由追蹤跨幀的時間傳播(temporal propagation)並相應地加權。

no-mixed-refs:混合參照會以每個8x8分割為基礎來選取參照,而不是以每個宏區塊為基礎。當使用多個參照幀時這會改善品質,雖然要損失一些速度。設定此選項會停用該功能。

scenecut:設定I/IDR幀位置的閾值(情境變更偵測)。

no-weightb:停用“加權”B幀的參照。

slow-firstpass:慢速pass。

no-fast-pskip:停用P幀的早期略過偵測(early skip detection)。非常輕微地提高品質,但要損失很多速度。

 

 

3 tune(調校)

 

 

name 名稱 ref bframes deblock psy-rd aq-strength other
1 film 電影     -1:-1 <unset>:0.15    
2 animation 動畫 {Double if >1 else 1} {+2} 1:1 0.4:<unset> 0.6  
3 grain 顆粒     -2:-2 <unset>:0.25 0.5 no-dct-decimate deadzone-inter6 deadzone-intra6 ipratio1.1 pbratio1.1   qcomp0.8
4 stillimage 靜態映像     -3:-3 2.0:0.7 1.2  
5 psnr PSNR測試       no   aq-mode0
6 ssim SSIM測試       no   aq-mode2
7 fastdecode 快速解碼     no     no-cabac no-weightb weightp0
8 zerolatency 零延遲   0       force-cfr no-mbtree sync-lookahead0 sliced-threads rc-lookahead0

ref:控制解碼圖片緩衝(DPB:Decoded Picture Buffer)的大小。範圍是從0到16。總之,此值是每個P幀可以使用先前多少幀作為參照幀的數目(B幀可以使用的數目要少一或兩個,取決於它們是否作為參照幀)。可以被參照的最小ref數是1。

bframes:在I幀與P幀之間可插入B幀數量(Number of B-frames)的最大值,範圍0-16。

deblock:控制迴圈篩選(亦稱為持續迴圈去區塊(inloop deblocker))。

psy-rd:第一個數是Psy-RDO的強度(需要subme>=6)。第二個數是Psy-Trellis的強度(需要trellis>=1)。

aq-strength:彈性量化強度。設定AQ偏向低細節(平面)的宏區塊之強度。不允許為負數。0.0~2.0以外的值不建議。

no-dct-decimate:停用DCT Decimation。DCT Decimation會捨棄它認為“不必要的”DCT區塊。這會改善編碼效率,而降低的品質通常微不足道。

deadzone-inter/intra:設定inter/intra亮度量化反應區(deadzone)的大小。反應區的範圍應該在0~32。此值設定x264會任意捨棄而不嘗試保留細微細節的層級。非常細微的細節既難以看見又耗費位元數,捨棄這些細節可以不用浪費位元數在視訊的此類低收益畫面上。反應區與--trellis不相容。

ipratio:修改I幀量化值相比P幀量化值的目標平均增量。越大的值會提高I幀的品質。

pbratio:修改B幀量化值相比P幀量化值的目標平均減量。越大的值會降低B幀的品質。當mbtree啟用時(預設啟用),此設定無作用,mbtree會自動計算最佳值。

qcomp:量化值曲線壓縮係數。0.0是固定位元率,1.0則是固定量化值。當mbtree啟用時,它會影響mbtree的強度(qcomp越大,mbtree越弱)。

aq-mode:彈性量化模式。沒有AQ時,x264很容易分派不足的位元數到細節較少的部分。AQ是用來更好地分配視訊裡所有宏區塊之間的可用位元數。

no-cabac:停用彈性內容的二進位算數編碼(CABAC:Context Adaptive Binary Arithmetic Coder)資料流壓縮,切換回效率較低的彈性內容的可變長度編碼(CAVLC:Context Adaptive Variable Length Coder)系統。大幅降低壓縮效率(通常10~20%)和解碼的硬體需求。

weightp:使x264能夠使用明確加權預測(explicit weighted prediction)來改善P幀的壓縮。亦改善淡入/淡出的品質。模式越高越慢。

force-cfr:如果使用 ffms2 或 lavf 分離器,且輸出檔案不是 raw 格式,則從輸入檔案複製時間碼。此選項關閉這個功能,並強制 x264 自己產生。當使用此選項時估計你也會設定 --fps。

no-mbtree:停用宏區塊樹(macroblock tree)位元率控制。使用宏區塊樹位元率控制會改善整體壓縮率,藉由追蹤跨幀的時間傳播(temporal propagation)並相應地加權。

sync-lookahead:設定用於線程預測的幀緩衝大小。最大值是250。在第二遍及更多遍編碼或基於分區線程時自動關閉。設為0將關閉線程預測,將減小延遲,但是以降低效能為代價。

sliced-threads:開啟基於分區的線程。比預設品質低、效率低,但是沒有編碼延遲。

rc-lookahead:設定mb-tree位元率控制和vbv-lookahead使用的幀數。最大允許值是250。對於mb-tree部分,增加幀數帶來更好的效果但也會更慢。mb-tree使用的最大緩衝值是MIN(rc-lookahead, --keyint)。

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.