Advice on my first Avisynth attempt? - Page 2 - digitalFAQ Forum
 Forum Advice on my first Avisynth attempt?
 Ask Question Join / Register FAQ Search Today's Posts Mark Forums Read

#21
04-28-2020, 08:52 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
I don't think any filter can do much with that sample. Let's face it, some things just can't be fixed. As for DePulse, I gave up on it years ago. You can try tricks like this:

Code:
ConvertToYV12(interlaced=true)
SeparateFields()
e=SelectEven().TurnLeft().FixRipsP2().TurnRight()
o=SelectOdd().TurnLeft().FixRipsP2().TurnRight()
Interleave(e,o).Weave()
return last

...and use any denoiser you want. But you won't get much for results. Take a look at really old films on Turner Classic Movies and see how much they just lived with regarding old and damaged films.
Someday, 12:01 PM
 Ads / Sponsors Join Date: ∞ Posts: 42 Thanks: ∞ Thanked 42 Times in 42 Posts
#22
04-28-2020, 10:36 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Thanks. I just wanted to make sure there were no stones unturned regarding any techniques I could use.
#23
04-29-2020, 04:02 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
I used badframes() for this issue. I also discovered ReplaceFramesMC2 on this forum. It seems to do a better job, but I don't get any sound for the interpolated clips, unlike with badframes(). Is this to be expected? It did not make a difference if the clip was de-interlaced, though I read that it should be this filter.
#24
04-29-2020, 04:21 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
All versions of ReplaceFrames and RemapFrames work the video but not the audio. You have to save the audio and restore it at the end of the processing. You'll see something like this in many threads:

Code:
vid1=AviSource("path\to\video.avi")
save_audio=vid1
vid1                   #<- original input
processing....
processing....
vid2=last              #<- completed processing

AudioDub(vid2,save_audio)
return last
Use any made-up names you want. http://avisynth.nl/index.php/AudioDub

The other trick is to save the clip's audio in Virtualub as an external .wav file and dub it in later with WavSource().
#25
04-29-2020, 06:18 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Thank you for the quick expert knowledge!
#26
05-01-2020, 01:23 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
From what I read it is recommended to convert back to YUV in VirtualDub upon export (FFV1 has an option to stay in RGB 32). I had to use RGB to color correct, but wouldn't converting back to YUV on export result in further losses due to the conversion? Or is this loss very minor?
#27
05-01-2020, 06:19 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
In my experienced it is minor, nearly transparent. Cleaner than NLE's or encoders. If you want to be really picky, save it as RGB and then run another scriprt that converts RGB>YV12 in VirtualDub, but I never found it made a difference.
#28
05-01-2020, 11:05 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Thank you!
#29
05-03-2020, 10:11 AM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Might you have any idea why de-interlacing would produce audio lag in the video? The interlaced version is fine. I just added this line:

Code:
QTGMC(preset="medium",EZDenoise=2,ChromaNoise=true, ChromaMotion=true,DenoiseMC=true, GrainRestore=0.3, ShowNoise=false, Edithreads=2)
The audio for the before and after files are both 48 khz at 16 bits, constant.

Original (which is longer)
Quote:
 General Complete name : C:\Users\Admin\Desktop\comateens.avi Format : AVI Format/Info : Audio Video Interleave Commercial name : DVCPRO Format profile : OpenDML File size : 6.01 GiB Duration : 28 min 21 s Overall bit rate mode : Constant Overall bit rate : 30.3 Mb/s Video ID : 0 Format : DV Commercial name : DVCPRO Codec ID : dvsd Codec ID/Hint : Sony Duration : 28 min 21 s Bit rate mode : Constant Bit rate : 24.4 Mb/s Width : 720 pixels Height : 480 pixels Display aspect ratio : 4:3 Frame rate mode : Constant Frame rate : 29.970 (30000/1001) FPS Original frame rate : 29.970 (29970/1000) FPS Standard : NTSC Color space : YUV Chroma subsampling : 4:1:1 Bit depth : 8 bits Scan type : Interlaced Scan order : Bottom Field First Compression mode : Lossy Bits/(Pixel*Frame) : 2.357 Stream size : 5.70 GiB (95%) Audio ID : 1 Format : PCM Format settings : Little / Signed Codec ID : 1 Duration : 28 min 21 s Bit rate mode : Constant Bit rate : 1 536 kb/s Channel(s) : 2 channels Sampling rate : 48.0 kHz Bit depth : 16 bits Stream size : 312 MiB (5%) Alignment : Aligned on interleaves Interleave, duration : 467 ms (14.00 video frames)

