Mounir
9th May 2022, 20:29
I got a bit of a problem. I got this vhs that's got larges snowy patches (i mean large bands) here and there but the location is not always the same (top, bottom, middle etc..)
So far i came up with this but i don't know how i can adapt the filter border to deal with various locations in the same script. I really don't want to filter the whole frame.
# Noise Location 1:
avisource()
filter_borders(last, 0, 0, -0, -130)
function filter_borders(clip c, int Left, int Top, int Right, int Bottom)
{
inner = Crop(c, 0, 0, -0, -130)
ReplaceFramesSVPFlow(c,48135,1) #
Overlay(last, inner, Left, Top) # overlay unfiltered inner portion
}
This works fine then i'd like to do another noise location and a different frame in time:
Noise location 2 :
avisource()
filter_borders(last, 0, 170, -0, -0)
function filter_borders(clip c, int Left, int Top, int Right, int Bottom)
{
inner = Crop(c, 0, 170, -0, -0) # pour 48136
ReplaceFramesSVPFlow(c,50145,1)
Overlay(last, inner, Left, Top) # overlay unfiltered inner portion
}
LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\svpflow1.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\svpflow2.dll")
function ReplaceFramesSVPFlow(clip Source, int N, int X)
{
# N is number of the 1st frame in Source that needs replacing.
# X is total number of frames to replace
#e.g. ReplaceFramesSVPFLow(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for SVPFlow interpolation
start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
start+end
AssumeFPS(1) #temporarily FPS=1 to use mflowfps
super=SVSuper("{gpu:1}")
vectors=SVAnalyse(super, "{}")
SVSmoothFps(super, vectors, "{rate:{num:"+String(X+1)+", den:1}}", mt=1)
AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
Trim(1, framecount-1) #trim ends, leaving replacement frames
Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
}
Thanks for the help
So far i came up with this but i don't know how i can adapt the filter border to deal with various locations in the same script. I really don't want to filter the whole frame.
# Noise Location 1:
avisource()
filter_borders(last, 0, 0, -0, -130)
function filter_borders(clip c, int Left, int Top, int Right, int Bottom)
{
inner = Crop(c, 0, 0, -0, -130)
ReplaceFramesSVPFlow(c,48135,1) #
Overlay(last, inner, Left, Top) # overlay unfiltered inner portion
}
This works fine then i'd like to do another noise location and a different frame in time:
Noise location 2 :
avisource()
filter_borders(last, 0, 170, -0, -0)
function filter_borders(clip c, int Left, int Top, int Right, int Bottom)
{
inner = Crop(c, 0, 170, -0, -0) # pour 48136
ReplaceFramesSVPFlow(c,50145,1)
Overlay(last, inner, Left, Top) # overlay unfiltered inner portion
}
LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\svpflow1.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth 2.6\plugins\svpflow2.dll")
function ReplaceFramesSVPFlow(clip Source, int N, int X)
{
# N is number of the 1st frame in Source that needs replacing.
# X is total number of frames to replace
#e.g. ReplaceFramesSVPFLow(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for SVPFlow interpolation
start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point
end=Source.trim(N+X,-1) #one good frame after, used for interpolation reference point
start+end
AssumeFPS(1) #temporarily FPS=1 to use mflowfps
super=SVSuper("{gpu:1}")
vectors=SVAnalyse(super, "{}")
SVSmoothFps(super, vectors, "{rate:{num:"+String(X+1)+", den:1}}", mt=1)
AssumeFPS(FrameRate(Source)) #return back to normal source framerate for joining
Trim(1, framecount-1) #trim ends, leaving replacement frames
Source.trim(0,-N) ++ last ++ Source.trim(N+X+1,0)
}
Thanks for the help