Quantcast VirtualDub border masking? (not cropping!) - Page 2 - digitalFAQ Forum
Go Back    Forum > Digital Video > Video Project Help > Edit Video, Audio

Reply
 
LinkBack Thread Tools
  #21  
07-26-2017, 01:06 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
Sanlyn,
Thanks a lot for taking your time to explain this again.

I continue to use NeatVideo as this gives me the best noise filtering results from all the different things I tried and it's user friendly. I used to use settings below the default, but that slipped my mind and now I used default settings (adaptive, auto, 0% adjustment of noise level, 60% luma and 100% chroma noise reduction, 0% sharpening). Yes, there is a subtle loss of details in busy textures, but the awful noise of old and tired VHSc is gone. I see no posterization whatsoever.

Thanks for clarifying the YUY2 vs YV12 difference. So far I used YUY2 or RGB only in the process, so it should be OK.

Based on your post today, I started using Logarith/RGB for compression after the masking and Neatvideo. It runs slower than hyffyuv, but not a huge difference. I'll try later if that's acceptable for my later encoding/authoring/burning steps.

in summary this is my most current workflow:
1. capture entire cassette with huffyuv/YUY2
2. VDub cutting into smaller clips (direct stream copy)
3. using your above .avs script for masking in Vdub combined with NeatVideo and save into Logarith/RGB
does it look right to you?
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #22  
07-27-2017, 11:49 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Quote:
Originally Posted by friendly_jacek View Post
in summary this is my most current workflow:
1. capture entire cassette with huffyuv/YUY2
2. VDub cutting into smaller clips (direct stream copy)
3. using your above .avs script for masking in Vdub combined with NeatVideo and save into Logarith/RGB
does it look right to you?
Lagarith is a bit slower than huffyuv -- which is why I don't use Lagarith for capture -- but Lagarith usually makes smaller files. I noted that you save Virtualdub output as RGB. You can save it as YUY2 if you wish. You have to keep VirtualDub in "full processing mode" to apply its filters, but you can set the output color depth to YUY2 and the compression to Lagarith on output. In my case, I know that the final output will be encoded to MPEG or h.264, which are YV12. So I save the final output as Lagarith YV12, a much smaller file. That final output colorspace is yet another old debate.

The workflow looks OK to me. Again it comes down to preference. I use NeatVideo often, but not for everything and sparingly at that. Most of my denoising is in Avisynth, color correction in Virtualdub. There are many problema and defects that NeatVideo can't touch, and many that VirtualDub won't fix either. The more problematic the source, the less I can do with NeatVideo. Below are some examples.....

