版面规则
提问时请注意:尽量详细描述操作过程、AVS脚本内容等,最好能写出片名,只贴图有时无法看出问题原因。
提示:发布原创内容请尽量使用附件上传。使用网盘会出现过期失效的问题,请注意。
头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

RangeFix v1.1 自动EP——基于Histogram自动修正pc range的帧

v1.0

前阵子和菊苣们搅基的时候冒出的想法,这两天考试结束回来实现出来了,对付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
}
上次由 06_taro 在 2011-05-27 23:17,总共编辑 1 次。
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
头像
-o-o-304-o-o-
超级版主
帖子: 640
注册时间: 2010-10-10 20:00
来自: US
联系: 网站

Re: RangeFix v1.1 自动EP——基于Histogram自动修正pc range的帧

taro大v5(小白拜
► 显示剧情透露 En Taro 06!Taro Pie NC Fanclub project始动!聊天用Q群开放中
► 显示剧情透露 胸中有万言,退敌无一策,是谓书生误国"
► 显示剧情透露 前辈们的信念
► 显示剧情透露 妇联招新广告,走过路过可以看看撒
► 显示剧情透露 香芋派,后期菊苣们的一致选择
► 显示剧情透露 众菊苣喜评香芋派
► 显示剧情透露 聊天用工具
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: RangeFix v1.1 自動EP——基於Histogram自動修正pc range的幀

實際測試了一下,發現並沒有效果?前 100 幀還是一樣為 PC range…是我哪裡搞錯了嗎 {:cat_8}

代码: 全选

FFmpegSource2("xxx.mkv")
Trim(0, 99).ColorYUY2(levels="TV->PC") ++ Trim(100, 0)
RangeFix()
showHist(info=false)
图片
头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

Re: RangeFix v1.1 自动EP——基于Histogram自动修正pc range的帧

咦,我这里试的没问题啊……

代码: 全选

StackVertical(
\ BlankClip(length=240, width=640, height=240, pixel_type="YV12", color=$000000),
\ BlankClip(length=240, width=640, height=240, pixel_type="YV12", color=$FFFFFF) )

Trim(0, 99).ColorYUY2(levels="TV->PC")++Trim(100, 0)

MME(ShowHistMod, RangeFix.ShowHistMod, debug=true)
图片貌似过大,新窗口打开能看到左边不fix右边fix的效果
图片
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: RangeFix v1.1 自動EP——基於Histogram自動修正pc range的幀

這樣就不行了 {:cat_13}

代码: 全选

StackVertical(
\ BlankClip(length=240, width=640, height=160, pixel_type="YV12", color=$000000),
\ BlankClip(length=240, width=640, height=160, pixel_type="YV12", color=$888888),
\ BlankClip(length=240, width=640, height=160, pixel_type="YV12", color=$FFFFFF) )

Trim(0, 99).ColorYUY2(levels="TV->PC") ++ Trim(100, 0)

MME(showHist(), RangeFix().showHist(), debug=true)
图片
图片
头像
06_taro
核心会员
核心会员
帖子: 998
注册时间: 2010-09-22 18:32
来自: United Kingdom
联系: 网站

Re: RangeFix v1.1 自动EP——基于Histogram自动修正pc range的帧

图片
于是我彻底囧到了……
明天交完各种答辩记录表再来看到底啥问题吧……
顺便问下您用的是2.5的avs么?
つまんねー事聞くなよ!

I, personally, for me, believe (obviously sometimes) that my OS choice is right. That's me. I'm not telling you that you should believe it. Learn the facts, and the origins behind the facts, and make up your own damn mind. That's why you have one. (source)

Follow me: @06_taro

304——
为纪念伟大的宇宙史上最强压制304先生,联合国教科文组织决定,将每年的第304天,即平年的10月31日或者闰年的10月30日,定为世界304日。
头像
Holy
核心会员
核心会员
帖子: 235
注册时间: 2010-09-24 9:28

Re: RangeFix v1.1 自動EP——基於Histogram自動修正pc range的幀

搞笑了,我貼的圖當時中間那行的color是$00FF00才對,在交叉測試時複製錯avs了 {:cat_18}
我現在裝的是2.6版,下班回家改用2.5.8試完再上來報告 {:cat_16}

Edit: 呃…原來是2.6 MT版rp了,改用ST版的2.6.0 Alpha 3就運作無誤了 {:cat_5}
各種感謝 〈(_ _)〉
图片

回到 “AviSynth”