After
Quote:
 General Complete name : C:\Users\Admin\Desktop\comateens_interview_final_d einterlaced.avi Format : AVI Format/Info : Audio Video Interleave Format profile : OpenDML File size : 4.02 GiB Duration : 6 min 20 s Overall bit rate mode : Variable Overall bit rate : 90.8 Mb/s Writing library : VirtualDub build 35491/release Video ID : 0 Format : FFV1 Format version : Version 0 Codec ID : FFV1 Duration : 6 min 20 s Bit rate mode : Variable Bit rate : 89.2 Mb/s Width : 720 pixels Height : 480 pixels Display aspect ratio : 3:2 Frame rate : 59.940 (60000/1001) FPS Color space : YUV Chroma subsampling : 4:2:0 Bit depth : 8 bits Compression mode : Lossless Bits/(Pixel*Frame) : 4.306 Stream size : 3.95 GiB (98%) coder_type : Golomb Rice Audio ID : 1 Format : PCM Format settings : Little / Signed Codec ID : 1 Duration : 6 min 20 s Bit rate mode : Constant Bit rate : 1 536 kb/s Channel(s) : 2 channels Sampling rate : 48.0 kHz Bit depth : 16 bits Stream size : 69.6 MiB (2%) Alignment : Aligned on interleaves Interleave, duration : 17 ms (1.00 video frame) Interleave, preload duration : 500 ms
#30
05-06-2020, 08:53 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
It seems that the lag is just due to using FFV1. HuffYUV seems fine. However, for some reason none of the filters applied after QTGMC seemed to work on the de-interlaced footage when output from VirtualDub. Yet, it looks like they are applied in the Preview screen in AVSPMod. This was my script:

Code:
SetFilterMTMode("QTGMC", 2)
Import("C:\Program Files (x86)\AviSynth+\plugins+\RemoveDirtMC.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins+\ReplaceFramesMC2.avsi")
original = AVISource("video.avi")
original
AssumeBFF()

clip1 = Trim(11860, 18167)
clip2 = Trim(26227, 31317)
video = clip1 + clip2
video
sound = video
last = video

ReplaceFramesMC2(last, 1626, 1)
ReplaceFramesMC2(last, 7686, 12)

final = AudioDub(last, sound)
last = final

/* -------Color correction-------*/
ColorYUV(off_u=10, off_v=-3)
Tweak(cont=1.08, dither=true, coring=false)
Levels(11, 1, 255, 16, 235, coring=false, dither=true)

#ColorYUV(analyze=true)
#Histogram("levels")

ConvertToYV12(interlaced=true)
Vinverse()

#For vertical ringing
FAN(lambda=5)

#Deinterlace

#Noise removal
super=MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta =2, overlap=4)
backward_vec1 = MAnalyse(super, isb=true, delta=1, overlap=4)
forward_vec1 = MAnalyse(super, isb=false, delta=1, overlap=4)
forward_vec2 = MAnalyse(super, isb= false, delta=2, overlap=4)
MDegrain2(super, backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=400)

RemoveDirtMC(10, false)

FixChromaBleeding()
Cnr2(mode="ooo", scdthr=10.0, ln=45, lm=192, un=87, um=255, vn=87, vm=255, log=false, scenechroma=false)

mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=3, cm=1, bm=0))
turnright()
mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=2, cm=1, bm=0))
turnleft()

RemoveSpotsMC()
RemoveSpotsMC()
RemoveSpotsMC()
RemoveSpotsMC()

DeSpot(pwidth=25, interlaced=true, show=0, color=true, mthres=25)
LimitedSharpenFaster(strength=200)

ConvertToRGB32(interlaced=true, matrix="Rec601")
return last

