sephirotic
16th March 2016, 18:46
I can't figure out how to create an AVS with multiple files and apply different filter chains to each file.
I did find after googling around here on Doom9 how to apply different filter chains to different cuts using trim to a single file, such as this:
AVISource("G:\Ep16 CC.avi", audio=false).AssumeFPS(24000,1001)
function Filters1(clip c)
{
c
LSFmod(strength=50)
f3kdb (range=18, y=64, cb=64, cr=64, grainy=64, grainc=64)
maa2(ss=2.0, aa=64)
ToonLite(strength=0.3)
return last
}
FilterClip1=Filters1()
trim(0,2160) ++ FilterClip1.trim(2161,31619) ++ trim(31620,33620)
Spline36Resize(960,720)
This scrip works, but in this case I don't understand what "c" means, nor what "last" refers too, shouldn't it be the Toonlite function? And why do I need to declare FilterClip1 to receive Filters1? Why can't I just use filters 1.Trim(xxx) etc in the first place? That makes no sense to me.
I tried to use the same logic for different filter chains in the following script, but it didn't work, it gives "invalid" arguments to function Filters1:
v1 = Avisource("H:\wide2.avi")
v2 = Avisource("H:\wide3.avi")
v3= Avisource("H:\wide4.avi")
v4= Avisource("H:\wide5.avi")
audio = DirectShowSource("H:\3audio.m4a")
function Filters1(clip c)
{
c
awarpsharp2(thresh=96)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
return last
}
FilterClip1=Filters1()
#I tried to create a second filter chain here:
function Filters2(clip c)
{
c
awarpsharp2(thresh=96)
maa2(ss=2.0, aa=80)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
return last
}
FilterClip2=Filters2()
video = FilterClip1.v1+FilterClip1.v2+FilterClip2.v3+FilterClip2.v4
Ditherpost()
Actually, using multiple AVIsources instead of Trim to a single file doesn't even work with a simple filter chain such as:
v1 = Avisource("H:\wide2.avi")
v2 = Avisource("H:\wide3.avi")
v3= Avisource("H:\wide4.avi")
v4= Avisource("H:\wide5.avi")
video = v1+v2.+v3+v4
awarpsharp2(thresh=96)
maa2(ss=2.0, aa=80)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
Ditherpost()
All filters receive an "invalid argument to function xxx".
I did learn basic C++ on college but was never really good with scripting.
Can someone help me out?
Also, still on topic, if it's possible to answer another question:
If I wanted to import different video files, and apply different filters to several different frame intervals on all such files, something like:
v1=file1.avi
v2=file2.avi
v3=file3.avi
video=v1+v2+v3
And then from the resulting concatenated video:
trim(1,10)
receiveis filter chain 1
trim(10,20)
no filter chain
trim(30,40)
receives filter chain 1
trim(40,50)
no filter chain
trim(50,60)
receives filter chain 2
trim(70,80)
receives filter chain 3
etc, etc,
How would I do that?
I think this kind of basic doubt about different cuts and filter chains would really help to be added on the avisynth wiki examples section
Thanks a lot.
I did find after googling around here on Doom9 how to apply different filter chains to different cuts using trim to a single file, such as this:
AVISource("G:\Ep16 CC.avi", audio=false).AssumeFPS(24000,1001)
function Filters1(clip c)
{
c
LSFmod(strength=50)
f3kdb (range=18, y=64, cb=64, cr=64, grainy=64, grainc=64)
maa2(ss=2.0, aa=64)
ToonLite(strength=0.3)
return last
}
FilterClip1=Filters1()
trim(0,2160) ++ FilterClip1.trim(2161,31619) ++ trim(31620,33620)
Spline36Resize(960,720)
This scrip works, but in this case I don't understand what "c" means, nor what "last" refers too, shouldn't it be the Toonlite function? And why do I need to declare FilterClip1 to receive Filters1? Why can't I just use filters 1.Trim(xxx) etc in the first place? That makes no sense to me.
I tried to use the same logic for different filter chains in the following script, but it didn't work, it gives "invalid" arguments to function Filters1:
v1 = Avisource("H:\wide2.avi")
v2 = Avisource("H:\wide3.avi")
v3= Avisource("H:\wide4.avi")
v4= Avisource("H:\wide5.avi")
audio = DirectShowSource("H:\3audio.m4a")
function Filters1(clip c)
{
c
awarpsharp2(thresh=96)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
return last
}
FilterClip1=Filters1()
#I tried to create a second filter chain here:
function Filters2(clip c)
{
c
awarpsharp2(thresh=96)
maa2(ss=2.0, aa=80)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
return last
}
FilterClip2=Filters2()
video = FilterClip1.v1+FilterClip1.v2+FilterClip2.v3+FilterClip2.v4
Ditherpost()
Actually, using multiple AVIsources instead of Trim to a single file doesn't even work with a simple filter chain such as:
v1 = Avisource("H:\wide2.avi")
v2 = Avisource("H:\wide3.avi")
v3= Avisource("H:\wide4.avi")
v4= Avisource("H:\wide5.avi")
video = v1+v2.+v3+v4
awarpsharp2(thresh=96)
maa2(ss=2.0, aa=80)
SMDegrain(tr=1, prefilter=3, refinemotion=true, contrasharp=true, truemotion=false, thsad=200, str=2.0, lsb=true, plane=4, lsb_out=true)
f3kdb(range=24, input_depth=16, output_depth=16)
Ditherpost()
All filters receive an "invalid argument to function xxx".
I did learn basic C++ on college but was never really good with scripting.
Can someone help me out?
Also, still on topic, if it's possible to answer another question:
If I wanted to import different video files, and apply different filters to several different frame intervals on all such files, something like:
v1=file1.avi
v2=file2.avi
v3=file3.avi
video=v1+v2+v3
And then from the resulting concatenated video:
trim(1,10)
receiveis filter chain 1
trim(10,20)
no filter chain
trim(30,40)
receives filter chain 1
trim(40,50)
no filter chain
trim(50,60)
receives filter chain 2
trim(70,80)
receives filter chain 3
etc, etc,
How would I do that?
I think this kind of basic doubt about different cuts and filter chains would really help to be added on the avisynth wiki examples section
Thanks a lot.