The images are from a 1991 tape recorded off an underpowered cable signal overmodulated with a cheap RadioShack analog cable amp, with a cheap Sears RCA 2-head VCR at 6-hour speed (Yes, I could be shot for what I didn't know back then!). The noise is horrific, the color is putrid. I couldn't use my AG-1980 for playback, as the output had green or pink color bars across the top that came and went. The AG-1980 just didn't like that tape. So I used a rebuilt Panasonic PV-S4670 SVHS, an ES10 tbc pass-thru and an AVT-8710 frame tbc, into my AIW 9600XT card, to huffyuv YUY2.

Below, from the original capture: Note the white spot on the right side and the greenish rainbow tint across the middle, plus discolored magenta and cyan blotches in the background and floor. There are about 12 of those bright white spots all over the frame during the short AVI sample I've attached to this post. Neither NeatVideo nor CamcorderColorDenoise could fix these uglies:


Problems mostly fixed with QTGMC, dfttest, MDegrain2, RemoveSpotsMC, and color correction:


Below, at the bottom there's a two-headed sudden bright flash on the floor, plus cyan and magenta noise in the floor and background, and a "floating" cyan stain in the upper background. NeatVideo/Virtualdub, no help here:


Spot "flash" and color fixed with the same Avisynth plugins plus some clean detail patches borrowed from other frames and overlaid onto the bad original:


Below, note the green rainbow that flashed across the upper middle for two or three frames, plus the usual blotches in the floor and upper background.


Rainbow and blotches about 90% fixed with the same Avisynth filters, plus VDub color correction:



The Attached Avi sample "GB_Liv7C1_ivtc_spots_and_noise_L.avi" is lossless Lagarith YUY2. It's from the original capture, has been inverse telecined to remove duplicate fields but is otherwise unfiltered. I couldn't get NeatVideo to play nice on this, but you can give it a run. As you play this crummy original note also the bad left-hand image flutter and the flickery noise across the top third of the frame. A lot of unstable noise here. The murky greenish color is really bad, down to the dark blue that's missing from the tuxedos. Anyone who wants to tackle this one, go right ahead. Took me about 4 hours.

I also zipped a NeatVideo .dnp noise sample (device noise profile) from a clear neutral area in another part of the same original movie, attached as "F09_616a_dnp.zip". This is a challenging test for NeatVideo as a one-stop-shoppping cleanup filter.

The imperfect result I got with Avisynth (with no NeatVideo) is attached as "GB07b_Avisynth_results.mp4".


Attached Images
File Type: jpg Liv7C1 455 white spot and green rainbow.jpg (110.4 KB, 76 downloads)
File Type: jpg GB07 8565 white spot and rainbow fix.jpg (163.2 KB, 76 downloads)
File Type: jpg Liv7C1 166 spot flash and color noise.jpg (112.2 KB, 107 downloads)
File Type: jpg GB07 spot flash and color fix.jpg (129.7 KB, 105 downloads)
File Type: jpg Liv7C1 474 chroma rainbow and noise.jpg (106.8 KB, 75 downloads)
File Type: jpg Gb07 874 chroma rainbow and noise fix.jpg (161.1 KB, 74 downloads)
Attached Files
File Type: avi GB_Liv7C1_ivtc_spots_and_noise_L.avi (89.37 MB, 5 downloads)
File Type: zip F09_616a_dnp.zip (31.8 KB, 4 downloads)
File Type: mp4 GB07b_Liv7C1_ivtc_Q_vd_MVC_gf3.mp4 (12.17 MB, 5 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: friendly_jacek (07-27-2017)
  #23  
07-27-2017, 01:15 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
Your problem is different from mine. My issue is home recordings with lots of fine to medium grain (analog) luma and some chroma noise. NeatVideo was the only filter that effectively eliminated that. The only quality issue that I have left is a few random horizontal lines and dropouts from time to time. I understand those lines are the "Static Lines" as per http://www.digitalfaq.com/guides/vid...tore-video.htm

I'm currently researching ways to deal with that, maybe VirtualDub Median filter, maybe RemovedirtMC in AviSynth, but I don't want this to be a never-ending project even though those family recordings are precious.

As for the saving intermediate files in RGB, it's a default in VirtualDub and I didn't want to force yet another conversion. But if YU12 is all it's needed for authoring, I may need to consider that.

BTW, when I remember again how to save frames from VD, I'll post some examples.

PS: Maybe I found a solution for lines and dropouts: http://forum.doom9.org/showthread.ph...hlight=depulse
need to figure out how to use it and test it.

Last edited by friendly_jacek; 07-27-2017 at 01:46 PM.
Reply With Quote
  #24  
07-27-2017, 01:33 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Admittedly the AVi sample is an extreme case of horrible cable transmission, cheap recording, and aging tape. The concept is that many defects, including the static lines you mention (dropouts) can be fixed. The sample is full of dropouts, large and small, as well as other nasties. As you say, it depends on your picture of what you want as a final product. In this case the movie takes me back to another time and place, so it becomes something of importance and extra effort. Not everything goes through this process. No one has forever for this. When something assumes such importance, it's a good idea to suit the tool to the job. In this case my old standby NeatVideo didn't fill the bill.

Fortunately most of my old tapes don't look like this. Thank heaven.
Reply With Quote
The following users thank sanlyn for this useful post: friendly_jacek (07-27-2017)
  #25  
07-28-2017, 09:01 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
I guess I'll keep this thread as a witness to my journey through video editing.
Below are test frames from my current project. VHSc from 24 years ago. this is about the worst frame in the end of the tape sequence where there are more tape problems (tape reused numerous times). however, the video noise is similar everywhere and dropouts every second or two.
vertical median filter is best for 1 line dropouts (lower part of the frame) while NeatVideo controls noise.


Attached Images
File Type: jpg raw.jpg (122.2 KB, 3 downloads)
File Type: jpg depulse.jpg (126.1 KB, 2 downloads)
File Type: jpg median.jpg (112.1 KB, 2 downloads)
File Type: jpg NV1.jpg (109.5 KB, 2 downloads)
File Type: jpg median NV1.jpg (101.0 KB, 5 downloads)
Reply With Quote
  #26  
07-29-2017, 05:24 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
None of these are much of an improvement and would be indiscernible during normal play. Across how many consecutive frames do these dropouts persist? One might get entirely different impressions if you had included a video sample from the original capture.

Another aspect of median averaging is that it assumes defects like dropouts will look different each time the tape is played. That's seldom possible: a dropout is physical damage that is in the same location on every playback, so it will look pretty much the same way on each play most of the time. That's why it works OK with some problems, doesn't work well with other problems, and doesn't do anything at all on others. In this case, the Virtualdub version is not a true multi-sample averaging filter like Avisynth's median, but an attempt at averaging motion analysis of several different frames from the same capture, not an averaging of several different versions of the same frame from multiple captures. This means that these two "medians" are two entirely different processes, not one and the same.

However, your post is essential documentation and a further example of results with the methods discussed.

In the past, in many cases, I solved the problem by playing the tape in a better player.
Reply With Quote
  #27  
07-29-2017, 10:11 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
None of these are much of an improvement and would be indiscernible during normal play. Across how many consecutive frames do these dropouts persist? One might get entirely different impressions if you had included a video sample from the original capture.

Another aspect of median averaging is that it assumes defects like dropouts will look different each time the tape is played. That's seldom possible: a dropout is physical damage that is in the same location on every playback, so it will look pretty much the same way on each play most of the time. That's why it works OK with some problems, doesn't work well with other problems, and doesn't do anything at all on others. In this case, the Virtualdub version is not a true multi-sample averaging filter like Avisynth's median, but an attempt at averaging motion analysis of several different frames from the same capture, not an averaging of several different versions of the same frame from multiple captures. This means that these two "medians" are two entirely different processes, not one and the same.

However, your post is essential documentation and a further example of results with the methods discussed.

In the past, in many cases, I solved the problem by playing the tape in a better player.
The improvement is real, see the attached short MP4 samples.
My current working plan is to capture 768x576 saved as huffyuv/YUY2 and then later mask/transform to RGB in that AviSynth script you gave me together with NeatVideo and vertical median filter from JPSPR (as needed only) and save to Logarith/YV12.
Tomorrow I will try some authoring, wish me luck. Can you combine PAL and NTSC clips on the same PAL (or NTSC) DVD?


Attached Files
File Type: mp4 raw.mp4 (6.82 MB, 14 downloads)
File Type: mp4 median NV1.mp4 (2.84 MB, 3 downloads)

Last edited by friendly_jacek; 07-29-2017 at 10:30 PM.
Reply With Quote
  #28  
07-29-2017, 10:59 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,269
Thanked 1,370 Times in 1,205 Posts
Quote:
Originally Posted by friendly_jacek View Post
The improvement is real, see the attached short MP4 samples.
My current working plan is to capture 768x576 saved as huffyuv/YUY2 and then later mask/transform to RGB in that AviSynth script you gave me together with NeatVideo and vertical median filter from JPSPR (as needed only) and save to Logarith/YV12.
Tomorrow I will try some authoring, wish me luck. Can you combine PAL and NTSC clips on the same PAL (or NTSC) DVD?
NeatVideo has destroyed a lot of gradient detail, which is a hallmark of it.

Yes, true, it is better than the source in some ways, but is now worse in others.

Using Avisynth and VirtualDub, it could be cleaned up better ... and more. Perhaps when I get more time, I can show you a sample of what I'd do.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
The following users thank lordsmurf for this useful post: friendly_jacek (07-29-2017)
  #29  
07-30-2017, 05:50 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Quote:
Originally Posted by friendly_jacek View Post
The improvement is real, see the attached short MP4 samples.
I don' know what you man by "real". Some comparisons of your Median/NV1 fix and what I was able to eek out of the lossy "raw" sample:

Noise, frame 268, VirtualDub Median/NV1 fix:


Noise, frame 268, Avisynth fix:


Levels, Color, Definition: frame 5, Median/Nv1:


Levels, Color, Definition: frame 5, Avisynth/gradation curves/ColorMill:


Try the attached Raw_fix_PAL.mp4 and let us know if you think it's a little cleaner: http://www.digitalfaq.com/forum/atta...1&d=1501411730

Allow, if you will, a bit of objective summary about some basic operations that could be improved:

Quote:
Originally Posted by friendly_jacek View Post
My current working plan is to capture 768x576 saved as huffyuv/YUY2 and then later mask/transform to RGB in that AviSynth script you gave me together with NeatVideo and vertical median filter from JPSPR (as needed only) and save to Logarith/YV12.
Tomorrow I will try some authoring, wish me luck. Can you combine PAL and NTSC clips on the same PAL (or NTSC) DVD?
No, you can't. It will have to be all of one or the other. You can take 25fps PAL and use Avisynth or an NLE to convert it to 29.97 NTSC but it some PAL parts will playback a little clumsily (not noticed by most viewers). A worse quality hit would be blending or decimation to convert NTSC to PAL.

Something else you can't do is make DVD from 768x576. DVD and standard definition BluRay are anamorphic formats, not square-pixel. If you feed 768x576 into an NLE or authoring program, it's going to be resized to something PAL can accept (720x576 or 704x576) or something NTSC can accept (720x480 or 704 x480). Resizing costs. Always. You're wasting your time capturing 768x576. If you post it on the net it'll be resized by the website to a standard frame format like 640x480. Don't use oddball frame sizes. You're just making problems for yourself.

The top sample that you posted is not a "raw" format. It's a high-loss, low-bitrate, low-accutance encode that's very nearly unusable for effective restoration, with a large-GOP structure that's unsuitable for clean edits. It has illegal luma levels with brights so badly blown out that it's impossible to restore the full dynamic contrast range of the source video. Black levels are artificially high and look under saturated and washed out. The NeatVideo sample looks grossly over filtered and denuded of fine detail and texture, so that it looks foggy and plastic. You can't seriously promote this as quality work. It looks like a demo of typical YouTube missteps. You seem bright enough to do better.


Attached Images
File Type: jpg Noise - Your Fix.jpg (218.9 KB, 132 downloads)
File Type: jpg Noise - Avisynth fix.jpg (130.3 KB, 62 downloads)
File Type: jpg Levels-Color-Definition - Your Fix.jpg (127.3 KB, 62 downloads)
File Type: jpg Levels-Color-Definition - Avisynth-VDub.jpg (175.7 KB, 63 downloads)
Attached Files
File Type: mp4 Raw_fix_PAL.mp4 (8.49 MB, 17 downloads)

Last edited by sanlyn; 07-30-2017 at 06:10 AM.
Reply With Quote
  #30  
07-30-2017, 07:47 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
[EDIT] oops, in my haste I encoded that fixed PAL mp4 with an audio sampling rate of 44.1KHz. Oh, well, a little too early in the day to keep it all 100% straight. 44.1K would work for the web, though.
Reply With Quote
  #31  
07-30-2017, 12:40 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
I don' know what you man by "real". Some comparisons of your Median/NV1 fix and what I was able to eek out of the lossy "raw" sample:
Look, I appreciate your time helping out on this forum, but pointing out that you can do better pissing contest is not helping. For all i know you might be a professional doing it all your life, and i'm just a beginner who becomes more and more frustrated with this project as time goes on.

Quote:
Originally Posted by sanlyn View Post
No, you can't. It will have to be all of one or the other.
Thanks, I vaguely remembered that some authoring software allowed to switch PAL/NTSC. Maybe I remembered wrong.

Quote:
Originally Posted by sanlyn View Post
Something else you can't do is make DVD from 768x576.
You are right, I f...ed up and set up wrong resolution in the capture step. I should have double checked my guide i put together way back. Wasted countless hrs (I captured 3 hrs worth of video that way and did quite a few edits, not no mention filters).

Quote:
Originally Posted by sanlyn View Post
The top sample that you posted is not a "raw" format.
Right, wrong term. It was compressed with huffyuv on capture and later mp4 for upload here.

Quote:
Originally Posted by sanlyn View Post
with a large-GOP structure that's unsuitable for clean edits. It has illegal luma levels with brights so badly blown out that it's impossible to restore the full dynamic contrast range of the source video. Black levels are artificially high and look under saturated and washed out.
You mostly lost me here with all that jargon.

Quote:
Originally Posted by sanlyn View Post
You can't seriously promote this as quality work. It looks like a demo of typical YouTube missteps. You seem bright enough to do better
I don't promote any claims here. Like I said before, this is the best I can do myself based on my extensive study of this or similar websites over long time and my own trial and error. If you have any pointers rather than just criticism, I'm all ears.

Quote:
Originally Posted by sanlyn View Post
audio sampling rate of 44.1KHz.
I remember you mentioned elsewhere that it should be 48 kHz? However, my capture guide reads: Audio->Raw capture format, select "PCM: 44100Hz, stereo, 16-bit" and OK
Reply With Quote
  #32  
07-30-2017, 02:25 PM
friendly_jacek friendly_jacek is offline
Free Member
 
Join Date: Aug 2015
Location: USA (NTSC) but have PAL VHS tapes
Posts: 50
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
Noise, frame 268, VirtualDub Median/NV1 fix:


Noise, frame 268, Avisynth fix:
I looked at those frames closely and the upper still is from frame 266 and the lower possibly 268, not entirely sure as chroma was missing in that frame. don't get me wrong, there seems to be great improvement in your filter, but lets compare apples to apples.
Reply With Quote
  #33  
07-30-2017, 07:28 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Quote:
Originally Posted by friendly_jacek View Post
I looked at those frames closely and the upper still is from frame 266 and the lower possibly 268, not entirely sure as chroma was missing in that frame. don't get me wrong, there seems to be great improvement in your filter, but lets compare apples to apples.
I'm glad you pointed out that frame mis-count. I noted on closer inspection that when your Media/NV1.mp4 is opened in some video apps, the first 2 frames are black, and the overall frame count is 2 to 3 frames more than the frame count in other editors and in your "raw" mp4. Using the accuracy of Avisynth's FFMS2 file opener, it appears that whatever you're using to smart render that mp4 isn't so smart about properly marking frames in some GOP's. So the frame numbers I was looking at earlier were a couple of frame numbers off.

So to keep that comparison kosher, let's compare three frames with the proper frame numbers, with your mp4 fix on top and the Avisynth mate for each below it:

frame 266:




frame 267:



frame 268:



Quote:
Originally Posted by friendly_jacek View Post
Look, I appreciate your time helping out on this forum, but pointing out that you can do better pissing contest is not helping. For all i know you might be a professional doing it all your life
Nope. A hobbyist. I just used different filters.

Sorry for the technical jargon and details. I made invalid assumptions based on most readers who show up in forums such as this in order to learn more about video and how to get better results. We don't usually get readers who are looking for the opposite. My error.


Attached Images
File Type: jpg f266 Median-NV1.jpg (162.7 KB, 61 downloads)
File Type: jpg f266 Avisynth_FixRipsP2_RDMC.jpg (93.7 KB, 129 downloads)
File Type: jpg f267 Median-NV1.jpg (150.4 KB, 160 downloads)
File Type: jpg f267 AVisynth_FixRipsP2_RDMC.jpg (92.7 KB, 127 downloads)
File Type: jpg f268 Median-NV1.jpg (88.9 KB, 158 downloads)
File Type: jpg f268 Avisynth_FixRipsP2_RDMC.jpg (97.9 KB, 129 downloads)

Last edited by sanlyn; 07-30-2017 at 07:47 PM.
Reply With Quote
  #34  
09-13-2018, 06:03 PM
stevevid stevevid is offline
Premium Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 116
Thanked 10 Times in 8 Posts
While searching for one thing on DigitalFAQ, I always run into something else interesting and then go down that rabbit hole. Today, I found the thread "VirtualDub border masking? (not cropping!)" that started on 08-13-2015 and ended on 07-30-2017. The masking discussion was interesting but the topic that really woke me up was Sanlyn's restoration examples on page 2. Wow! I'm very impressed with his changes to a 1991 tape and the noise eliminated in the baby clip. I have seen similar issues with the VHS tape captures I am doing.

I'm back to learning how to use AviSynth effectively and am studying the filter settings Sanlyn suggested for some terrible 16mm captures I have. To further my education, are the scripts for the clips in the "VirtualDub border..." thread available? I believe they would be great examples of how I should approach my captured VHS tapes.

Thank you very much for your extensive help in this and other threads,
Steve
Reply With Quote
The following users thank stevevid for this useful post: bar72 (10-21-2018), sanlyn (09-21-2018)
  #35  
09-14-2018, 05:46 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 8,269
Thanked 1,370 Times in 1,205 Posts
Quote:
Originally Posted by stevevid View Post
are the scripts for the clips ... available? I believe they would be great examples of how I should approach my captured VHS tapes.
Thread/post merged.
PM sanlyn, as for his input (here in this thread) since those are his scripts.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #36  
09-18-2018, 09:06 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Quote:
Originally Posted by stevevid View Post
I'm very impressed with his changes to a 1991 tape and the noise eliminated in the baby clip.
Thank you. I hate videos like that. Sometimes they can't be repaired.

Quote:
Originally Posted by stevevid View Post
are the scripts for the clips in the "VirtualDub border..." thread available?
The script for the 1991 movie is archived somewhere, I'll need more time to dig it up and fix it for posting.

Meanwhile the script for the baby video mp4 in post #29 of this thread has long since disappeared. However, I reworked the script and added a tweak or two.

The source video is the lossy compressed "raw.mp4" in post #27 (http://www.digitalfaq.com/forum/atta...masking-rawmp4). Apparently the owner doesn't have the original capture. Referring to h.264 encodes as "raw" isn't really correct. Raw is a specific format, definitely not h.264. When working with lossy encodes don't expect the same results one would get from a lossless capture. Lossy video means unrecoverable loss as well as compression artifacts that are difficult to deal with. In this case, the mp4 source has severe dropouts or "rips" that require destructive filters -- which is why, if drastic repairs are required, lossy samples are a very very very poor choice.

The source mp4 was resized to a 768-pixel width while still interlaced, which makes the dropout distortion look worse. Apparently the 768x576 width was used to get a 4:3 square-pixel image. This is often used (incorrectly) with web posting in mind and to help inferior playback systems that can't handle anamorphic video. Keep in mind that resizing for this 4:3 result makes no improvement whatever and exacerbates problems with video that hasn't been denoised. The result is also unsuitable for web posting because it is still interlaced; any website on which it is posted would deinterlace it using the quickest and worst means possible, and the video would be resized anyway to something more standard such as 640x480. As-is, the mp4 sample is unplayable on a website.

The script below is approximately the same script I used for the "fix" mp4 posted as "Raw_fix_PAL.mp4" in post #29. The results of the below script are attached as "Raw_fix2_25p.mp4". Because the FixRiptsP2 filter is a very slow memory-intensive plugin, I used a two-step process with two scripts for the total job.

Code:
===================================
============= STEP 1 ==============

##-- open video only with FFMS2 - no audio --##
ffVideoSource("Drive:\path\to\raw.mp4")

ColorYUV(off_y=-25,gamma_y=-5,off_u=3,off_v=-2)
Tweak(sat=1.3,dither=true,coring=false)
#-- test for levels --
#Crop(12,0,-12,-12)
#Histogram("Levels")
#return last
#-- end levels test --

AssumeTFF()
SeparateFields()
FixRipsP2()
Weave()

Crop(12,0,-12,-12).AddBorders(12,6,12,6)
##-----------    Return video only.  -----------##
##-- Save as "Step 1.avi" using Lagarith YV12 --##
return last
Script details for Step 1:

##-- open video only with FFMS2 - no audio --##
ffVideoSource("Drive:\path\to\raw.mp4")

Avisynth's FFMS2 plugin is used to decode the video-only track of the source video. FFMS2 is also known as FFMpegSource and has many functions. http://avisynth.nl/index.php/FFmpegSource

ColorYUV(off_y=-25,gamma_y=-5,off_u=3,off_v=-2)
Tweak(sat=1.3,dither=true,coring=false)
#-- test for levels --
#Crop(12,0,-12,-12)
#Histogram("Levels")
#return last
#-- end levels test --

This section of code corrects obviously high black levels which look washed out and which results in bad clipping of bright details. Tweak() is also used to correct low saturation and color density loss. The lines that begin with "#" show some test code that is disabled as comments-only for the final output version. Note that Crop() is used to avoid borders that would affect the YUV histogram. When enabled, the YUV histogram that appears for the original, uncorrected images looks like the histogram below, with high gamma and bright clipping beyond y=-235:

baby video original YUV levels


The corrected image produces this YUV histogram:

baby video corrected YUV levels


AssumeTFF()
SeparateFields()
FixRipsP2()
Weave()
FixRipsP2 is a last-resort plugin script designed for the kind of severe dropouts in the source video. It's a slow and destructive filter that involves compromise; in high-motion scenarios it can produce bizarre distortions and can make objects disappear entirely. In this case motion wasn't so hectic that the filter couldn't do some work. But you will see signs of minor distortion. FixRipsP2 should not be used on interlaced video, so SeparateFields() is used, then Weave() is used to restore interlacing. Given the bad dropout problem, a full deinterlace would look horrible.
FixRipsP2.avs is here:http://www.digitalfaq.com/forum/atta...d-fixripsp2avs.
FixRipsP2 requires the following:
DePan_Tools v1.13.1. http://www.digitalfaq.com/forum/atta...1&d=1531396979
RgTools.dll http://avisynth.nl/index.php/RgTools (also supplied with the QTGMC package). Also required:
Microsoft Visual C++ 2015 Redistributable Package (x86 / x64). https://www.microsoft.com/en-us/down....aspx?id=53587
MVTools 2.27.21.x or later. http://www.digitalfaq.com/forum/atta...s2_27_21_22zip (also supplied with the QTGMC package).

Crop(12,0,-12,-12).AddBorders(12,6,12,6)
##----------- Return video only. -----------##
##-- Save as "Raw_Step 1.avi" using Lagarith YV12 --##
return last

This code crops away uneven borders and bottom border head-switching noise, then adds new black borders and centers the image. The original left border also has 2 pixels of noisy "stuff". The "return last" line outputs the results of the last operation, which is the Crop() line. The script was run in Virtualdub, so VDub was set to save the file as YV12 using Lagarith lossless compression using the filename Raw_Step 1.avi.

Code:
===================================
============= STEP 2 ==============
 (Input is YV12 video from Step 1)

aud = ffAudioSource("Drive:\path\to\raw.mp4")
vid = Avisource("Drive:\path\to\Raw_Step1.avi")

vid
AssumeTFF()
QTGMC(preset="medium", border=true, fpsDivisor=2) #<- creates progressive 25fps output.
source=last

chroma=source.Loop(8,265,0)
chroma=MergeChroma(source, chroma)
ReplaceFramesSimple(source, chroma, mappings="[266 272]")
Chroma_A=last

chroma=source.Trim(275,275)
chroma=chroma.Loop(377,0,0)
chroma=MergeChroma(source,chroma)
ReplaceFramesSimple(Chroma_A, chroma, mappings="273 274")

ReplaceFramesMC(267,2)
RemoveDirtMC(30,false)
MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(depth=10))
LimitedSharpenFaster(edgemode=2)
GradFun2DBmod(thr=1.5,mask=false)
AddGrainC(1.25,1.25)
Chroma_B=last

AudioDub(Chroma_B,aud)
return last
Details of Step 2 script:

aud = ffAudioSource("Drive:\path\to\raw.mp4")
vid = Avisource("Drive:\path\to\Raw_Step1.avi")

The first line uses FFMS2 to decode the original lossy audio (low quality audio that can't be used on then 'net). The audio data is saved in memory as an entity that I named "aud". It will be used later at the end of the script. AviSource() is used to decode the Step 1.avi that came from the Step 1 script. The video portion is saved in memory to a video clip that I named "vid".

vid
AssumeTFF()
QTGMC(preset="medium", border=true, fpsDivisor=2) #<- creates progressive 25fps output.
source=last

The first line directs Avisynth to focus operations on the video clip named "vid". AssumeTFF() sets proper field polarity and overrides Avisynth's BFF default. QTGMC is used to deintelace using its "medium" setup parameter, which includes some denoising, motion smoothing, and some anti-aliasing. The border=true parameter helps prevent top-border twitter. The fpsDivisor=2 parameter drops alternate fields after creating new interpolated frames from both fields, resulting in 25fps progressive video. If this parameter is omitted, QTGMC's output would be 50fps double-rate progressive. The choice is up to the user, but motion will be smoother at 50fps or as interlaced 25i. Many websites will drop alternate fields anyway, so you may as well let QTGMC do a much cleaner job of it. The last line saves the deinterlaced result in memory as a new clip arbitrarily named "source".

The QTGMC plugin package with its support files is at http://www.digitalfaq.com/forum/atta...g-qtgmc_newzip.

chroma=source.Loop(8,265,0)
chroma=MergeChroma(source, chroma)
ReplaceFramesSimple(source, chroma, mappings="[266 272]")
Chroma_A=last

This group of lines plays tricks with chroma, borrowing chroma from one frame to overlay its colors onto other frames. There are several consecutive monochrome frames in the source video that suffered chroma loss through poor tracking. This code attempts to borrow the chroma values from frame 265 and apply that chroma to frames 266 thru 272 in the source. The line chroma=source.Loop(8,265,0) copies frame 265 eight times over the original video starting at frame 265, and creates a new video clip in memory called "chroma". With chroma=MergeChroma(source, chroma) the "chroma' video is then modified to merge the chroma-only of the "chroma" clip with the luma-only of "source". Thus, the "colors" in frame 265 are now used to overlay all of the frames in the new "chroma" clip. But we really want borrowed colors only in frames 266 thru 272. So ReplaceFramesSimple(source, chroma, mappings="[266 272]") replaces frames 266 to 272 in the "source" video with frames 266 thru 272 of the "chroma" video.

The results of the borrowed and replaced chroma are saved in memory as a new clip named "Chroma_A".

Merge function: http://avisynth.nl/index.php/Merge
Loop function: http://avisynth.nl/index.php/Loop
ReplaceFramesSimple (in RemapFrames): http://avisynth.nl/index.php/RemapFrames

chroma=source.Trim(275,275)
chroma=chroma.Loop(377,0,0)
chroma=MergeChroma(source,chroma)
ReplaceFramesSimple(Chroma_A, chroma, mappings="273 274")

The first line chroma=source.Trim(275,275) creates a new version of "chroma" that contains only frame 275 from the "source" clip. Then "chroma" is expanded to contain a loop of 377 copies of frame 275 (which is frame "0" in the new clip). You'll need a clip that is at least 377 frames long in order to match the frames in "Chroma_A". ReplaceFramesSimple(Chroma_A, chroma, mappings="273 274") replaces the monochrome frames 273 and 274 in "Chroma_A" with borrowed chroma frames 273 and 274 in "chroma". The next few lines will perform operations on the results.

ReplaceFramesMC(267,2)
RemoveDirtMC(30,false)

ReplaceFramesMC is used to interpolate new replacement frames for the noisy remnants in frames 267 and 268. There's not much motion in those two frames, so any distortion created by the interpolation will be minor. The two new frames for 267 and 268 will be created based on information in the preceding and following frames, which are frames 266 and 269. Then RemoveDirtMC(30,false) is used for mild denoising of some of the lossy compression grunge that remains in the video.

RelaceFramesMC.avsi is here: http://www.digitalfaq.com/forum/atta...ceframesmcavsi. It requires MVTools 2.27.21.x or later (see above). MVTools is also supplied with the QTGMC plugin.
RemoveDirtMC.avs is here: http://www.digitalfaq.com/forum/atta...emovedirtmcavs. The filter requires RemoveDirt_v09 (http://www.digitalfaq.com/forum/atta...ovedirt_v09zip). It also requires the RemoveGrain package (http://www.digitalfaq.com/forum/atta..._v1_0_fileszip) or use the RgtTools plugin mentioned earlier.
If you are using Windows 7 thru W10, you might also need some VC++ support files. Read here: Fix for problems running Avisynth's RemoveDirtMC.

MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(dept h=10))
LimitedSharpenFaster(edgemode=2)
GradFun2DBmod(thr=1.5,mask=false)
AddGrainC(1.25,1.25)
Chroma_B=last