Also, is there anything that can be done after the chroma bleeding on the side of the person's head in this screenshot? The bleeding persists temporally, which may be why none of the de-rainbow filters did anything, but I don't know.

Attached Images
#31
05-11-2020, 04:38 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
A few notes and ? on the script:

Quote:
 Originally Posted by Winsordawson It seems that the lag is just due to using FFV1...
I don't even know why you're using FFV1. It's due for the no-return-on-investment bin, and I'd be surprised if you received any replies from an FFV1 post. There are many reasons why huffYUV has remained in the top capture codec spot all these years.

I don't use AvsPmod. It's too clunky and problematic for me. So I can't answer questions about it.

Quote:
 Originally Posted by Winsordawson Code: LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins+\badframes.dll") Import("C:\Program Files (x86)\AviSynth+\plugins+\RemoveDirtMC.avsi") Import("C:\Program Files (x86)\AviSynth+\plugins+\ReplaceFramesMC2.avsi")
Something wrong here? Why should you have to manually load those plugins? If they're in your plugin folder, they shoud load automatically.

Quote:
 Originally Posted by Winsordawson AssumeBFF()
This won't hurt anything but, again, it's superfluous. BFF is the Avisynth default.

Quote:
 Originally Posted by Winsordawson Code: original = AVISource("video.avi") original AssumeBFF() clip1 = Trim(11860, 18167) clip2 = Trim(26227, 31317) video = clip1 + clip2 video sound = video last = video ReplaceFramesMC2(last, 1626, 1) ReplaceFramesMC2(last, 7686, 12) final = AudioDub(last, sound) last = final
You seem to be going through a lot of trouble and trying to circumvent Avisynth's internal logic, which is unnecessary and probably dangerous. The "last=video" is not needed, since simply calling "video" at that point automatically makes it equal last. I would suggest:

Code:
original=AVISource("video.avi")
video = original.Trim(11860, 18167) + original.Trim(26227, 31317)
sound=video
video
ReplaceFramesMC2(1626, 1)
ReplaceFramesMC2(7686, 12)
AudioDub(last, sound)
.... and so on ....
Just before ReplaceframesMC2, above, you bring focus to the "video" clip by invoking its name. That becomes "last" from that point onward and everything that follows applies to "video".

Vinverse()
This is called in the wrong place and doesn't help anything. It's best called with progressive video and is almost always used after QTGMC. The plugin includes the newer version, which is Inverse2. Check on the documentation: http://avisynth.nl/index.php/Vinverse.

mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=3, cm=1, bm=0))
turnright()
mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=2, cm=1, bm=0))
turnleft()

You're using this too early. Use it after the rest of your cleanup. Why do you want to sharpen dirt and spots early and try cleaning them later?

RemoveSpotsMC()
RemoveSpotsMC()
RemoveSpotsMC()
RemoveSpotsMC()

