Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
25th February 2015, 02:12 | #1 | Link | ||
Registered User
Join Date: Feb 2015
Posts: 31
|
Script and Time?
Hi folks,
I'm using two AviSynth scripts, posted below, to improve/clean the video of many old VHS (NTSC) tapes that I have. It has many horizontal waves (lines) or fixed lines on the image. I'm capturing VHS tapes with a Panasonic AG-1980 videotape. Also, I'm using a DVD Panasonic DMR-ES10 to pass through (with all the filters 'on') aiming to strike as many horizontal wave as possible. My PC is an AMD 8350 4.0 Ghz 16GB is taking 6 hours to run the script. And my laptop - an Intel Core I7 2630QM 2.0 Ghz 8GB is taking 20 hours to run it. So, please: Do you know why is taking so much time to execute the script using the Core i7 laptop? Is there some way to decrease the 'process time' modifying the script below (trying to keep the quality output)? Thank you very much! Script 1 Quote:
Quote:
Last edited by NLPguy; 25th February 2015 at 06:26. |
||
25th February 2015, 02:24 | #2 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
Boy, this sure seems like the wrong script for fixing VHS tapes! Post a few seconds of one of your captures and let's see what you're trying to fix.
I see two reasons this script runs slow: 1. You are doing WAY too much to your poor video. 2. You are using DCT=5 in the Manalyze calls. Set that to DCT=0 instead. |
25th February 2015, 15:20 | #3 | Link | |
Registered User
Join Date: Feb 2015
Posts: 31
|
Hi John,
I tried to upload the video but the forum doesn't permitted. It has a m2v extension. So, I upload it to youtube. Maybe it can help. Video Link: https://www.youtube.com/watch?v=MqknHaOm_wk Thank you. Quote:
|
|
25th February 2015, 15:28 | #4 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Hi there.
The guys aint gonna like the Youtube messed with version. You need to post on some file host site eg MediaFire or SendSpace (SendSpace dont need registration I think). Max file size for forum is about 200/300 KB so probably no good anyways.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? |
25th February 2015, 16:02 | #5 | Link | |
Registered User
Join Date: Feb 2015
Posts: 31
|
Thank you for your help Stainless,
I did remember that I have a mega.nz account. Thus, I've just uploaded the video there. Link: https://mega.nz/#!sF1xXTwS!BBWmWB5UN...fz3BLoRTpyKo14 Quote:
|
|
25th February 2015, 18:42 | #6 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
The noise in the script can be fixed by the usual scripts that many of us have posted before. You can search on my name and "VHS" for some of my contributions.
The bounce can be removed by Deshaker, a plugin for VirtualDub. The tearing is the most interesting problem. I separated the video into fields, and in most cases, the noise is only present in one field. This opens up the possibility of doing the following: 1. Create motion estimated versions of both fields; 2. Use one of StainlessS' functions to detect an even field that doesn't match either the previous or following even field. This indicates a glitch. 3. Replace that glitch with the motion estimated version, using conditional logic. I didn't have time to figure out how to use StainlessS' code to do the detection, so I just did it manually. I bobbed, and then replaced each broken field with a motion estimated version, using a delta of 2 in the MVTools2 call (this uses the adjacent "fields" when working on bobbed video). I used the old "filldrops" code to do this. I then re-weaved using the selectevery(4,0,3) followed by a weave. I then ran this through the VHS denoising script that I've posted many times (basic MDegrain2 stuff). I tried both Deshaker and also the commercial Mercalli stabilization tools. They both did a good job stabilizing the footage, but the borders were too funky, or I had to zoom in too much to cover the borders, so I didn't do any stabilization. This is the result, in DV format: Deglitched & denoised I used lossless codecs for my intermediate renders. There are still a couple of glitches that were more than one field in duration. Nothing is perfect ... |
25th February 2015, 22:03 | #7 | Link | |
Registered User
Join Date: Feb 2015
Posts: 31
|
Hi John,
I really liked what you did with the video. I'm a beginner with Avisynt and the script that I was using I did copy from another member. I'm searching for your old posts. I need to learn more about these effects that you told about. Please, if it's possible, Could you write the script that you used? Thank you very much (again)! Quote:
|
|
25th February 2015, 22:52 | #8 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
StainlessS may be able to suggest which of his functions might be used to spot the "glitch" frames on the bobbed version of the video. It would be much nicer not to have to do the glitch detection manually.
I'll post the noise reduction script when I get back to my main editing computer. |
25th February 2015, 23:59 | #9 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
This is my basic VHS video denoising script, more or less from the MVTools2 documentation. I've posted more or less this same thing several times. It provides a good starting point.
This script is designed for removing "snow" type noise. Other problems will require additional plugins and code. You always have to "tune" any script to suit your particular video. There is no "best" or one-size-fits-all. Code:
#Denoiser script for interlaced video using MDegrain2 SetMemoryMax(768) Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll") LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll") SetMTMode(5,6) source=AVISource("E:\fs.avi").killaudio().AssumeBFF() SetMTMode(2) chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS output=MDegrain2i2(chroma,8,2,0) #stackhorizontal(source,output) return output #------------------------------- function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct") { Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc Hshift=0 # determine experimentally overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8) dct=default(dct,0) # use dct=1 for clip with light flicker fields=source.SeparateFields() # separate by fields #This line gets rid of vertical chroma halo. Don't use unless you have the problem #fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift)) super = fields.MSuper(pel=2, sharp=1) backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct) forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct) backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct) forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct) #Increase thSAD for more denoising. Won't do much beyone about 1500 MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) Weave() } Last edited by johnmeyer; 26th February 2015 at 00:17. Reason: corrected typo that I missed |
27th February 2015, 18:37 | #10 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Sorry guys, Been having some hardware problems for a few days.
This is about as good as I could find, but is far from perfect and does make some mistakes. (req RT_Stats and Zebra). Code:
AVISource("D:\NLPGuy\source.avi").Assumetff.SeparateFields.SelectEven CMD = "EvenCmd.txt" RT_FileDelete(CMD) ZEBRA_LO=220 ZEBRA_HI=255 LOCATE_LO=200 LOCATE_HI=255 Z =Last.Zebra(lo=ZEBRA_LO,hi=ZEBRA_HI).Crop(5*48,0,-0,-0) # EDIT: Crop to select YInRange Band ZP=Z.DeleteFrame(Z.Framecount()-1).DuplicateFrame(0) # Shift clip to align previous with current frame ZN=Z.DuplicateFrame(Z.Framecount()-1).DeleteFrame(0) # Shift clip to align next with current frame X=Subtract(Z,Merge(ZP,ZN)) X=X.ScriptClip(""" n=current_frame Bingo=RT_YInRangeLocate(Last,n=n,Baffle_W=48,Baffle_H=1,lo=LOCATE_LO,hi=LOCATE_HI) # Got to make coords even for YV12 (BINGO) ? Overlay(Last.BlankClip(Width=24,height=(YIRL_H+1)/2*2,color=$FF0000),x=48/2-12,y=RT_BitClr(YIRL_Y,0)) : NOP (BINGO) ? RT_WriteFile(CMD,"1 %d",n,Append=True) : NOP Return Last """) StackHorizontal(Last,X) EDIT:
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 11th May 2022 at 02:40. |
27th February 2015, 20:15 | #11 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,691
|
StainlessS,
Thanks for posting that. The noise detection problem in this video is a little bit similar to the noise bars on that old Kinescope that you helped me me restore a few years ago, so I thought perhaps some of the same code would work here. Hopefully the OP will be able to make good use of it. Here are the results of that old project, in case you forgot: 1955 NFL Football Noise Bars Before-After |
27th February 2015, 20:53 | #12 | Link |
HeartlessS Usurer
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
|
Nope, have not forgotten, still quite amazing results.
If of interest to OP, here was thread:- http://forum.doom9.org/showthread.ph...yinrangeLocate Here script for odd field detect Code:
AVISource("D:\NLPGuy\source.avi").Assumetff.SeparateFields.SelectOdd CMD = "OddCmd.txt" RT_FileDelete(CMD) ZEBRA_LO=220 ZEBRA_HI=255 LOCATE_LO=200 LOCATE_HI=255 Z =Last.Zebra(lo=ZEBRA_LO,hi=ZEBRA_HI).Crop(5*48,0,-0,-0) # EDIT: Crop to select YInRange Band ZP=Z.DeleteFrame(Z.Framecount()-1).DuplicateFrame(0) # Shift clip to align previous with current frame ZN=Z.DuplicateFrame(Z.Framecount()-1).DeleteFrame(0) # Shift clip to align next with current frame X=Subtract(Z,Merge(ZP,ZN)) X=X.ScriptClip(""" n=current_frame Bingo=RT_YInRangeLocate(Last,n=n,Baffle_W=48,Baffle_H=1,lo=LOCATE_LO,hi=LOCATE_HI) # Got to make coords even for YV12 (BINGO) ? Overlay(Last.BlankClip(Width=24,height=(YIRL_H+1)/2*2,color=$FF0000),x=48/2-12,y=RT_BitClr(YIRL_Y,0)) : NOP (BINGO) ? RT_WriteFile(CMD,"1 %d",n,Append=True) : NOP Return Last """) StackHorizontal(Last,X) Code:
AVISource("D:\NLPGuy\source.avi") ECMD="EvenCmd.txt" OCMD="OddCmd.txt" Assumetff SeparateFields E=SelectEven O=SelectOdd pel = 2 # Default as for MSuper(), ie 2, range=1 or 2 or 4 sharp = 2 # Default as for MSuper(), ie 2, range=0 -> 2 rfilter= 2 # Default as for MSuper(), ie 2, range=0 -> 4 ml = 100.0 # Default as for MFlowInter(), ie 100.0, range=greater than 0.0. E_CP = E.DeleteFrame(E.Framecount()-1).DuplicateFrame(0) E_sup = E_CP.MSuper(pel=pel, sharp=sharp, rfilter=rfilter) E_bv = E_sup.MAnalyse(isb=true, delta=2) E_fv = E_sup.MAnalyse(isb=false, delta=2) EC = E_CP.MFlowInter(E_sup,E_bv,E_fv, time=100.0 * 1 / 2 , ml=ml) O_CP = O.DeleteFrame(O.Framecount()-1).DuplicateFrame(0) O_sup = O_CP.MSuper(pel=pel, sharp=sharp, rfilter=rfilter) O_bv = O_sup.MAnalyse(isb=true, delta=2) O_fv = O_sup.MAnalyse(isb=false, delta=2) OC = O_CP.MFlowInter(O_sup,O_bv,O_fv, time=100.0 * 1 / 2 , ml=ml) SHOW=False E_RESULT=ClipClop(E,EC,cmd=ECMD,Show=SHOW) O_RESULT=ClipClop(O,OC,cmd=OCMD,Show=SHOW) Interleave(E_RESULT,O_RESULT) Weave NOTE, I used AssumeTFF. EDIT: You need to run both detection scripts to create the text command files, and then the fix script.
__________________
I sometimes post sober. StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace "Some infinities are bigger than other infinities", but how many of them are infinitely bigger ??? Last edited by StainlessS; 28th February 2015 at 14:56. |
Thread Tools | Search this Thread |
Display Modes | |
|
|