Hi everyone,
Today I'd like to talk about Glitch or with my words, "bad lines".
How can I remove them ?
But first, I will show you 2 kind of glitch : black&white + colors
It appears on 3/4 frames. But like a blink at normal speed.
Thank you
+ Reply to Thread
Results 1 to 30 of 53
-
Last edited by TONYFRANCE; 2nd Apr 2018 at 00:58.
-
You can interpolate over the "bad" frames using data from the adjacent "good" frames . e.g using avisynth/mvtools2. This method replaces the entire bad frames, but you can combine with more selective masks to repair parts of frames. Unfortunately, this approach means manual identification of frame numbers - so some work involved
So in the 1st example, RX(13,3) means frames 13,14,15 are replaced
Code:AVISource("glitch1video.avi") RX(13,3) 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) }
Code:AVISource("glitch2video.avi") RX(12,3)
Other methods include a more precise repair in after effects / photoshop
The problem here is selectivity - you want to repair the defect without damaging other parts -
Manual ? It happens during all the film...
There is no automatic detection ? Or should I use the same kind of software that people use for 35mm film (to remove dirt) ?
https://www.youtube.com/watch?v=VYUeKK9Vhns -
I forget the name of the avisynth filter that can take multiple VHS captures (you have to capture the tape multiple times) and then averages them into a single averaged copy to try and suppress noise and errors. But if this error happens in the exact same place every time then it can't average it out. Also don't want to be capturing this in DV but maybe lossless YUY2.
-
That would be the Median Filter.
And, as mentioned, it's necessary that the same artifacts not appear on all copies in the same places. -
The nature of the defect is different than "dirt. " . This is not characterized as "dirt"
The duration is 3-4 frames, and the location "lingers" over the same area in the duration (dirt is usually only 1 frame, the location changes) .
But "dirt" can usually be removed "automatically" in avisynth too. The effectiveness is actually quite close to professional restoration software in "automatic" mode.
Professional restoration approaches like pfclean use semi manual repairs too for lingering defects that occur over multiple consecutive frames in the same location. In fact, there is more manual work and masking, but it's meant for a more targeted repair. The quality of the repair is higher because you're spending more time on it manually
The problem here, again, is selectivity. You don't want to damage the other frames, or even parts of the same frame. An "automatic" filter strong enough to eliminate that defect would seriously degrade the other parts -
Try converting the tape again and use a DVD recorder to condition the line timing. It may help.
-
You can sometimes use tricks to remove defects that appear for a few, but more than one, frame. For spots that appear over two consecutive frames:
Code:even = SelectEven().RemoveDirtMC(20) odd = SelectOdd().RemoveDirtMC(20) Interleave(even, odd)
Code:even = SelectEven() ee = even.SelectEven().RemoveDirtMC(20) eo = even.SelectOdd().RemoveDirtMC(20) even = Interleave(ee, eo) odd = SelectOdd() oe = odd.SelectEven().RemoveDirtMC(20) oo = odd.SelectOdd().RemoveDirtMC(20) odd = Interleave(oe, oo) Interleave(even, odd)
Code:AviSource("glitch1video.avi") SeparateFields() even = SelectEven() ee = even.SelectEven().RemoveDirtMC(30) eo = even.SelectOdd().RemoveDirtMC(30) even = Interleave(ee, eo) odd = SelectOdd() oe = odd.SelectEven().RemoveDirtMC(30) oo = odd.SelectOdd().RemoveDirtMC(30) odd = INterleave(oe, oo) Interleave(even, odd) RemoveDirtMC(30) Weave()
You have to be careful when using "dirt" removal filters like this. Sometimes real picture elements appear on single frames and they will disappear. Things like footballs in motion, panning star fields, etc.Last edited by jagabo; 2nd Apr 2018 at 09:47.
-
Stupid question : I downloaded "Film_Restoring_vs_06_2012"
But I don't know what to do to avoid the virtualdub message : There is no function named "RemoveDirtMC" -
Download RemoveDirtMC.avs and import it into your script.
Code:import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs")
-
Where can I find this filter ?
Here ? https://pastebin.com/PgkQc9X4
Then, I need to cut/paste into an .avs file ? -
The one I'm currently using looks like:
Code:#REMOVE DIRT FUNCTION #................................................. .................................................. .................................................. ................. function RemoveDirt(clip input, int limit, bool _grey) { clensed=input.Clense(grey=_grey)#, cache=4) alt=input.RemoveGrain(2) return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3, dmode=2,debug=false,noise=limit,noisy=4, grey=_grey) # Alternative settings # return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=li mit,noisy=12,grey=_grey,show=true) # return RestoreMotionBlocks(clensed,input,alternative=alt, pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_ grey,show=false) } function RemoveDirtMC(clip clip,int limit, bool "_grey") { _grey=default(_grey, false) limit = default(limit,6) i=MSuper(clip,pel=2) bvec = MAnalyse(i,isb=true, blksize=8, delta=1, truemotion=true) fvec = MAnalyse(i,isb=false, blksize=8, delta=1, truemotion=true) backw = MFlow(clip,i,bvec) forw = MFlow(clip,i,fvec) clp=interleave(backw,clip,forw) clp=clp.RemoveDirt(limit,_grey) clp=clp.SelectEvery(3,1) return clp } function RemoveSpots(clip clp, int "repmode", bool "_grey") { _grey = Default(_grey, false) repmode = Default(repmode, 16) clmode = 17 clensed = Clense(clp, grey=_grey)#, cache=4) sbegin = ForwardClense(clp, grey=_grey, cache=-1) send = BackwardClense(clp, grey=_grey, cache=-1) alt = Repair(SCSelect(clp, sbegin, send, clensed, debug=true), clp, mode=repmode, modeU = _grey ? -1 : repmode ) restore = Repair(clensed, clp, mode=repmode, modeU = _grey ? -1 : repmode) corrected = RestoreMotionBlocks(clensed, restore, neighbour=clp, alternative=alt, gmthreshold=70, dist=1, \ dmode=2, debug=false, noise=10, noisy=12, grey=_grey) return corrected }
-
You can put the import line anywhere, but I like to import stuff at the start of the script:
Code:import("C:\Program Files (x86)\AviSynth\plugins\RemoveDirtMC.avs") # change path if necessary AviSource("glitch1video.avi") even = SelectEven().RemoveDirtMC(20) odd = SelectOdd().RemoveDirtMC(20) Interleave(even, odd)
-
MSuper is part of mvtools2 . So either put mvtools2.dll in the plugins folder to autoload; or load it manually with LoadPlugin("PATH\mvtools2.dll") in the script
-
Code:
import("D:\Nouveau dossier (2)\Nouveau dossier\RemoveDirtMC.avs") LoadPlugin("C:\Users\JEAN\Desktop\mvtools-v2.5.11.22\mvtools2.dll") LoadPlugin("C:\Users\JEAN\Desktop\RgTools-x86\RgTools.dll") AviSource("glitch1video.avi") even = SelectEven().RemoveDirtMC(20) odd = SelectOdd().RemoveDirtMC(20) Interleave(even, odd)
-
Code:
Video: Frame size, fps (µs per frame): 720x576, 25.000 fps (40000 µs) Length: 30 frames (0:01.20) Decompressor: MainConcept DV Codec 2.0.4 (dvsd) Number of key frames: 30 Min/avg/max/total key frame size: 144000/144000/144000 (4219K) Min/avg/max/total delta size: (no delta frames) Data rate: 28800 kbps (0.02% overhead) Audio: Sampling rate: Channels: Sample precision: Compression: Layout: Length: Min/avg/max/total frame size: Data rate:
-
It's probably converting to RGB . (not ideal)
You can check with AVISource("glitch1video.avi").Info() to see what it's returning
By default, AVISource() uses the system installed VFW decoder. I think mainconcept can be configured to return 4:2:0 in the configuration. I don't have it installed right now but I recall there were some options.
Or uninstall it and use another decoder like cedocida -
Now it works. With this code :
Code:import("D:\Nouveau dossier (2)\Nouveau dossier\RemoveDirtMC.avs") LoadPlugin("C:\Users\JEAN\Desktop\mvtools-v2.5.11.22\mvtools2.dll") LoadPlugin("C:\Users\JEAN\Desktop\RgTools-0.96\x86\RgTools.dll") LoadPlugin("C:\Users\JEAN\Desktop\RemoveDirt\RemoveDirt.dll") AviSource("glitch1video.avi") ConvertToYV12() SeparateFields() even = SelectEven() ee = even.SelectEven().RemoveDirtMC(30) eo = even.SelectOdd().RemoveDirtMC(30) even = Interleave(ee, eo) odd = SelectOdd() oe = odd.SelectEven().RemoveDirtMC(30) oo = odd.SelectOdd().RemoveDirtMC(30) odd = INterleave(oe, oo) Interleave(even, odd) RemoveDirtMC(30) Weave()
-
It's not ideal if it's returning RGB (clipping data , superbright/dark clipping) . Not only is the quality worse, it's slower with unnecessary conversions .
Or you can use another source filter like ffms2 . But it requires indexing (slower, clutter) , but it will return the native original colorspace, even for NTSC DV (4:1:1) . -
Instead of
Code:AviSource("glitch1video.avi") ConvertToYV12(interlaced=true)
Code:AviSource("glitch1video.avi", pixel_type="YV12")
Last edited by jagabo; 2nd Apr 2018 at 16:42.
-
-
-
The filter works good but as said before, if I need to do it scene by scene, it's too much work.
glitch1video.avi and glitch2video.avi are the original files that was captured with my ADVC110.
Even the bitrate is untouched. -
If these videos are very important to you consider getting an old Panasonic ES10 or ES15 DVD recorder to use as passthrough to clean up the time base. It may fix a lot of these problems as well as reducing the horizontal jitter on the rest of the frame.
-
These films are not the first priority of my life. Just want to discover and learn, for future... and also, I'm maybe a little bit crazy yeah
Want to do the best I can do when I work.
I bought my JVC in 2016, sealed. I'm sure it's not a problem from the vcr, dirty heads or else.
And I also heard that sometimes, watching your tape in a simple 2 heads vcr is enough.
Watch the same tape in a high model can provoke issues.
Is that true ?
Similar Threads
-
Glitch effect
By thetntgamer in forum EditingReplies: 0Last Post: 11th Dec 2017, 07:02 -
Kdenlive glitch
By DeJay in forum LinuxReplies: 11Last Post: 15th Apr 2017, 09:06 -
How to get rid of this glitch?
By newpball in forum AudioReplies: 5Last Post: 5th Jun 2015, 18:02 -
Can someone ID this type of glitch/damage??
By hckychik154 in forum Newbie / General discussionsReplies: 15Last Post: 26th Dec 2014, 16:36 -
AviUtl KeyFrame glitch
By smike in forum Video ConversionReplies: 18Last Post: 3rd Aug 2014, 00:11