Log in

View Full Version : What is the most convenient way to apply filters to a certain range?


jellysandwich
11th October 2005, 01:30
Let's say that I wanted warpsharp everything in my video except the intro and the credits. Right now, I use this bloated copy/paste/trim script:

function VD_WarpSharp(clip clip, int "depth", int "blur")
{
LoadVirtualdubPlugin("c:\progra~1\gordia~1\avisynth25\warpsharp.vdf", "_VD_WarpSharp")
return clip._VD_WarpSharp(depth,blur)
}

# PLUGINS
LoadPlugin("C:\PROGRA~1\GORDIA~1\DGMPGDec\DGDecode.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\decomb.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynthPlugins\UnDot.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynth25\IT.dll")
LoadPlugin("C:\PROGRA~1\GORDIA~1\AviSynth25\decomb522.dll")

# SOURCE
mpeg2source("D:\FLCL\1\1.d2v")
AssumeTFF().Telecide(guide=0,post=0,vthresh=50,dthresh=0,ovr="ovr.txt",show=false).Decimate(mode=0)
crop(4,0,712,480)
LanczosResize(640,480)
Undot()
ConvertToRGB().VD_WarpSharp(50,4).ConvertToYV12()
Clip1=Trim(0,31681)


mpeg2source("D:\FLCL\1\1.d2v")
AssumeTFF().Telecide(guide=0,post=0,vthresh=50,dthresh=0,ovr="ovr.txt",show=false).Decimate(mode=0)
crop(4,0,712,480)
LanczosResize(640,480)
Undot()
Clip2=Trim(31682,0)

AlignedSplice(Clip1,Clip2)


Is there an easier way that doesn't require copy/pasting?

js

Video Dude
11th October 2005, 01:46
AviSynth has a built in function called ApplyRange.

http://www.avisynth.org/Animate


AssumeTFF().Telecide(guide=0,post=0,vthresh=50,dthresh=0,ovr="ovr.txt",show=false).Decimate(mode=0)
crop(4,0,712,480)
LanczosResize(640,480)
Undot()

ConvertToRGB()
ApplyRange(frame_#_after_intro, frame_#_before_credits, "VD_WarpSharp", 50, 4)
ConvertToYUY2()

jellysandwich
11th October 2005, 02:00
AviSynth has a bulit in function called ApplyRange.

http://www.avisynth.org/Animate


AssumeTFF().Telecide(guide=0,post=0,vthresh=50,dthresh=0,ovr="ovr.txt",show=false).Decimate(mode=0)
crop(4,0,712,480)
LanczosResize(640,480)
Undot()

ApplyRange(frame_#_after_intro, frame_#_before_credits, "VD_WarpSharp", 50, 4)

Perfect, thank you.

js

Video Dude
11th October 2005, 02:08
Perfect, thank you.

js
Your welcome.


Edit: I edited the script to add the colorspace conversion.

movax
11th October 2005, 03:23
For a number of filters, you can do stuff like:

function Preset0(clip c) {
#Name: Default
c
filters
...
more filters
return last
}

function Preset1(clip c) {
#Name: Default
c
different filters
...
lah de doo laa
return last
}

PresetClip0=Preset0()
PresetClip1=Preset1()
PresetClip0.Trim(0,33095)+PresetClip1.Trim(33096,35240)+PresetClip0.Trim(35241,35956)

Elic
11th October 2005, 14:29
When I need few fragments of clip to be processed in similar way but with slightly differ parameters I use function like below:function fragment( clip c, int begin, int end, int param ) {
c
SomeFilter( param )
c.trim(0,begin-1) + trim(begin,end-1) + c.trim(end,0)
}

avisource( "some_clip.avi")
fragment( 100, 120, 0 )
fragment( 4800, 5000, 1)
fragment( 2200,2201,2)
...

Scintilla
11th October 2005, 19:09
Corran's SceneAdjust (http://www.amvwiki.org/index.php/SceneAdjust) function is also good for this, especially if you don't want to have to list all the arguments.

jellysandwich
11th October 2005, 19:31
Interesting, I'll have it try that out sometime.

js

stickboy
11th October 2005, 19:53
When I need few fragments of clip to be processed in similar way but with slightly differ parameters I use function like below:[code]function fragment( clip c, int begin, int end, int param ) {
c
SomeFilter( param )
c.trim(0,begin-1) + trim(begin,end-1) + c.trim(end,0)
}Alas, your function doesn't work if begin or end are 0 or 1.

Once again:
Using Trim in functions is really tricky. (http://forum.doom9.org/showthread.php?s=&threadid=58358)

Chainmax
11th October 2005, 21:28
What if I want to use some filters in a range and the rest in other? I am trying to use the following chain:


TDeint(...)
MergeChroma(Crop(...).AddBorders(...))
FixChromaBleeding()
Crop(...)
BlindDeHalo3(...)
m=depanestimate(...)
r=2
DePanInterleave(...)
DeGrainMedian(...)
TemporalSoften(...)
SelectEvery(...)
LimitedSharpen(...)
ConvertToYUY2().AssumeBff().SeparateFields().SelectEvery(...).Weave()
AddBorders(...)

The bolded parts are to be used in frames 97 to 4499, and the rest are to be used in the whole clip (frames 0 to 4600), so what should I add to the script?