Rather than multiple iterations of RemoveSpotsMC, have you tried the several versions in the one-stopo-shopping script, RemnoveSpotsMC4.avsi (http://www.digitalfaq.com/forum/atta...vespotsmc4avsi)? It has the following internal functions that you can call by name: RemoevSpotsMC, RemoveSpotsMC2, RemoveSpotsMC3, RemoveSpotsMC4, and RemoveSpotsMC5. MC4 and MC5 are terminally slo-o-o-o-w.

I'd suggest the MC2 version with your progressive clip and make the spots smaller and less regular by doing this:
Code:
SeparateFields()
e=SelectEven().RemoveSpotsMC2()
o=SelectOdd().RemoveSpotsMC2()
Interleave(e,o)
Weave()

Quote:
 Originally Posted by Winsordawson Also, is there anything that can be done after the chroma bleeding on the side of the person's head in this screenshot?
That's not bleeding and it isn't a rainbow. It's old-fashioned analog antenna ghosting. No one has found a fix since the 1940's, so I guess nothing can be done. Save the tape. Sooner or later a geek might come up with something miraculous.

Last edited by sanlyn; 05-11-2020 at 04:49 PM.
 The following users thank sanlyn for this useful post: Winsordawson (05-11-2020)
#32
05-11-2020, 04:40 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Thanks for your reply. I know you are busy helping the digital and physical community, so I appreciate it. I was typing a post and did not see your reply, but yes, VInverse was causing all the filters to not work. I will post a newer script after taking in your comments, but for the time being I noticed using RemoveSpotsMC(), RemoveSpotsMC3(), and then RemoveSpotsMC() again seemed to work. It appears that the first call removes blatant problems, the second does a more thorough pass based temporally, and then the rest can be removed with the third call.

Regarding the analog antenna ghosting, I guess that means this video must have been dubbed from television. Thanks for the identification.

Also, I was saving the final export as FFV1, not capturing as it. Can you explain why you are against it for archival purposes? For what I have read, Lagarith is not a good archival format because it is too reliant on one developer. HuffYUV is too large for archival purposes. FFV1 is being used by libraries and archivists because of its good reduction in file size despite being lossless compression. It is also open sourced.

Last edited by Winsordawson; 05-11-2020 at 04:57 PM. Reason: Didn't see recent post
#33
05-11-2020, 04:47 PM
 lordsmurf Site Staff | Video Join Date: Dec 2002 Posts: 10,682 Thanked 1,867 Times in 1,616 Posts
Q: Does anyone have any idea as to how the fix the severe bleeding in the screenshot?
A: Yikes! No idea.

I see this thread, but (for now) my desire to help doesn't match my ability to help. I'm glad sanlyn is addressing this. And I'm actually getting some ideas and tips myself. Avisynth is such a large "program" (not really, more like language, common interface to run many programs/filters) that nobody will ever know everything. But many can know much, and by sharing knowledge, knowledge grows.

I didn't want you to think I was ignoring you.

- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
 The following users thank lordsmurf for this useful post: Winsordawson (05-11-2020)
#34
05-11-2020, 04:56 PM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
Quote:
 Originally Posted by Winsordawson Does anyone have any idea as to how the fix the severe bleeding in the screenshot? I can post a screenshot after colour correcting in VirtualDub, but I cannot do much in Avisynth. In any case, it seems the filters (mainly RemoveSpots) were not working because of Vinverse(). Once removed RemoveSpots worked again, but de-interlacing before the RemoveSpots appeared to be too slow to be useful after doing nothing for 15 minutes (probably because of the RemoveSpotsMC3). De-interlacing at the end worked. Code: original = AVISource("video.avi") original AssumeBFF() clip1 = Trim(11860, 18167) clip2 = Trim(26227, 31317) video = clip1 + clip2 video sound = video last = video ReplaceFramesMC2(last, 1626, 1) ReplaceFramesMC2(last, 7686, 12) final = AudioDub(last, sound) last = final /* -------Color correction-------*/ ColorYUV(off_u=10, off_v=-3) Tweak(cont=1.08, dither=true, coring=false) Levels(11, 1, 255, 16, 235, coring=false, dither=true) #ColorYUV(analyze=true) #Histogram("levels") #HistogramRGBParade() Trim(30, 450) ConvertToYV12(interlaced=true) #For vertical ringing FAN(lambda=5) #De interlace doesn't work here--too slow with RemoveSpotsMC3() #QTGMC(preset="very fast",EZDenoise=1,ChromaNoise=true, ChromaMotion=true,DenoiseMC=true, GrainRestore=0.2, ShowNoise=false) SeparateFields() #Comet removal RemoveSpotsMC() RemoveSpotsMC3() RemoveSpotsMC() #Noise removal super=MSuper(pel=2, sharp=1) backward_vec2 = MAnalyse(super, isb = true, delta =2, overlap=4) backward_vec1 = MAnalyse(super, isb=true, delta=1, overlap=4) forward_vec1 = MAnalyse(super, isb=false, delta=1, overlap=4) forward_vec2 = MAnalyse(super, isb= false, delta=2, overlap=4) MDegrain2(super, backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=400) RemoveDirtMC(10, false) FixChromaBleeding() SmoothUV(radius=2, field=false) Cnr2(mode="ooo", scdthr=10.0, ln=45, lm=192, un=87, um=255, vn=87, vm=255, log=false, scenechroma=false) mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=3, cm=1, bm=0)) turnright() mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=2, cm=1, bm=0)) turnleft() Weave() LimitedSharpenFaster(strength=200) AddGrain(var=1.2) Crop(4,0,-8,-8).AddBorders(6,4,6,4) QTGMC(preset="medium",ChromaMotion=true) VInverse() ConvertToRGB32(interlaced=false, matrix="Rec601") return last

There are too many errors in this script. You're also applying progressive filters to interlaced video. Why not supply a short sample so we can see what you're trying to do?
#35
05-11-2020, 05:05 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Quote:
 Originally Posted by lordsmurf Q: Does anyone have any idea as to how the fix the severe bleeding in the screenshot? A: Yikes! No idea. I see this thread, but (for now) my desire to help doesn't match my ability to help. I'm glad sanlyn is addressing this. And I'm actually getting some ideas and tips myself. Avisynth is such a large "program" (not really, more like language, common interface to run many programs/filters) that nobody will ever know everything. But many can know much, and by sharing knowledge, knowledge grows. I didn't want you to think I was ignoring you.
Thanks. I can't believe LordSmurf can't help! That just shows how complicated this is. And I understand the delays due to everything that is happening.

Sanlyn--I made a post, then saw your post, and then changed mine. I'll report back with a revised script and sample.

I thought it was better to separatefields for temporal footage, but that spatial can also work with it.

Last edited by Winsordawson; 05-11-2020 at 05:26 PM.
#36
05-12-2020, 04:10 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
I have attached two clips both before and after Avisynth. The first clip (video1) is from earlier in the same video as the clip attached in the beginning of this thread. I color corrected based on the white and black in the album cover below, which occurs later. This may not be best for the clip in question, but I can't go crazy, and neither should you.

video1_color.jpg

The VirtualDub color settings are saved as .txt because I was not allowed to upload a file with the extension .vdscript. I mainly used ColorPic for black and white levels and a vectorscope for skin values. The attached files are interlaced because I that is what I will be archiving. However, a de-interlaced version will be posted online. I could not de-interlace before most filters because it never finished rendering, while it was much faster if used at the end.

For some reason, RemoveSpotsMC2() was less effective than RemoveSpotsMC(). This can be seen in frame 231. Frame 335 is where I determined that three calls were necessary. You recommended to select the even and odd fields separately because this is a spatial-temporal filter?

I did not see much improvements with RemoveDirt or Cnr2 but I included them.

Code:
original = AVISource("Videowave2a2.avi")
original
# I included this line because I may forget the default field order in the future
AssumeBFF()

video = original.Trim(11860, 18167) + original.Trim(26227, 31317)
sound = video
video

ReplaceFramesMC2(1626, 1)
ReplaceFramesMC2(7686, 12)

AudioDub(last, sound)

Trim(0, 900)

/* -------Color correction-------*/
ColorYUV(off_u=10, off_v=-3)
Tweak(cont=1.08, dither=true, coring=false)
Levels(11, 1, 255, 16, 235, coring=false, dither=true)

ConvertToYV12(interlaced=true)

#For vertical ringing, found on right side of video
FAN(lambda=5)

#De interlace is too slow here
#QTGMC(preset="very fast",EZDenoise=1,ChromaNoise=true, ChromaMotion=true,DenoiseMC=true, GrainRestore=0.2, ShowNoise=false)

SeparateFields()

BottomField=SelectEven(). RemoveSpotsMC().RemoveSpotsMC3().RemoveSpotsMC()
TopField=SelectOdd().RemoveSpotsMC().RemoveSpotsMC3().RemoveSpotsMC()
Interleave(BottomField, TopField).AssumeBFF()

#Noise removal
super=MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta =2, overlap=4)
backward_vec1 = MAnalyse(super, isb=true, delta=1, overlap=4)
forward_vec1 = MAnalyse(super, isb=false, delta=1, overlap=4)
forward_vec2 = MAnalyse(super, isb= false, delta=2, overlap=4)
MDegrain2(super, backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=400)

