头像
SAPikachu
帖子: 192
注册时间: 2011-02-28 19:55
联系: 网站

SAP的EPx264压制脚本(2015-12-29更新)

脚本主要功能:

* 支持1Pass crf + 2Pass bitrate模式,自动获取crf出来的码率作为2pass参数
* 自动记录压制log
* 多target支持,脚本内可定义多套预置参数

代码 | 代码打包下载 | 免Python打包版

UPDATE: 打包版如无法启动,请尝试安装 http://www.microsoft.com/en-us/download ... px?id=5582 (注意无论是x86还是x64的系统,都要安装x86的runtime)

脚本需求Python 3,下载打包版后请先运行以下命令更新至最新版:

代码: 全选

encx264 !update
► 显示剧情透露 更新日志
► 显示剧情透露 基本用法
上次由 SAPikachu 在 2015-12-29 21:07,总共编辑 23 次。
T: @SAPikachu
头像
upyzl
帖子: 446
注册时间: 2010-12-25 18:44
来自: 湘/京
联系: 网站

Re: 自用的x264压制脚本

好久不见LZ,没想到一来就是这么给力的东西,周末玩玩
头像
ikamusume
帖子: 77
注册时间: 2011-03-02 23:13

Re: 自用的x264压制脚本(3/3更新

完全看不懂 不過一定是好東西來 {:cat_17}
mickoo
帖子: 30
注册时间: 2010-11-23 19:18

Re: 自用的x264压制脚本(3/3更新

怎么使用的呢?
encx264.exe <encx264_targets.py> "D:\工具\DSS.avs" "d:\888.mp4" <crf> --tc""
我这样写,系统提示找不到文件,已经放在X264目录下面了
头像
SAPikachu
帖子: 192
注册时间: 2011-02-28 19:55
联系: 网站

Re: 自用的x264压制脚本(3/3更新

呃,这只是个外壳而已,实际的参数还需要你自己设定,你先用记事本打开encx264_targets.py按照里面的格式改好参数吧。
另外主贴的命令行只是示例,实际命令行应该是类似
encx264 mkv_720p "D:\工具\DSS.avs" "d:\888.mp4" 18 --tc ""
T: @SAPikachu
头像
upyzl
帖子: 446
注册时间: 2010-12-25 18:44
来自: 湘/京
联系: 网站

Re: 自用的x264压制脚本(3/3更新

mickoo 写了:怎么使用的呢?
encx264.exe <encx264_targets.py> "D:\工具\DSS.avs" "d:\888.mp4" <crf> --tc""
我这样写,系统提示找不到文件,已经放在X264目录下面了
命令像这样写,一个简单的实例

代码: 全选

encx264 mkv_720p test.avs testA.mkv 22 --tc ""
用记事本打开encx264_targets.py就清楚了
头像
vempx
管理猿
帖子: 146
注册时间: 2010-09-19 20:45

Re: 自用的x264压制脚本(3/6更新)

代码: 全选

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模式
在提问前还请仔细查阅公告帖以及各版置顶帖
相信置顶中也许会有您需要的内容


~My Blog~
mickoo
帖子: 30
注册时间: 2010-11-23 19:18

Re: SAP的EPx264压制脚本(3/15更新)

D:\工具>encx264.exe 720p "e:\1.avs" "d:\888.mp4" 18 --tc ""
Fatal Python error: cannot get zipimporter instance

This application has requested the Runtime to terminate it in an unu
Please contact the application's support team for more information.

我怎么就不行的?我用记事本打开encx264_targets.py,要改的地方是"{outFile}" "{statsFile}" {crf} {bitrate}
这几个吗?
264768502
核心会员
核心会员
帖子: 402
注册时间: 2010-09-23 17:38

Re: SAP的EPx264压制脚本(3/15更新)

(脚本需求Python 3
头像
SAPikachu
帖子: 192
注册时间: 2011-02-28 19:55
联系: 网站

Re: SAP的EPx264压制脚本(3/15更新)

mickoo 写了:D:\工具>encx264.exe 720p "e:\1.avs" "d:\888.mp4" 18 --tc ""
Fatal Python error: cannot get zipimporter instance

This application has requested the Runtime to terminate it in an unu
Please contact the application's support team for more information.

我怎么就不行的?我用记事本打开encx264_targets.py,要改的地方是"{outFile}" "{statsFile}" {crf} {bitrate}
这几个吗?
试试把压缩包解压到空目录然后再复制x264进去?另外target里面设定的是你的压缩参数,花括号参数是在运行时替换的,不能随便修改。
T: @SAPikachu

回到 “视频编码器 / Video encoder discussion”