The aWarpSharp2 code tightens some color bleed around edges and smooths some ragged lines. The code sharpens chroma only, not luma. LimitedSharpenFaster(edgemode=2) sharpens inner detail between edges and is limited so as not to produce more edge halos. GradFun2DBmod is used to mollify some of the muddy posterizing effects that come from low-bitrate lossy encoding in the source sample, often called "clay-face' effects. AddGrainC adds small amounts of very fine film-like grain to help mask hard gradient edges in large smooth expanses such as the background walls. Finally, the result of all of the preceding code is saved as a new video clip named "Chroma_B".

GradFun2DBmod: main page and download link are at http://avisynth.nl/index.php/GradFun2DBmod.
It requires GradFun2DB (http://avisynth.nl/index.php/GradFun2db). It also requires AddGrainC, MaskTools2, and RGTools, which are all included with QTGMC (see above notes).

LimitedSharpenFaster is in LimitedSharpenFaster.zip (http://www.digitalfaq.com/forum/atta...arpenfasterzip). It requires aWarpSharp2 (http://www.digitalfaq.com/forum/atta...sharp2_2015zip). It also requires MaskTools2 and RemoveGrain, which are included with QTGMC (see earlier links for the QTGMC package).

AudioDub(Chroma_B,aud)
return last

The last two lines join the video in "Chroma_B" with the audio in "aud", and then the results of the "last" operation are output.
AudioDub function: http://avisynth.nl/index.php/AudioDub

There are links to some other popular Avisynth filters in this post: 90s camcorder: Removing red-blue chroma lines?.


Attached Images
File Type: png baby video original YUV levels.png (7.9 KB, 40 downloads)
File Type: png baby video corrected YUV level.png (8.3 KB, 40 downloads)
Attached Files
File Type: mp4 raw_Fix2_25p.mp4 (8.52 MB, 7 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: stevevid (09-21-2018)
  #37  
09-20-2018, 02:30 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Quote:
Originally Posted by stevevid View Post
are the scripts for the clips in the "VirtualDub border..." thread available?
Here are details of the Avisynth scripts and VirtualDub settings used for the restoration samples in this thread's post #22 (VirtualDub border masking? (not cropping!)). Perhaps someone can use some of the convoluted workflow tips contained herein. This was a difficult project for repair of a 1991 VHS recording from a bad cable tv signal using really cheapo equipment and an even cheaper RadioShack analog cable amp (cable wasn't digital back then!).

The original recorder no longer exists, which is just as well -- there is no way I would use it for capture. The bad and noisy cable signal, cheap wiring, and cheap gear produced recordings with a horrible noise level. I made multiple captures, each having their own set of defects and problems. The players used were a Panasonic AG-1980 and a 1996 Panasonic PV-V4670 (with a Panasonic Es-10 for tbc pass-thru with the 4670). Both are SVHS machines with s-video output. The capture version used for different processing segments depended on which player gave me fewer tracking problems with dried-up, poorly stored tape. To this day I can barely tell which player produced which capture.

The cables used were BlueJeans Cables YC-2 s-video (https://www.bluejeanscable.com/store/svideo/index.htm) and Belden 1694-A for audio (https://www.bluejeanscable.com/store/audio/index.htm). With both players the bad tape and noisy signal gave false Macrovision effects, so my trusty old AVT-8710 frame-level tbc from 2004 was used in the chain. For a UV LED meter to check signal levels, I used a SignVideo PA-100 proc amp with no color correction applied (I saved color work for post processing). YUV levels were double-checked in VirtualDub Capture with image borders temporarily cropped and then restored before starting capture to YUY2 using huffYUV lossless compression and uncompressed PCM audio. The capture card used for this particular capture was an ATI All In Wonder 9600XT AGP. After reviewing the original capture, I cut it into several segments (cable tv commercials removed) into Lagarith YUY2 files archived on an external hard drive.

I use file naming and coding conventions that are pretty much standard for my workflow -- including oddball file names that help identify the source video and the processing stage. For example, the file name "GB_Liv7C1_ivtc.avs" identifies the file as an Avsinyth script. The "GB" is a group of work and output files from groupings starting with "A" thru "K". These are working groups from a long capture split into 8 to 10-minute segments. "Liv7C1" identifies the original lossless source capture name. "ivtc" indicates that the script performs inverse telecine. That script would produce a lossless AVI named "GB_Liv7C1_ivtc.avi", which matches the name of the script.

One of several sequential .avs scripts that worked on the ivtc'd source is called "GB07_Liv7C1_ivtc_Q_vd.avs". This name identifies the work as belonging to the "GB" group and would be script number 07 in the series that splits the ivtc'd source into several smaller output files. The source capture has many problems that vary scene by scene, so several scripts are often used on a 10-minute source, breaking the source into many smaller sections. The sections are joined later for encoding. "Liv7C1_ivtc" identifies the source as the ivtc'd file. "Q_vd" indicates that QTGMC is used in the script and that VirtualDub filters ("vd") are applied to the script's output. The VirtualDub settings for that script are saved as "GB07_Liv7C1_ivtc_Q_vd2.vcf" using a name that identifies the matching script and a "2" to indicate version 2 of the VDub settings. The lossless file produced is named "GB07_Liv7C1_ivtc_Q_vd.avi" to match the name of the script.

And so on.

I haven't attempted to change the path names shown in the scripts but I removed many of the superfluous "#" comments and disabled lines.

Script #1 is the inverse telecine script for the source capture segment Liv7C1, which was a 22-minute segment of the original 86-minute capture archived on an external hard drive ("J:"). The script starts at frame 14898, using the last 7.5 minutes of the original file.

Code:
AviSource("J:\Livin567\Living7_C1.avi")
Trim(14898,0)
AssumeTFF()
TFM(last).TDecimate()
An edited but otherwise unimproved short section of the ivtc'd lossless output is attached to post #22 as
"GB_Liv7C1_ivtc_spots_and_noise_L.avi" (http://www.digitalfaq.com/forum/atta...and_noise_lavi). The sample is losslessly compressed YUY2 using the Lagarith codec.

The first cleanup stage used on the last part of the sample scene is the script below. The script begins by loading a specified set of Avisynth plugins that allow using QTGMC in a YUY2 colorspace and allows use of some 16-bit processing later in the script with the GradFun3 function. The script also begins with a "Loop" function to add frames to the end for fade-in and fade-out, but I don't recall exactly how I figured that out and wouldn't want to do it again.

Input from the ivtc'd source file is YUY2 progressive at 23.976 fps film speed. This script isn't the final cleanup for this scene.

Code:
# ========  files for QTGMC AVS26 & YUY2/dither ============
dppath="D:\Avisynth 2.5\plugins\AVS26\dither\"
Import(dppath+"Dither.avs")
Import(dppath+"mt_xxpand_multi.avs")
LoadPlugin(dppath+"dither.dll")
Qpath="D:\Avisynth 2.5\plugins\AVS26\QTGMC\"
Import(Qpath+"QTGMC_333s_for_avs_260.avs")
LoadPlugin(Qpath+"avstp.dll")
LoadPlugin(Qpath+"dfttest.dll")
LoadPlugin(Qpath+"RgTools.dll")
LoadPlugin(Qpath+"MVTools2.dll")
LoadPlugin(Qpath+"masktools2.dll")

AviSource("E:\Livin\GB\GB_Liv7C1_ivtc.avi")
Trim(9762,10813)
Loop(28,1051,1051)  #<- need total 1078 frames to match audio
vid=last
Aud=WavSource("E:\Livin\GB\GB07_Liv7C2_ivtcE_aud.wav")
AudioDub(vid,aud)
QTGMC(InputType=1,preset="faster",EZDenoise=8,denoiser="dfttest",\
  ChromaMotion=true,border=true,ChromaNoise=true,DenoiseMC=true,\
  GrainRestore=0.8)
ColorYUV(off_y=-3)
ConvertToYV12(interlaced=false)
SmoothTweak(contrast=1.1,saturation=1.5)
ContrastMask(enhance=2.0)
SmoothLevels(16,1.0,255,16,245,limiter=0,tvrange=true,protect=6)
FixChromaBleeding()
ChromaSHift(C=-4,L=-4)
SmoothUv()
MergeChroma(awarpsharp2(depth=30).awarpsharp2(depth=20))
BiFrost(interlaced=false)
Dither_convert_8_to_16 ()
GradFun3(thr=0.6,mask=0,lsb_in=true,lsb=false,smode=1)
EdgeCleaner()
LimitedSharpenFaster(edgemode=2)
grainfactory3(g1str=2, g2str=2, g3str=2)
AddGrainC(2.5,2.5)

Crop(2,0,-20,-4).AddBorders(12,2,10,2)
# ----- At end, concatenate Tail, add -----
# ----- FadeFX blackout 36-44 to end. -----
source=last
Tail=source.Trim(1068,0)
Out=source+Tail+Tail
Out=Out.ConvertToRGB32(interlaced=false,matrix="Rec601")
return Out
The output was saved from VirtualDub as Lagarith YV12, after VDub filters were applied. As noted at the end of the script, some frames are manipulated so that a fade to black is applied in VirtualDub to Avisynth's output. This is noted in the script because the settings for VDub's FadeFX filter can't be saved in a .vcf file (phooey!). The settings for two other VDub filters were saved in GB07_Liv7C1_ivtc_Q_vd2.vcf, which is attached. The two filters were gradation curves and ColorMill. As for the Avisynth plugins, I always thought I restored too much original film grain.

There were still a ton of dropouts, blobs, blotches, and odd "flashes" in difficult places, as shown in the images in post #22. So a third Avisynth run with special "patching" routines was required. By this I mean that because there was so much motion, the usual de-spot filters didn't work and complete frame replacement with ReplaceFramesMC wasn't feasible because of the gross movement distortion involved. So small square "patches" had to be created from clean areas of the frame and overlaid onto the trouble spots. Input to the script below was Lagarith YV12 output from the previous script:

Code:
AviSource("E:\Livin\GB\"GB07_Liv7C1_ivtc_Q_vd.avi")
SmoothTweak(saturation=1.2)
aud=last
a1=last

b0=a1
b01=a1.ReplaceFramesmC2(516,1).Crop(248,382,-368,-72)
b02=Overlay(b0,b01,x=248,y=382)
a2=ReplaceFramesSimple(a1,b02,mappings="516")

b0=a2
b01=a2.ReplaceFramesmC2(516,1).Crop(240,414,-332,-10)
b02=Overlay(b0,b01,x=240,y=414)
a3=ReplaceFramesSimple(a2,b02,mappings="516")

b0=a3
b01=a3.FreezeFrame(516,516,515).Crop(224,406,-390,-68)
b02=Overlay(b0,b01,x=224,y=396)
a4=ReplaceFramesSimple(a3,b02,mappings="516")

b0=a4
b01=a4.FreezeFrame(516,516,517).Crop(246,406,-356,-66)
b02=Overlay(b0,b01,x=246,y=406)
a5=ReplaceFramesSimple(a4,b02,mappings="516")

b0=a5
b01=a5.ReplaceFramesMC2(488,4).Crop(538,426,-94,-46)
b02=Overlay(b0,b01,x=538,y=426)
a6=ReplaceFramesSimple(a5,b02,mappings="[486 489]")

b0=a6
b01=a6.ReplaceFramesMC(855,3).Crop(568,264,-60,-208)
b02=Overlay(b0,b01,x=568,y=256)
a7=ReplaceFramesSimple(a6,b02,mappings="854 855 856")

b0=a7
b01=a7.ReplaceFramesMC(579,3).Crop(500,254,-132,-220)
b02=Overlay(b0,b01,x=500,y=248)
a8=ReplaceFramesSimple(a7,b02,mappings="578 579 580")

b0=a8
b01=a8.ReplaceFramesMC(843,3).Crop(516,78,-114,-384)
b02=Overlay(b0,b01,x=516,y=78)
a9=ReplaceFramesSimple(a8,b02,mappings="842 843 844")

b0=a9
b01=a9.ReplaceFramesMC(530,1).Crop(30,138,-598,-328)
b02=Overlay(b0,b01,x=30,y=138)
a10=ReplaceFramesSimple(a9,b02,mappings="530")

b0=a10
b01=a10.BadFrames(436,blend=true).Crop(68,44,-564,-428)
b02=Overlay(b0,b01,x=68,y=44)
a11=ReplaceFramesSimple(a10,b02,mappings="436")

b0=a11
b01=a11.ReplaceFramesMC(436,3).Crop(142,66,-490,-404)
b02=Overlay(b0,b01,x=142,y=56)
a12=ReplaceFramesSimple(a11,b02,mappings="436 437 438")

b0=a12
b01=a12.ReplaceFramesMC(438,2).Crop(220,90,-414,-386)
b02=Overlay(b0,b01,x=220,y=90)
a13=ReplaceFramesSimple(a12,b02,mappings="438 439")

b0=a13
b01=a13.ReplaceFramesMC(548,3).Crop(532,72,-100,-402)
b02=Overlay(b0,b01,x=532,y=72)
a14=ReplaceFramesSimple(a13,b02,mappings="548 549 550")

b0=a14
b01=a14.ReplaceFramesMC(557,3).Crop(490,72,-144,-404)
b02=Overlay(b0,b01,x=490,y=72)
a15=ReplaceFramesSimple(a14,b02,mappings="557 558 559")

b0=a15
b01=a15.ReplaceFramesMC(836,3).Crop(230,80,-402,-396)
b02=Overlay(b0,b01,x=230,y=80)
a16=ReplaceFramesSimple(a15,b02,mappings="[836 838]")

b0=a16
b01=a16.ReplaceFramesMC(430,3).Crop(402,328,-230,-144)
b02=Overlay(b0,b01,x=402,y=328)
a17=ReplaceFramesSimple(a16,b02,mappings="[430 432]")

b0=a17
b01=a17.ReplaceFramesMC(444,3).Crop(414,276,-220,-200)
b02=Overlay(b0,b01,x=414,y=276)
a18=ReplaceFramesSimple(a17,b02,mappings="[444 446]")

b0=a18
b01=a18.ReplaceFramesMC(670,3).Crop(448,42,-184,-432)
b02=Overlay(b0,b01,x=448,y=42)
a19=ReplaceFramesSimple(a18,b02,mappings="[670 672]")

###--- mod of standard MDegrain2 by 2BDecided ---###
Source=a19

    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)
    MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) 

    clean=last #save cleaned version
    #return clean # return cleaned version to check it if required
#return last

    diff1=subtract(source,clean).Blur(0.25)
    diff2=diff1.blur(1.5,0)
    diff3=subtract(diff1,diff2) #diff3 is high-ish frequency noise only
    sharpen(0.3,0.0) # sharpen cleaned version a little
#return last

    #mix high frequency noise back in
    overlay(last,diff3.levels(128,1.0,255,0,127,coring=false),mode="add",\
      opacity=0.7)
    overlay(last,diff3.levels(0,1.0,127,128,255,coring=false).Invert(),\
      mode="subtract",opacity=0.7)

    #put cleaned chroma back in with warp sharpening
    mergechroma(clean.aWarpSharp(depth=20.0, thresh=0.75, blurlevel=2, cm=1))

LSFmod()
AddgrainC(1.5,1.5)
vid=last
AudioDub(vid,aud)
return last
The audio portion previously saved as "aud" is remuxed at the end because ReplaceFramesSimple interrupts audio each time it's used. Additional filters are used in VirtualDub's output, including ColorCamcorderDenoise, gradation curves, and a mild NeatVideo 3.0. The settings and the NeatVideo .dnp and .nfp configuration files are attached as "GB07_Liv7C1_ivtc_Q_vd_MVCnv.zip".

A sample of how the "patches" work:
[code]
b0=a11
b01=a11.ReplaceFramesMC(436,3).Crop(142,66,-490,-404)
b02=Overlay(b0,b01,x=142,y=56)
a12=ReplaceFramesSimple(a11,b02,mappings="436 437 438")
/code]

Line #1 saves the previously repaired "a11" clip as "b0", to be used later in line 4.

Line #2 creates a frame with some motion distortion but the undistorted portion is in a small square patch with frame coordinates x=142 y=56 on the upper left corner of the clean area. The size and location of the patch was found by copying the "bad" frame into Photoshop (you could also use MSPaint) and moving the cursor around the 4 corners of the area that contains the "bad" glitch. The new frames are cropped to include only the square patch area in each frame, and the clip created is saved as "b01".

Line #3 Overlays all of the newly created patches from b01 onto the original b0, thus covering up the bad spots at x=142. This new overlaid clip is saved as "b02". What b02 contains is actually hundreds of copies of the same small patch at x=142. That's not what we want. All we want are 3 frames with cleaned patches.

Line #4 replaces frames 436 thru 438 in the previous "a11" with the same cleaned frame numbers from b02. The new clip is saved as "a12".

Does this stuff take patience and a long time? Yes. Did I have many tapes that were as godawful as this? Not many. In the meantime this 1954 movie has been released on DVD, so why not just ditch the tape? Well, as some of you might know, ugly things can have strong sentimental value. Besides, when you're working with pristine VHS tapes that need very little work, you don't learn anything about processing. It also helps to be a little nutty.


Attached Files
File Type: vcf GB07_Liv7C1_ivtc_Q_vd2.vcf (6.2 KB, 1 downloads)
File Type: zip GB07_Liv7C1_ivtc_Q_vd_MVCnv.zip (32.9 KB, 1 downloads)

Last edited by sanlyn; 09-20-2018 at 02:42 PM.
Reply With Quote
The following users thank sanlyn for this useful post: stevevid (09-21-2018)
  #38  
09-21-2018, 03:28 PM
stevevid stevevid is offline
Premium Member
 
Join Date: Jul 2018
Location: Dallas, TX
Posts: 116
Thanked 10 Times in 8 Posts
Wow! (maybe I should trademark wow since I'm using it so much)

Another excellent demonstration of what can be done with AviSynth and VirtualDub.

Thank you for taking the time to find the old information, posting it and explaining it.

Steve
Reply With Quote
  #39  
09-21-2018, 03:34 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,396
Thanked 1,066 Times in 889 Posts
Thank goodness every capture doesn't need that much work!
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Light Gray Border with SignVideo PA-100/Macrovision sanlyn Capture, Record, Transfer 32 06-08-2017 01:05 PM
Two VirtualDub questions: cropping artifact, file splitting start/end points ashworth080142 Restore, Filter, Improve Quality 5 07-23-2014 07:05 AM
Cropping overscan from VHS (for DVD) naripeddi Edit Video, Audio 6 03-13-2013 03:17 AM
Why is there a black border around my video? (JVC DR-MH30) quarkz Capture, Record, Transfer 6 01-07-2013 10:58 PM
Question about Adobe Premiere (masking related) unclescoob Restore, Filter, Improve Quality 5 12-28-2011 09:32 AM

Thread Tools



 
All times are GMT -5. The time now is 03:33 AM