RemoveDirtMC(10, false)

FixChromaBleeding()
Cnr2(mode="ooo", scdthr=10.0, ln=45, lm=192, un=87, um=255, vn=87, vm=255, log=false, scenechroma=false)

mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=3, cm=1, bm=0))
turnright()
mergechroma(aWarpSharp(depth=55, thresh=0.5, blurlevel=2, cm=1, bm=0))
turnleft()

Weave()
LimitedSharpenFaster(strength=200)

/*For de-interlaced version
QTGMC(preset="medium",ChromaMotion=true)
VInverse()
ConvertToRGB32(interlaced=false, matrix="Rec601")
*/

ConvertToRGB32(interlaced=true, matrix="Rec601")
return last

Attached Files
#37
05-12-2020, 04:33 PM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
I had a much harder time trying to adjust the color on the attached video2 clip. Using the set black and white in Premiere, I know the person's jacket is blue, yet I could not do much with ColorMill in VirtualDub to get there. The best I could do was isolate the skin and move the hue to the skin tone line.

Before--Vectorscope
video2_before_skin.PNG

Before
 You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.

After--Vectorscope
video2_before.jpg

After
 You must be logged in to view this content; either login or register for the forum. The attached screen shots, before/after images, photos and graphics are created/posted for the benefit of site members. And you are invited to join our digital media community.

