You need RT_Stats and GScript,
RT_Stats:
http://forum.doom9.org/showthread.php?t=165479
GScript:
http://forum.doom9.org/showthread.ph...hlight=gscript
Also MS DebugView:
http://technet.microsoft.com/en-us/s.../bb896647.aspx
Rough script:
Code:
VIDOEOFILE="D:\AVS\AVI\lightarea.demuxed.d2v"
MPEG2Source(VIDOEOFILE)
# Your source above,
# RT_Stats & GScript plugins in avisynth plug dir and import below or put in plugs dir
Import ("D:\avs\BANK\QueryBorderCrop.avsi")
Import ("D:\avs\BANK\QueryLumaMinMAx.Avsi")
Robolevels(QBC=false,samples=24) # higher samples better, especially for your clip I think.
Return Last
Function RoboLevels(clip c,float "Strength",int "Samples",float "Ignore",Bool "QBC",Float "QBC_Thresh",int "X",int "Y",int "W",int "H", \
int "Matrix",bool "PC",bool "DEBUG") {
c
Frames=FrameCount
Strength=Float(Default(Strength,1.0))
Samples=(!Defined(Samples)) ? 24 : (Samples > Frames) ? Frames : (Samples < 1) ? 1 : Samples
Ignore=Float(Default(Ignore,0.2))
QBC=Default(QBC,True)
QBC_Thresh=Float(Default(QBC_Thresh,-32.0))
QBCropXP = Default(X,0)
QBCropYP = Default(Y,0)
QBCropWP = Default(W,0)
QBCropHP = Default(H,0)
Matrix = Default(Matrix,(width <= 720) ? 2 : 3)
PC=Default(PC,False)
DEBUG=Default(DEBUG,True)
Assert(Strength>0.0 && Strength <=1.0, "RoboLevels: 0.0 < Strength <= 1.0")
GScript("""
if(QBC) {
QBCS=QueryBorderCrop(samples=Samples,thresh=QBC_Thresh,debug=DEBUG,ignore=Ignore,matrix=Matrix)
(DEBUG)? RT_Debug(QBCS): NOP
Eval(QBCS)
}
tclip=c.Crop(QBCropXP,QBCropYP,QBCropWP,QBCropHP)
QLMMS=QueryLumaMinMax(tclip,samples=Samples,ignore=Ignore,debug=DEBUG,matrix=Matrix)
(DEBUG)?RT_Debug(QLMMS):NOP
Eval(QLMMS)
if(IsRGB() || PC) {
CSMin = 0
CSMax = 255
} else {
CSMin = 16
CSMax = 235
}
ALMin = Int(CSMin - ((CSMin - QLMMMin) * Strength) + 0.5) # Round Up
ALMax = Int(CSMax - ((CSMax - QLMMMax) * Strength)) # Round down
(QBC) ? Crop(QBCropXM,QBCropYM,QBCropWM,QBCropHM): NOP
(DEBUG)? RT_Debug("Levels("+String(ALMin)+",1.0,"+String(AlMax)+","+String(CSMin)+","+String(CSMax)+",Coring=False)"):NOP
Levels(ALMin,1.0,ALMax,CSMin,CSMax,Coring=False) # DO NOT use Coring
""")
return Last
}
I've added the RT_Debug line near the end to show something like
Code:
Levels(16,1.0,233,16,235,Coring=False)
You need to run DebugView and then run the script and Debugview will capture output.
The imported scripts are included in RT_Stats zip.
EDIT: The samples=24, line is the default, might want to increase to as big as you can stand,
(only samples 24 frames by default, spread evenly throughout clip).
EDIT: Also see here:
http://forum.doom9.org/showthread.ph...12#post1598112