I'm looking for a script to replace bad frames of my choice using SVPflow.
Thanks for your inputs
		
			+ Reply to Thread
			
		
		
		
			 
		
			
	
	
				Results 1 to 30 of 59
			
		- 
	*** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
- 
	Me too. So far I'm using a script that still does it the 'old-fashioned' way. My understanding is that the improvement won't be all that much. I don't believe one updated for SVPFlow has been made available yet. And I have no idea how to convert my current script. 
- 
	This is renamed from some other script that was posted here before, RX(). 
 
 There was a simpler version which only replaced one frame. R() maybe?Code:function ReplaceFramesMC(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) }
 
 https://forum.videohelp.com/threads/322848-Scripts-and-filters-for-an-Opera-%28sample-v...=1#post2091091Last edited by jagabo; 22nd Jan 2013 at 21:01. 
- 
	Yes, I was thinking you might be able to modify it to use SVPFlow(). Never used SVPFlow() myself. 
- 
	I haven't ever seen that page before and, yes, there's some pretty good evidence there. 
 
 So, do you know how to convert that script jagabo put up (which, together with another one by Gavino for single frame interpolation are the ones I use) to using SVPFlow? I have no use at all for Interframe.
- 
	Haha RX() was my first function ever! (I had massive help from Gavino of course) 
 
 I tried rewriting it with SVPFlow about a year ago, the problems IIRC were SVSmoothFPS wouldn't accept a variable and converting the vectors to MFlowFPS format using SVConvert (instead of using SVSmoothFPS for the interpolation) didn't work either
 
 I would PM Gavino or ask on Doom9 avisynth forum, because I am pure hack at writing these things. It's probably something simple I overlooked
- 
	I see one way to replace individual frames with SVPFlow -- use it on SelectEven() and SelectOdd() to make two videos with motion interpolated frames at every other frame, then ReplaceFramesSimple() to select frames from those. This won't work if two or more sequential frames are bad though. And it's expensive in terms of CPU usage. Last edited by jagabo; 22nd Jan 2013 at 23:57. 
- 
	
- 
	I almost have it working. Here's a script to replace a single frame with SVPFlow. 
 
 It should probably be modified so that one could pass other arguments like gpu:1 and mt=4.Code:function ReplaceFrameSVPFlow(clip Source, int N) { # N is number of the 1st frame in Source that needs replacing. #e.g. ReplaceFrameSVPFlow(101) would replace 101 , by using 100 and 102 as reference points for interpolation start=Source.trim(N-1,-1) #one good frame before, used for interpolation reference point end=Source.trim(N+1,-1) #one good frame after, used for interpolation reference point start+end AssumeFPS(1) #temporarily FPS=1 to use mflowfps super=SVSuper("{gpu:0}") vectors=SVAnalyse(super, "{}") SVSmoothFps(super, vectors, "{rate:{num:2, den:1}}", url="www.svp-team.com", 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+2,0) }
 
 The problem I'm having for replacing multiple frames is that the rate argument won't take a named variable:
 
 Code:function ReplaceFramesSVPFlow(clip Source, int N, int X) { ... SVSmoothFps(super, vectors, "{rate:{num:X+1, den:1}}", url="www.svp-team.com", mt=1) ... }
- 
	OK, I think I got it: 
 
 Oh, take out the Subtitle() call. I was using it just make the interpolated frames obvious.Code: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:0}") vectors=SVAnalyse(super, "{}") SVSmoothFps(super, vectors, "{rate:{num:"+String(X+1)+", den:1}}", url="www.svp-team.com", mt=1).Subtitle("SVPFlow") 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) }
- 
	Nice work jagabo! That's the problem I was referring to - the named variable "X+1" with SVSmoothFPS 
 
 LOL... It probably only took you a couple of minutes to figure it out. I spend a whole night on the original, and probably even longer trying to adapt it to SVPFLow
- 
	sh... i hate these versions changes, i'll try this J *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