I loaded the ColorMill settings into the Avisynth script because the weird colors were affecting the mergechroma. If the color were fixed, I would have added Camcorder color denoiser after Avisynth, but did not do that here.

Also, is there a way to duplicate a mono track to make it stereo in Avisynth? I could not get MergeChannels to work. Instead, I duplicated the audio in Audacity, and removed noise there as well.

Code:
LoadVirtualdubPlugin("C:\Users\Admin\Desktop\VirtualDub-1.10.4\plugins32\ColorMill.vdf", "ColorMill")
original = AVISource("Videowave1a2.avi")
sound = WAVSource("Videowave1a2_stereo.wav")
/*Replaced audio track because original was mono and removed noise.
First extracted audio from avi to wav using ffmpeg. Then cleaned in Audacity*/
vid1 = AudioDub(original, sound)
vid1

AssumeBFF()
clip1 = Trim(1505, 4271)
clip2 = Trim(9464, 11636)
clip3 = Trim(15587, 19197)
clip4 = Trim(25203, 28942)
clip5 = Trim(35200, 38568)
clip6 = Trim(43275, 45038)

clip3

clip4

clip5

vid2 = clip1 + clip2 + clip3 + clip4 + clip5 + clip6
vid2

Trim(400, 1300)

Levels(15, 1, 255, 16, 235, coring=false, dither=true)

ConvertToRGB32(interlaced=true, matrix="Rec601")
ColorMill(25700, 25700, 29277, 25700, 16996, 16962, 25700, 25700, 25700, 25152, 25685, 25700, 25700, 1124, 1029)

ConvertToYV12(interlaced=true)

#For vertical ringing
FAN(lambda=5)

SeparateFields()

BottomField=SelectEven(). RemoveSpotsMC().RemoveSpotsMC3()
TopField=SelectOdd().RemoveSpotsMC().RemoveSpotsMC3()
Interleave(BottomField, TopField).AssumeBFF()

#Noise removal
super=MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta =2, overlap=4)
backward_vec1 = MAnalyse(super, isb=true, delta=1, overlap=4)
forward_vec1 = MAnalyse(super, isb=false, delta=1, overlap=4)
forward_vec2 = MAnalyse(super, isb= false, delta=2, overlap=4)
MDegrain2(super, backward_vec1, forward_vec1, backward_vec2, forward_vec2, thSAD=400)

#Chroma bleeding
mergechroma(aWarpSharp(depth=25, thresh=0.5, blurlevel=2, cm=1, bm=0))
turnright()
mergechroma(aWarpSharp(depth=25, thresh=0.5, blurlevel=2, cm=1, bm=0))
turnleft()

Weave()

LimitedSharpenFaster()

/*For de-interlaced version
QTGMC(preset="medium",ChromaMotion=true)
VInverse2()
ConvertToRGB32(interlaced=false, matrix="Rec601")
*/

ConvertToRGB32(interlaced=true, matrix="Rec601")
return last
Thanks for any help. I don't know how the color got screwed up that badly. Is it possible for chroma to change that much with a deteriorated tape?

