View Full Version : I'm so embarrased of asking this question...(applying a filter to a frame range)
Chainmax
11th December 2004, 00:39
I am currently trying to rip one of my DVDs and one scene in particular has more blocks and noise than the rest of the video. I'd like to apply a filter on a given frame range? Yeah, I should know this by now, but I never had to do this before, and I couldn't find anything about this in the Avisynth docs.
:o++
tedkunich
11th December 2004, 02:02
pssst... ApplyRange (http://www.avisynth.org/Animate)
Chainmax
11th December 2004, 05:34
Thanks. :o :o :o
Nicholi
11th December 2004, 21:15
Alternatively you could use this method, which is in Yatta.
PresetClip0=Preset0()
PresetClip6=Preset6()
PresetClip0.Trim(0,1252)+PresetClip6.Trim(1253,1502)+PresetClip0.Trim(1503,0)
Defining the presets earlier in the script as such.
function Preset0(clip c) {
#Name: Basic Filtering
c
SmoothMe()
SharpenMe()
return last
}
Really nice and simple because it's just a button (or key) to press as you are visually watching the stream in Yatta. I find it nifty at least.
Corran
12th December 2004, 17:56
####################################################################
# SceneAdjust by Corran Adapted from Scintilla's Tweakscene #
# Usage: SceneAdjust(start,end,filters) #
# #
# To use filters that use strings like deen("a3d",1) #
# you need to use triple quotes. #
# e.g. SceneAdjust(30,80,filters="""deen("a3d",1).mftoon()""") #
####################################################################
function sceneadjust(clip a, int "start", int "end", string "filters") {
start = Default(start,0)
end = Default(end,a.framecount)
part1 = (start <= 1) ? a.Trim(0,-1) : a.trim(0,start-1)
part3 = (end >= a.framecount-1) ? a.trim(0,-1) : a.trim(end+1,a.framecount)
a=part1+Eval("a."+filters).trim(start,end)+part3
a = (start <= 1)? a.trim(1,a.framecount) : a
(end >= a.framecount-1) ? a.trim(0,a.framecount-2):a
}
...it has been a long time since I wrote this. I think the limitation was that it couldn't apply filters to the first 2 and last 2 frames of the clip. (Safety feature to prevent Trim() from screwing up the frame count.)
If you only have one function to apply then applyrange would be better and faster.
I made this for ease of use and I don't really plan on updating it.
stickboy
12th December 2004, 21:18
Yes, using Trim in user-defined functions is dangerous (http://forum.doom9.org/showthread.php?s=&threadid=58358) if the frame numbers are variable.
The internal ApplyRange function has some limitations. My JDL_ApplyRange (http://www.avisynth.org/stickboy/) function basically does what Nicholi and Corran said but in a safe way and without start/end frame limitations.
Corran
12th December 2004, 21:27
Originally posted by stickboy
Yes, using Trim in user-defined functions is dangerous (http://forum.doom9.org/showthread.php?s=&threadid=58358) if the frame numbers are variable.
The internal ApplyRange function has some limitations. My JDL_ApplyRange (http://www.avisynth.org/stickboy/) function basically does what Nicholi and Corran said but in a safe way and without start/end frame limitations.
-_- I wish I had found that before making my own...
vBulletin® v3.8.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.