代码: 全选
x264_path = 'x264.exe'
common_params = "--profile high --threads 6 --thread-input {tc} --sar {sar} "+ \
"--bframes 8 --b-adapt 2 --b-pyramid none "+ \
"--no-fast-pskip --no-dct-decimate --min-keyint 1 "+ \
"--fade-compensate 0.4 --merange 32 --direct auto "
common_params_pass1 = '--pass 1 --slow-firstpass --stats "{statsFile}" ' + \
'--trellis 0 --me hex --ref 1 ' + \
'--subme 7 --partitions none --output NUL'
common_params_pass2 = '--pass 2 --stats "{statsFile}" --ref {ref} '+ \
'--subme 10 --trellis 2 --output "{outFile}"'
encode_targets = {
"720p" : {
"default_sar": "1:1",
"default_ref": 6,
"bitrate_ratio": 0.9,
"common": "--deblock -1:-1 --keyint 240 --rc-lookahead 48 --psy-rd 0.2:0 " + \
"--vbv-bufsize 50000 --vbv-maxrate 50000",
'pass1': '--crf {crf}',
"pass2": '--me tesa --bitrate {bitrate} ',
},
"1080p" : {
"default_sar": "1:1",
"default_ref": 4,
"bitrate_ratio": 0.9,
"common": "--deblock -1:-1 --keyint 240 --rc-lookahead 48 --psy-rd 0.2:0 " + \
"--vbv-bufsize 50000 --vbv-maxrate 50000",
'pass1': '--crf {crf}',
"pass2": '--me tesa --psy-rd 0.2:0 --bitrate {bitrate} ',
},
}
稍微调教了一份自用的target脚本,参数比较EP,简单说一下设置:
1、B帧的设置被彻底拿到全局通用部分
2、merange被拿到全局通用并增加到32
3、全局通用部分添加--fade-compensate 0.4参数,如果x264的编译版没有这个参数那么去掉就可以
4、1pass精确度相比默认设置稍做提高
======================更新=======================
再次提高1pass精度:--subme 7
在我的Q9300@3.3G上,720P的编码帧率下降了不到3fps
--psy-rd 移动到分类通用部分
--direct auto,貌似auto比较适合2pass模式