- 
	I'm not always getting real smooth output from ReplaceFramesSVPFlow(). I wonder if the granularity of the numerator and denominator should be higher? 
 
 <edit>
 The problem seems to be in SVPFlow itself. Maybe I'm using it wrong but it gives jerky motion at times. I'm using some smooth scrolling credits from the end of a movie. Just as a test I decimate to 1/4 the number of frames and use SVPFlow() to restore the original frame rate and smooth motion:
 
 The result is jerky. An equivalent script using MVTools:Code:AviSource("SmoothScrolling.avi", audio=false) # 23.976 fps SelectEven() SelectEven() super=SVSuper("{gpu:0}") vectors=SVAnalyse(super, "{}") SVSmoothFps(super, vectors, "{rate:{num:4, den:1}}", url="www.svp-team.com", mt=1)
 
 is much smoother.Code:function SmoothFPS2(clip source, int num, int den) { super = MSuper(source, pel=2, hpad=0, vpad=0, rfilter=4) backward_1 = MAnalyse(super, chroma=false, isb=true, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) forward_1 = MAnalyse(super, chroma=false, isb=false, blksize=16, searchparam=3, plevel=0, search=3, badrange=(-24)) backward_2 = MRecalculate(super, chroma=false, backward_1, blksize=8, searchparam=1, search=3) forward_2 = MRecalculate(super, chroma=false, forward_1, blksize=8, searchparam=1, search=3) backward_3 = MRecalculate(super, chroma=false, backward_2, blksize=4, searchparam=0, search=3) forward_3 = MRecalculate(super, chroma=false, forward_2, blksize=4, searchparam=0, search=3) MBlockFps(source, super, backward_3, forward_3, num, den, mode=0) AviSource("SmoothScrolling.avi", audio=false) # 23.976 fps SelectEven() SelectEven() SmoothFPS2(24000, 1001) }
 
 I'll have to look deeper into the use of SVPFlow.
 
 </edit>Last edited by jagabo; 23rd Jan 2013 at 20:44. 
- 
	Overall is it better than MFlowFps Jagabo ? Post some pix please *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
- 
	From what I've seen, SVPFlow has the potential to return better results than MvTools. It's less prone to generating bent lines and edges (it will blend those lines and edges instead) and other weird artifacts. But it has some problems with the timing of the generated frames. This becomes especially noticeable when generating several frames in a row. 
 
 For example, say an object moves from position 0 to 8 between two frames. And you want to generate 3 intermediate frames. MvTools will position the object at 2, 4, and 6 in the intermediate frames. But SvTools might position it at 1.8, 3.6, and 6.2. So the motion won't be as smooth.
 
 You can't see this in still images so here are some short video samples. I started with some smooth scrolling subtitles and encoded them with x264 to MKV:
 
 source.mkv:
 mvtools:Code:AviSource("SmoothScrolling.avi", audio=false)
 svpflow:Code:AviSource("SmoothScrolling.avi", audio=false) SelectEven() SelectEven() SmoothFPS2(24000,1001)
 As you can see the source video (encoded with x264) is smooth. After reducing the video to 1/4 as many frames, using mvtools to restore the original frame rate gave fairly smooth results. But doing the same with SVPFlow gave jerky results.Code:AviSource("SmoothScrolling.avi", audio=false) SelectEven() SelectEven() super=SVSuper("{gpu:0}") vectors=SVAnalyse(super, "{}") SVSmoothFps(super, vectors, "{rate:{num:4, den:1}}", url="www.svp-team.com", mt=1)
- 
	
- 
	Anonymous344GuestCan either SVPFlow or MvTools interpolate frames without replacing them? For example, if one had a sequence of frames that ran 1,2,3,5 and wanted to interpolate the missing fourth frame using the the third and fifth frames, could either of the scripts above be modified to do this? 
- 
	The original function was named RX(). I found it to be non-descriptive and hard to search for so I changed the name to ReplaceFramesMC(): 
 
 That replaces X frames starting at N. So using your example or replacing only frame 4:Code:function ReplaceFramesMC(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) }
 
 There also was a simpler version which replaced only one frame but I didn't keep it around. If you search for ReplaceFramesMC in my posts you'll probably find links to the original functions.Code:ReplaceFramesMC(video, 4, 1) 
 
 Here's the earliest reference I found with a quick search:
 
 https://forum.videohelp.com/threads/322848-Scripts-and-filters-for-an-Opera-%28sample-v...=1#post2091091
 
 That thread has references earlier but that particular post has a cleaned up version.Last edited by jagabo; 22nd Feb 2013 at 10:05. 
