Log in

View Full Version : Frame Interpolation From Log txt


blatanibra2
2nd January 2023, 00:43
Hello Everyone, I would need some help with further developing this function if anyone can help,

This function interpolates a specific frame givin the frame number. (shout out to w/e developed it)


function interpolate_frame_GMa_1(clip c, int "frame_number")
{
# interpolate bad frame
sup = c.MSuper()\
bv = MAnalyse(sup, isb=true, delta=2)
fv = MAnalyse(sup, isb=false, delta=2)
interpolated = MFlowInter(c, sup, bv, fv)

#stackhorizontal(c, interpolated)
#return(interpolated)

# replace bad frame with interpolated frame
video_repaired = \
c.trim(0,frame_number-1)++\
interpolated.trim(frame_number-1,-1)++\
c.trim(frame_number+1,0)

# video repaired
return(video_repaired)
}




I tried other interpolation functions, but i come to like the results of this one.

The issue is, my pc can't handle multiple hundreds of lines plus a few other filters.

This is how I run it to interpolate specific frames (example):


interpolate_frame_GMa_1(frame_number=16)
interpolate_frame_GMa_1(frame_number=44)
interpolate_frame_GMa_1(frame_number=122)
interpolate_frame_GMa_1(frame_number=171)
interpolate_frame_GMa_1(frame_number=344)


Would it be possible instead of writing all the lines down to have a log.txt file where the frames are pulled from ?

Gavino has an example of how it can be done, but i have no clue how to put them together.

Gavino's example from this thread


https://forum.doom9.org/showthread.php?t=154022



AVISource("c:\test.avi") # or MPEG2Source, DirectShowSource, some previous filter, etc
super = MSuper()
backward_vectors = MAnalyse(super, isb = true, delta=2)
forward_vectors = MAnalyse(super, isb = false, delta=2)
inter = MFlowInter(super, backward_vectors, forward_vectors, time=50, ml=70)
ConditionalFilter(inter, last, "dup", "==", "true")
ConditionalReader("file.txt", "dup")


where file.txt contains a list of the duplicate frames in the form:

Type Bool
Default false

8639 true
13526 true
... etc ...


could be any other format, just to have it working would be nice

Can anyone help?

Regardkess if it can be done, thanks to forum.doom9 and all the contributors, for all the scripts and functions you guys archived, it's awesome to learn so fast with such great sources