View Full Version : Generate broken frames from neighbour frames using MVFlow
pbristow
7th February 2012, 16:45
pbristow
Only human eye(s) could see "bad frame(s)",
only human brain could decide which frame(s) is bad or not...
...If you don't define things any better than "bad frame", then yes. That was basically my starting point. :)
However, you can get a computerised process to help find bad frames, *if* you can define what particular kind of "badness" you want it to look for.
But if you try to search for "anything a human viewer will percieve as a bad frame", then... Nope, can't be done. (Not least because not all human viewers will agree on what *is* a bad frame anyway! :) )
sven_x
28th February 2012, 18:50
MorphDups - replace duplicate frames by interpolations (http://forum.doom9.org/showthread.php?p=1563921)
MorphDups is a script, that searches for duplicate frames. From the result it generates a second script, that is using calls to Mug Funky's Morph function which then replaces the duplicate frames by interpolations.
manono
25th March 2012, 22:05
Hi,
I'm using InterpolateBadFrames for replacing broken frames from VHS captures. Or trying to without luck so far:
function R(clip Source, int N)
{
# N is number of the frame in Source that needs replacing.
# Frame N will be replaced.
Source.trim(0,-N) ++ CandidatesForC.trim(N-1,-1) ++ Source.trim(N+1,0)
}
function RP(clip Source, int N)
{
# N is number of the first frame in Source that needs replacing.
# Frames N and N+1(O) will be replaced.
Source.trim(0,-N) ++ CandidatesForN.trim(N-1,-1) \
++ CandidatesForO.trim(N-1,-1) ++ Source.trim(N+2,0)
}
function RX(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. RX(101, 5) would replace 101,102,103,104,105 , by using 100 and 106 as reference points for mflowfps 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 = MSuper()
backward_vec = MAnalyse(super, isb = true)
forward_vec = MAnalyse(super, isb = false)
MFlowFps(super, backward_vec, forward_vec, blend=false, num=X+1, den=1) #num=X+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)
}
###
#####interpolate bad frames and residual cleaning
###
Super = msuper()
bv1 = manalyse(Super, isb=true, delta=2)
fv1 = manalyse(Super, isb=false, delta=2)
bv2 = manalyse(Super, isb=true, delta=3)
fv2 = manalyse(Super, isb=false, delta=3)
global CandidatesForN = mflowinter(Super, bv2, fv2, time=33.3, ml=100)
global CandidatesForO = mflowinter(Super, bv2, fv2, time=66.7, ml=100)
global CandidatesForC = mflowinter(Super, bv1, fv1, time=50.0, ml=100)
last
#rx(104,12) #104-116 replaced
I get the error message:
AviSynth open failure:
Script error: Invalid arguments to function "msuper"
InterpolateBadFrames.avs line 55
I've tried a couple of different versions of MVTools2 but it doesn't make any difference. Is there anything obviously wrong with the script that anyone can see? I've tried several other multiple sequential frame replacers from this thread and elsewhere which either don't work so well or are impossibly complicated to use (for me) and was hoping to get this one going to see how it does. So far, for me the only one of these that does a good job is Gavino's FixBadFrames, but it only works on single frames.
Gavino
26th March 2012, 00:24
Is there anything obviously wrong with the script that anyone can see?
The script is incomplete. You need to add your source filter:
function R(clip Source, int N)
{
...
}
function RP(clip Source, int N)
{
...
}
function RX(clip Source, int N, int X)
{
...
}
<------ Your source goes here, eg AviSource("myvid.avi")
###
#####interpolate bad frames and residual cleaning
###
Super = msuper()
...
manono
26th March 2012, 04:46
Thanks for the response. I wasn't clear about how I'm doing this. I'm importing the function as an AVS and then calling it in the script:
LoadPlugin("C:\Path\To\MVTools2.dll")
Import("C:\Path\To\InterpolateBadFrames.avs")
AVISource("C:\Path\To\Movie.avi")
rx(104,12) #104-116 replaced
However, even when I do it as you suggest, using it as the main script and adding in the AviSource line where you said, I still get the MVTools2 msuper error.
Gavino
26th March 2012, 10:09
even when I do it as you suggest, using it as the main script and adding in the AviSource line where you said, I still get the MVTools2 msuper error.
Odd, I don't see why it shouldn't work.
Your initial approach should also work (with the original avs) if you put the Import call after the source filter, ie
LoadPlugin("C:\Path\To\MVTools2.dll")
AVISource("C:\Path\To\Movie.avi")
Import("C:\Path\To\InterpolateBadFrames.avs")
rx(104,12) #104-116 replaced
Note also that if you are only using function rx, you can delete the script lines (starting from the offending Super=msuper()) at the end of the avs, as they set up globals only needed for functions R and RP.
cobo
26th March 2012, 13:30
@manono
I tried your script and it's working without error with both mvtools 2,5,11.0 and 2.6.0.0, but instead of interpolating
it results in a freezeframe of the previous frame for the number of frames specified.
Mug Funkys Morph function (http://forum.doom9.org/showthread.php?t=161154) works well and is easy to use. I find the interpolation is better with blocksize 32
and thSDC1 set to 800, so I use this:
# http://forum.doom9.org/showthread.php?t=161154
# morph by Mug Funky
# usage:
# if you have, say, frames 21 and 22 bad, then use "morph(20,23)"
#
function morph (clip c, int in, int "out", int "blksize")
{
Function fill_loop(string s, int stop, int count)
{
return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=800,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count)
#return (stop == 0) ? s : string("tofill.mflowinter(morph_spr,fill_vb,fill_vf,time=" + string(100*(count - stop)/float(count))) + ",thscd1=255,thscd2=255).selectevery(tofill.framecount(),0)," + fill_loop(s,stop-1,count)
}
out=default(out, 0)
blksize=default(blksize,32)
d=c.trim(in,out)# in-1?
numframes=d.framecount-2
tofill=d.selectevery(c.framecount(),0,c.framecount()-1)
global morph_spr=tofill.msuper()
fill_vf=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=false,overlap=blksize/2)
fill_vb=morph_spr.manalyse(truemotion=true,blksize=blksize,isb=true,overlap=blksize/2)
filled=eval("interleave(" + fill_loop("" ,d.framecount()-1,d.framecount()-1) + "tofill.selectevery(tofill.framecount(),tofill.framecount())).assumefps(c.framerate())")
c.trim(0,-(in+1))++filled.trim(1,numframes)++c.trim(out,0)
}
Gavino
26th March 2012, 16:56
I tried your script and it's working without error with both mvtools 2,5,11.0 and 2.6.0.0, but instead of interpolating it results in a freezeframe of the previous frame for the number of frames specified.
Well, I just tried it and it definitely interpolates.
However the comment beside the function call is slightly wrong.
rx(104,12) actually replaces frames 104-115 (by gradual interpolation between 103 and 116).
The comment in the function itself is correct.
manono
26th March 2012, 22:53
Thanks to you both. I finally got it working by taking Gavino's suggestion to import it after opening the AVI. Thanks a lot for that as I never would have figured it out on my own.
Cobo, I've been using Mug Funky's Morph before now but don't much like it for several reasons, both trivial and important. The important one is the fact if I try to call it more than a dozen-15 times in the script, I get an out of memory error. So the movie has to be broken up into pieces, encoded separately as lossless, and then rejoined. And like the other frame interpolators (except Gavino's FixBadFrames for single isolated frames), a line has to be written for each instance you use it. And you also have to plug in the frame numbers before and after the frames that actually need fixing, something I find counterintuitive and annoying. This InterpolateBadFrames seems to behave in the same way. One should be able to both write in only the frames needing fixing, and be able to do it within a single all-encompassing line, something like:
FixAllBadFrames([21 21] [50 51] [100 104] [200 208] [300 302])
where the frame numbers are the first and last needing fixing. Something like that. "OK, manono, if you're so particular write the function to suit yourself." If only. Plus, Gavino has explained to me outside this thread that is a very difficult, if not impossible, thing to accomplish. Thanks again.
cobo
27th March 2012, 06:41
It looks like I'm only getting the freezeframe effect when using FFmpegSource2 with H264 or mpeg2, otherwise the script interpolates as it should. The script works no matter where I put the source or import the avs.
I don't get an out of memory error even with dozens of morph calls. Can you use more than 15 calls of the RX function without getting the out of memory error?
StainlessS
27th March 2012, 08:24
Can you lot please take a peek here and air any views you may have.
http://forum.doom9.org/showthread.php?p=1567221#post1567221
manono
27th March 2012, 10:13
It looks like I'm only getting the freezeframe effect when using FFmpegSource2 with H264 or mpeg2...
I ran into the freezeframe too, and I'm not quite sure why. It was when using RX from that function I just got going. About a fifth or so of the times I used it resulted in freezeframes, using AVISource on a Lagarith AVI. It seems to happen when more sequential frames are being interpolated (6 or 7), and when the frames are complex (lots of motion). But other times it worked fine with similar sets of frames.
Can you use more than 15 calls of the RX function without getting the out of memory error?
I did get an out of memory error once, but it was during the encode and didn't pinpoint RX as the cause. When using Morph I get it just loading the script if too many frames are being interpolated.
manono
27th March 2012, 10:25
Can you lot please take a peek here and air any views you may have.
http://forum.doom9.org/showthread.php?p=1567221#post1567221
I haven't any interest in pulling good frames from one source to replace damaged frames in another. I'm making 2 caps of each of these movies on VHS and have yet to find any frames in one that aren't also damaged in the other. Perhaps others might be interested.
As I mentioned, I'm most interested in having a function to interpolate frames well and in the easiest manner possible. And I speak for no one but myself.
StainlessS
27th March 2012, 10:35
@Manono
The idea I had was to overcome what I guess is refered to here:
Plus, Gavino has explained to me outside this thread that is a very difficult, if not impossible
For say just a pair of damaged frames you create a clip where each frame is the first frame of a repaired pair,
and the second clip would contain all of the second frames of the repaired pair (both originated from the
damaged source clip). Would be a sort of two dimensional array of repaired frames.
EDIT:
I'm most interested in having a function to interpolate frames well and in the easiest manner possible.
Me too.
source clip : 1 2 3 4 5 6
repair clip 1 : 1A 2A 3A 4A 5A 6A # where 3A generated from frames 2 and 5
repair clip 2 : 1B 2B 3B 4B 5B 6B # where 3B generated from frames 2 and 5
A command of something like "CI_PAIR 3"
would produce: 1 2 3A 3B 5 6
IF you can figure out a way to get repair clip 1 and repair clip 2, then I can
get ClipClop to do the remainder. Same applies to eg 17 frame interpolation. (ClipClop supports up to 255 replacement clips)
Gavino
27th March 2012, 12:11
The idea I had was to overcome what I guess Gavino PM'ed you as impossible.
For say just a pair of damaged frames you create a clip where each frame is the first frame of a repaired pair, and the second clip would contain all of the second frames of the repaired pair (both originated from the damaged source clip).
That is basically what the code in manono's script does when it sets up the global 'candidate' clips used by the RP function. You could then, as you suggest, package all the replacements into a single call to ClipClop instead of calling RP multiple times.
However, that only handles the case where all the replacements are pairs. What manono wants (and 2Bdecided also asked for this in post #33) is a single generic function that you just supply with an arbitrary list of bad frames and it does everything for you.
This is difficult because you would have to generate a different set of replacement clips for each different-sized 'gap' between good frames, with different motion vectors, etc.
StainlessS
27th March 2012, 12:18
Yes am aware of that, 2 - 17 sets of clips would be (I think) be 152 clips, less than 255
supported by ClipClop, there would of course have to be some limit on the number.
EDIT: OK, I just looked at post #33 and see what you mean.
EDIT: Would clips not used have a prohibitive overhead?
EDIT: So would the suggested mod be of use?
StainlessS
27th March 2012, 19:02
EDIT: Assuming a plug (not taking nor returning a clip) constructor can be called before another
then doing the list of single frame fixes, by 2bdecided etc could be possible if not quite easy, you
just need a file fomat converting plugin, provided that the number of frames to be interpolated is
supported in the fixing function.
Jenyok
13th November 2012, 09:35
Restore (replace) bad frame(s) with interpolation.
There are two different functions of interpolation.
Part 1.
.
#
#
# Ver. 1.4
# 12.11.2012 year
#
#
# File: Interpolate_Bad_Frames.avsi
# License GNU
# AviSynth 2.5.8
# VirtualDub 1.9.11
#
#
# Restore bad frames with interpolation
#
#
# Needed plugins and libruaries:
# MVTools2
# GScript
#
#
# You could write interpolation functions, see script code, up to 60 frames inc.
#
#
# !!! No any checked in interpolate functions are done (Trim() function, see script code).
#
#
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\MVTOOLS-V2_5_11_3\mvtools2.dll")
LoadPlugin("C:\PROGRAM FILES\AVISYNTH 2.5\PLUGINS\GSCRIPT_11\gscript.dll")
function Interpolate2(clip clp, int FrameNumber, int FrameInterpolate)
{
# Constants
# Change those constants to tune for the best result of interpolation
#
# MAnalyse
blks = 16 # 8
blksV = blks
overlap = 0
overlapV = 0
search = 5 # 2
searchparam = 3 # 3
dct = 5 # 5
#
# MSuper
# hpad = blks / 2 # 4
# vpad = blksV / 2
hpad = 2 # 4
vpad = 2
pel = 4 # 4
rfilter = 4 # 4
sharp = 2 # 2
#
# MFlowInter
tCD1 = 300 # 1500
tCD2 = 128 # 130
iml = 70 # 70
# Restore bad frames with interpolation with MFlowInter
# Prepare functions
#
# function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
# int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
#
super = MSuper(clp, \
hpad = hpad, \
vpad = vpad, \
pel = pel, \
levels = 0, \
chroma = true, \
sharp = sharp, \
rfilter = rfilter, \
isse = true, \
planar = false)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
backward_vectors = MAnalyse(super, \
blksize = blks, \
blksizeV = blksV, \
levels = 0, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
isb = true, \
lambda = 0, \
chroma = true, \
delta = FrameInterpolate + 1, \
truemotion = true, \
lsad = 1200, \
plevel = 0, \
global = true, \
pnew = 50, \
pzero = 50, \
pglobal = 0, \
overlap = overlap, \
overlapV = overlapV, \
dct = dct, \
divide = 0, \
sadx264 = 0, \
badSAD = 10000, \
badrange = 24, \
isse = true, \
meander = true, \
temporal = false, \
trymany = false)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
forward_vectors = MAnalyse(super, \
blksize = blks, \
blksizeV = blksV, \
levels = 0, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
isb = false, \
lambda = 0, \
chroma = true, \
delta = FrameInterpolate + 1, \
truemotion = true, \
lsad = 1200, \
plevel = 0, \
global = true, \
pnew = 50, \
pzero = 50, \
pglobal = 0, \
overlap = overlap, \
overlapV = overlapV, \
dct = dct, \
divide = 0, \
sadx264 = 0, \
badSAD = 10000, \
badrange = 24, \
isse = true, \
meander = true, \
temporal = false, \
trymany = false)
GScript("""
if (FrameInterpolate == 1) {
inter2 = MFlowInter(clp, \
super, \
backward_vectors, \
forward_vectors, \
time = 50, \
mL = iml, \
blend = true, \
thSCD1 = tCD1, \
thSCD2 = tCD2, \
isse = true, \
planar = false)
inter = inter2.Trim(FrameNumber, -1)
} # End of If-Then
else {
# Fill an Inter variable with the MFlowInter() clips with different times
# Times are calculated in each step
#
for (i=0, FrameInterpolate-1) {
itime = (100.0 / Float(FrameInterpolate + 1)) * Float(i + 1)
inter2 = MFlowInter(clp, \
super, \
backward_vectors, \
forward_vectors, \
time = itime, \
mL = iml, \
blend = true, \
thSCD1 = tCD1, \
thSCD2 = tCD2, \
isse = true, \
planar = false)
if (i == 0) {
inter = inter2.Trim(FrameNumber, -1)
} # End of If-Then
else {
inter = inter ++ inter2.Trim(FrameNumber, -1)
} # End of If-Else
} # End of For ()
} # End of If-Else
""") # End of GScript ()
return (inter)
}
# Example, 10 bad frames to interpolate
#
function TenFrames(clip clp, int N)
{
# N is number of the first frame in Source that needs replacing.
# Frames N and N + 1 and N + 2 and N + 3 and N + 4 and N + 5 and N + 6
# and N + 7 and N + 8 and N + 9, N + 10 (O) will be replaced.
clp.trim(0, N - 1) ++ Interpolate2(clp, N - 1, 10) ++ clp.trim(N + 10, 0)
}
# Example, 41 bad frames to interpolate
#
function FourtyOneFrames(clip clp, int N)
{
# N is number of the first frame in Source that needs replacing.
# Frames N and N + 1 and N + 2 and N + 3 and N + 4 and N + 5 and N + 6
# and N + 7 and N + 8 and N + 9 ... N + 41 (O) will be replaced.
clp.trim(0, N - 1) ++ Interpolate2(clp, N - 1, 41) ++ clp.trim(N + 41, 0)
}
Jenyok
13th November 2012, 09:36
Restore (replace) bad frame(s) with interpolation.
There are two different functions of interpolation.
Part 2 continiue.
.
#
# Author "manono"
# with changes
#
function RX(clip clp, 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. RX(101, 5) would replace 101, 102, 103, 104, 105 , by using 100 and 106 as reference points for mflowfps interpolation
# Constants
# Change those constants to tune for the best result of interpolation
#
# MAnalyse
blks = 8 # 8
blksV = blks # 8
# overlap = blks / 2
# overlapV = blksV / 2
overlap = 0
overlapV = 0
search = 5 # 2
searchparam = 3 # 2
dct = 5
isse = true
#
# MSuper
# hpad = blks / 2 # 4
# vpad = blksV / 2
hpad = 2 # 4
vpad = 2 # 4
pel = 4 # 4
sharp = 2
rfilter = 4
#
# MRecalculate()
search2 = search
smooth = 1
chroma = true
thSAD = 100
#
# MFlowFps
tCD1 = 300 # 1500
tCD2 = 128 # 130
# Contour artifacts suppression Подавление контурных артефактов
# Simple masking Простое маскирование (mask = 0)
# Simple masking + Static vectors Простое + Статические вектора (mask = 1)
# Simple masking + Vectors of related frames Простое + Вектора смежных кадров (mask = 2)
mask = 2
# Artifact suppression level Степень подавления артефактов
# Light Легкая (ml = 100)
# Medium Средняя (ml = 500)
# High Высокая (ml = 2500)
# Huge Нереальная (ml = 10000)
ml = 10000
# Motion search radius Радиус поиска движения
# 1% frame кадра (spar = 1)
# 3% frame кадра (spar = 3)
# 5% frame кадра (spar = 5)
# 10% frame кадра (spar = 10)
# 25% frame кадра (spar = 25)
# 30% frame кадра (spar = 30)
# 50% frame кадра (spar = 50)
# 100% frame кадра (spar = 100)
spar = 100 # ??? 30%
#
# Variables
dist_h = int((0.01 * spar * Width(clp)) / blks)
dist_v = int((0.01 * spar * Height(clp)) / blksV)
dist = (dist_h > dist_v) ? dist_h : dist_v
dist = (dist > 0) ? dist : 1
start = clp.trim(N - 1, -1) # one good frame before, used for interpolation reference point
end = clp.trim(N + X, -1) # one good frame after, used for interpolation reference point
start + end
AssumeFPS(1.0) # temporarily FPS = 1.0 to use MFlowFps()
start_end = last
# Restore bad frames with interpolation with MFlowInter
# Prepare functions
#
# function MSuper(clip, int "hpad", int "vpad", int "pel", int "levels", bool "chroma", \
# int "sharp", int "rfilter", clip "pelclip", bool "isse", bool "planar")
#
super = MSuper(start_end, \
hpad = hpad, \
vpad = vpad, \
pel = pel, \
levels = 0, \
chroma = true, \
sharp = sharp, \
rfilter = rfilter, \
isse = isse, \
planar = false)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
backward_vectors = MAnalyse(super, \
blksize = blks, \
blksizeV = blksV, \
levels = 0, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
isb = true, \
lambda = 0, \
chroma = true, \
delta = 1, \
truemotion = true, \
lsad = 1200, \
plevel = 0, \
global = true, \
pnew = 50, \
pzero = 50, \
pglobal = 0, \
overlap = overlap, \
overlapV = overlapV, \
dct = dct, \
divide = 0, \
sadx264 = 0, \
badSAD = 10000, \
badrange = 24, \
isse = isse, \
meander = true, \
temporal = false, \
trymany = false)
# function MAnalyse(clip super, int "blksize", int "blksizeV", int "level", int "search", int "searchparam", \
# int "pelsearch", bool "isb", int "lambda", bool "chroma", int "delta", bool "truemotion", \
# int "lsad", int "plevel", bool "global", int "pnew", int "pzero", int "pglobal", int "overlap", \
# int "overlapV", string "outfile", int "dct", int "divide", int "sadx264", int "badSAD", \
# int "badrange", bool "isse", int "full", bool "meander", bool "temporal")
#
forward_vectors = MAnalyse(super, \
blksize = blks, \
blksizeV = blksV, \
levels = 0, \
search = search, \
searchparam = searchparam, \
pelsearch = pel, \
isb = false, \
lambda = 0, \
chroma = true, \
delta = 1, \
truemotion = true, \
lsad = 1200, \
plevel = 0, \
global = true, \
pnew = 50, \
pzero = 50, \
pglobal = 0, \
overlap = overlap, \
overlapV = overlapV, \
dct = dct, \
divide = 0, \
sadx264 = 0, \
badSAD = 10000, \
badrange = 24, \
isse = isse, \
meander = true, \
temporal = false, \
trymany = false)
# function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
# int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
# int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
# int "sadx264", bool "isse")
#
backward_recalc = MRecalculate(super, \
backward_vectors, \
thSAD = thSAD, \
smooth = smooth, \
blksize = blks, \
blksizev = blksV, \
search = search2, \
searchparam = dist, \
chroma = chroma, \
truemotion = true, \
overlap = overlap, \
overlapv = overlapV, \
dct = dct, \
divide = 0, \
isse = isse)
# function MRecalculate(clip super, clip vectors, int "thSAD", int "smooth", int "blksize", int "blksizeV", \
# int "search", int "searchparam", int "lambda", bool "chroma", bool "truemotion", \
# int "pnew", int "overlap", int "overlapV", string "outfile", int "dct", int "divide", \
# int "sadx264", bool "isse")
#
forward_recalc = MRecalculate(super, \
forward_vectors, \
thSAD = thSAD, \
smooth = smooth, \
blksize = blks, \
blksizev = blksV, \
search = search2, \
searchparam = dist, \
chroma = chroma, \
truemotion = true, \
overlap = overlap, \
overlapv = overlapV, \
dct = dct, \
divide = 0, \
isse = isse)
# function MFlowFPS(clip source, clip super, clip mvbw, clip mvfw, int "num", int "den", int "mask", \
# float "ml", bool "blend", int "thSCD1", int "thSCD2", bool "isse", bool "planar")
#
MFlowFps(start_end, \
super, \
backward_recalc, \
forward_recalc, \
num = X + 1, \
den = 1, \
mask = mask, \
ml = ml, \
blend = false, \
thSCD1 = tCD1, \
thSCD2 = tCD2, \
isse = isse, \
planar = false)
AssumeFPS(FrameRate(clp)) # return back to normal source framerate for joining
Trim(1, framecount - 1) # trim ends, leaving replacement frames
Interpolate = last
clp.trim(0, -N) ++ Interpolate ++ clp.trim(N + X + 1, 0)
return (last)
}
manono
13th November 2012, 22:04
# Author "manono"
Except I didn't write it, but only use it to replace two or more consecutive bad frames when needed. I don't know who wrote it or I'd happily give credit where credit is due. For single frames needing replacing, I use Gavino's FixBadFrames:
function FixBadFrames(clip c, string frames) {
# Replace each frame from a list of 'bad' frames by using MFlowInter to interpolate
# between the nearest pair of 'good' frames
c
sup = MSuper()
bv = MAnalyse(sup, isb=true, delta=2)
fv = MAnalyse(sup, isb=false, delta=2)
candidates = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0)
ReplaceFramesSimple(candidates, mappings=frames)
}
#Usage FixBadFrames("34 64 96")
I don't know if it's any better than the other one but it's easier to use (less typing). You just have to type in the frame numbers needing replacing. In addition to the usual stuff it also needs stickboy's RemapFrames.dll.
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.