Attached Files
#38
05-13-2020, 04:49 AM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
Tried to reply to your post last night and this morning but the forum won 't let me upload files. Will try again this afternoon. Meanwhile I'm posting the script I used to fix the dropouits.

Note that your original text is applying ReplaceFramesM to interlaced fields. This can often result in field blending, which can't be fixed.

Quote:
 Originally Posted by Winsordawson You recommended to select the even and odd fields separately because this is a spatial-temporal filter?
It's done to break up the video into uneven sequences in case some artifacts persist for multiple frames. Noise that stays the same for for more than one consecutive frame often is not seen as noise.

What you're trying to remove isn't just spots and comets. They're horizontal dropouts and rips. RemoveDirtMC at higher settings works OK.

Code:
vidpath="I:\forum\faq\Windsordawson\E\"
vid=MPEG2Source(vidpath+"video1_before.d2v")
aud=NicMPG123Source(vidpath+"video1_before Tc0 L2 2ch 48 320 DELAY 0ms.mp2", Normalize=false)
AudioDub(vid,aud)

/* ####################################################################
######--- Start here to disable lines that don't fit the clip ---######
original=last
# I included this line because I may forget the default field order in the future
AssumeBFF()

video = original.Trim(11860, 18167) + original.Trim(26227, 31317)
sound = video
video

ReplaceFramesMC2(1626, 1)
ReplaceFramesMC2(7686, 12)

AudioDub(last, sound)

Trim(0, 900)
######--- Stop here to disable lines that don't fit the clip ---######
#################################################################### */

ColorYUV(off_u=10,off_v=-3,cont_v=-75)
Levels(14,1.08,255,16,255,dither=true,coring=false)
FixChromaBleeding()
SeparateFields()
e=SelectEven().RemoveDirtMC(40,false)
o=SelectOdd().RemoveDirtMC(40,false)
Interleave(e,o)
source=last
super = source.MSuper(pel=2, sharp=1)
backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)

#For vertical ringing, found on right side of video
FAN(lambda=5)

MergeChroma(aWarpSharp2(depth=30).aWarpSharp2(depth=10))
LimitedSharpenFaster()
Weave()

/*For de-interlaced version
QTGMC(preset="medium",ChromaMotion=true)
VInverse()
ConvertToRGB32(interlaced=false, matrix="Rec601")
*/

ConvertToRGB32(interlaced=true, matrix="Rec601")
return last
#39
05-13-2020, 10:46 AM
 sanlyn Premium Member Join Date: Aug 2009 Location: N. Carolina and NY, USA Posts: 3,648 Thanked 1,234 Times in 969 Posts
Trying again to upload an output sample for the above script and a .vcf.

Yep. It worked. Finally.

Attached Files
 The following users thank sanlyn for this useful post: Winsordawson (05-13-2020)
#40
05-13-2020, 11:59 AM
 Winsordawson Premium Member Join Date: Sep 2010 Location: Behind you Posts: 410 Thanked 27 Times in 23 Posts
Thank you. I used ReplaceFramesMC for certain frames with bad tracking issues that cannot be fixed. Does this create a problem for the filters?

I did not realize RemoveDirtMC can do the same job as RemoveSpotsMC. It is also much quicker. Now that speed is not an issue, should I have de-interlaced first or is it fine to do it at the end? Also, is it safe to SeparateFields for most filters except for color, or are there certain filters that work better in normal interlaced? If a temporal filter works just as well when the fields are separated, I would rather err on this side than incorrectly apply a spatial filter when the fields have not been separated.

The saturation in the video you attached seems unnatural, especially in the blue shirt. I am just curious, is this the way it should be done or is it just a stylistic preference?

 Tags avisynth, color artifact, restoration

 Similar Threads Thread Thread Starter Forum Replies Last Post burak5 Capture, Record, Transfer 0 08-17-2016 06:46 AM TheCatacomb Restore, Filter, Improve Quality 7 06-13-2016 10:35 PM Zoink187 Restore, Filter, Improve Quality 13 07-24-2014 09:38 PM Zoink187 Restore, Filter, Improve Quality 11 07-23-2014 07:31 AM Zoink187 Restore, Filter, Improve Quality 0 03-28-2014 09:14 PM