- 
	Anonymous344GuestThanks. I'll search your posts for the original functions, but I'm not sure I've made myself clear. I wasn't talking about replacing the fourth frame in a sequence. I was talking about adding a frame where one was missing, so in my example there is a missing frame that has to be reconstructed using its neighbors, not a bad fourth frame that needs replacing.   
- 
	Ah, I see. I think the function can pretty easily be modified to do what you want. 
- 
	In this example, let's pretend the source was missing 2,7,12....etc 
 
 So the frame numbers are 0,1,3,4,5,6,8, ....
 
 To modify, you just adjust the period and the offset . In this example, 5,2 means 5 is the period (every 5th frame), offset is 2 (start at 2, because numbering in avisynth starts at zero) . So all those lines that say 5,2 , you replace with whatever values match your clip
 
 (you need applyevery.dll for this)
 http://avisynth.org/stickboy/
 
 Code:Orig = WhateverSource() # Make a black clip, the same characteristics as your source BlankClip(Orig) Black=last # Insert black frame in those missing frames (just temporary placeholder, will replace later) Orig InterleaveEvery(Black, 5,2) BlackInserted=last # Generates Missing Frames by interpolation BlackInserted sup = MSuper() bv = MAnalyse(sup, isb=true, delta=2) fv = MAnalyse(sup, isb=false, delta=2) interpolated = MFlowInter(sup, bv, fv, time=50.0, ml=100).DuplicateFrame(0) replace = interpolated.SelectEvery(5,2) # Delete Black Frames DeleteEvery(5,2) # Replace Deleted Frames With Interpolated Frames InterleaveEvery(replace, 5,2) Last edited by poisondeathray; 22nd Feb 2013 at 11:49. 
- 
	Anonymous344GuestAh! That's a clever work-around. So you add black frames where frames are missing and then replace them. In effect, one is inserting "fake" bad frames so that they can be replaced. 
 
 I do have one concern. In your example, it seems as if your source is missing the second frame every five frames. The situation I envisage is if a single frame is missing in the length of a video.
 
 But I suppose if ReplaceFramesMC only replaces the frames that one specifies, I could add black frames where needed and then just use that.
 
 Thanks
- 
	
 LOL , I misunderstood, I thought you meant EVERY 5th frame ... as in when someone accidentally decimates a clip that shouldn't have been
 
 Yes, if it's just 1 frame, you can insert a blank frame (it doesn't have to be blank or black, can be anything) , then use one of the other functions to interpolate/replace it
- 
	Anonymous344GuestThat's all right.  I thought I was being clear but obviously not.  Between you, you and jagabo have given me what I was looking for.  (All the other threads I found envisaged large-scale frame interpolation e.g. doubling the frame-rate for smooth playback:  that's why I asked here instead.)  And your solution brings this thread back on topic after I derailed it slightly, so it's all good.  Thanks again. I thought I was being clear but obviously not.  Between you, you and jagabo have given me what I was looking for.  (All the other threads I found envisaged large-scale frame interpolation e.g. doubling the frame-rate for smooth playback:  that's why I asked here instead.)  And your solution brings this thread back on topic after I derailed it slightly, so it's all good.  Thanks again.
- 
	I'm working on a mod of ReplaceFramesMC() that inserts motion interpolated frames at the indicated position. I'm calling it InsertFramesMC(). It's basically working but the question is what should be done with the audio? 
- 
	Anonymous344Guest
Similar Threads
- 
  Motion Interpolation (VidFIRE) Software?By goodiesguy in forum Video ConversionReplies: 41Last Post: 5th Mar 2016, 18:43
- 
  Videos Play In FF when trying to do motion interpolationBy ndawg101 in forum Software PlayingReplies: 5Last Post: 10th Apr 2011, 05:28
- 
  AviSynth working with Y8 uncompressed AVIs and MVTools motion interpolationBy a1s2d3f4 in forum Newbie / General discussionsReplies: 6Last Post: 10th Nov 2010, 22:32
- 
  Convert m2ts with frame interpolationBy jdark in forum Video ConversionReplies: 3Last Post: 12th Sep 2009, 13:10
- 
  Video interpolation softwareBy VideoYelp in forum Newbie / General discussionsReplies: 4Last Post: 3rd Oct 2008, 01:38


 
		
		 View Profile
				View Profile
			 View Forum Posts
				View Forum Posts
			 Private Message
				Private Message
			 
 
			
			 
			

 Quote
 Quote