前阵子和菊苣们搅基的时候冒出的想法,这两天考试结束回来实现出来了,对付PC/TV的hybrid。
用标准的TV range的Histogram图像,与片子的Histogram图像比较,然后用conditionFilter(实际是ScriptClip)来控制,只修正PC range的帧而不动TV range的帧。
目前只给了修正完全的PC range[0-255]的处理,其他奇形怪状譬如[4-250]之类,虽然加几个控制参数不是什么麻烦事,但是我就不提供可供修改的参数了,因为那种情况下还是手动EP比较准确……
顺便YC压缩到底什么方式最正统还请各位赐教,这里用的只是Levels,但是Levels动的应该只是Luma,虽然用YtoUV、UtoY和VtoY继续改Chroma写起来应该不是很繁,不过还是希望看到更正统的做法所以暂时也没加进去。不知道大家对ColorYUY2之类的工具有具体研究么?个人泥轰语看不懂,这参数貌似又很复杂……
v1.1
改用ColorYUY2做YC压缩,感谢Klaus前辈的指点。
下载地址:
MF:RangeFix.avsi
115:RangeFix.avsi
或者:
代码: 全选
###################################################
### ###
### RangeFix.avsi ###
### ###
### By 06_taro ( astrataro@gmail.com ) ###
### ###
### v1.1 - 05 April 2011 ###
### ###
###################################################
###
###
### Automatically fix pc range based on Histogram.
###
### Fix only pc range frames, with no touch on correct tv range frames.
###
### I created this function in order to save time when dealing with "hybrid" pc/tv range clips.
###
### I didn't add parameters to customize your own settings for Levels function so it only works with "standard" wrong pc range frames, because in other weird cases it is certainly not recommended to use an auto-detect function.
###
### +-------------+
### | CHANGELOG |
### +-------------+
###
### v1.1 - 05 April 2011:
### - Use ColorYUY2 instead of internal filter Levels
###
### v1.0 - 05 April 2011:
### - First script
###
### +----------------+
### | REQUIREMENTS |
### +----------------+
###
### ColorYUY2_for_25.dll (2003.09.06)
###
### +-------+
### | USAGE |
### +-------+
###
### Import("RangeFix.avsi")
### RangeFix()
###
### +---------+
### | EXAMPLE |
### +---------+
###
### AviSource(xxx.avi) # load a correct video
### Trim(0,100).ColorYUY2(levels="TV->PC")+Trim(100,200) # create a wrong video
### RangeFix() # fix wrong pc range frames and keep correct tv range frames
###
function RangeFix(clip input){
return ScriptClip(input, """LumaDifference( histoCheck(standard=false), histoCheck(standard=true) ) < 2 ? last : ColorYUY2(levels="PC->TV")""")
}
function histoCheck(clip input, bool "standard"){
w = width(input)
h = height(input)
fn = frameratenumerator(input)
fd = frameratedenominator(input)
fc = framecount(input)
Default(standard, false)
test = input.Histogram(mode="classic")
tests = StackHorizontal(test.Crop(w, 0, 16, 0), test.Crop(w+236, 0, 20, 0))
stand = BlankClip(length=fc, width=w, height=h, pixel_type="YV12", fps=fn, fps_denominator=fd, color=$000000).Histogram(mode="classic")
stands = StackHorizontal(stand.Crop(w, 0, 16, 0), stand.Crop(w+236, 0, 20, 0))
histo = ( standard == false ) ? tests : stands
return histo
}