Quantcast Newbie to video restoration: how to improve? Also A/V sync issues? - digitalFAQ Forum
  #1  
04-14-2018, 10:18 AM
Skitter Skitter is offline
Premium Member
 
Join Date: Dec 2017
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
Hello again.

So I've got some captures, and so far, they look pretty good to my untrained eye.
However, I'm pretty sure they need some improvement, as everything does.
This is my setup.
-JVC HR-S9911u > AVT 8710 > ATI TV Wonder HD 600 Usb

T005samp: I'm just wondering what I can do to improve this. More importantly, what things (tools) can I use to look for things that need to be improved?

T009samp: same as above, except I think the audio is a bit out of sync (I'll come back to this issue in a sec.)

Weddingsamp: Okay, this one obviously looks pretty bad. Other sections of the tape are not so bad, but this was recorded on a different camcorder from our home videos. This one also suffers from A/V gradual sync loss.

So about the loss of A/V sync.
It's a gradual loss, and is only noticeable around 30+ minutes. T009samp comes from the end of a 30 minute tape. The full wedding tape is almost an hour long, and the A/V is off by half a second or so (audio delayed).
I'm using the settings from this guide. I've tried capturing a few times while messing around with the timing settings in Vdub, but nothing seemed to change. I've also tried capturing a retail VHS and ended up with the same gradual loss of sync.
How do I fix such a thing? (or achieve a properly synced initial capture)


Attached Files
File Type: avi T005samp.avi (94.85 MB, 10 downloads)
File Type: avi T009samp.avi (79.23 MB, 3 downloads)
File Type: avi Weddingsamp.avi (69.57 MB, 3 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-14-2018, 02:03 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
Thanks for the samples. Unfortunately they're Huffyuv_MT. Which lkeads me to ask which media player you are viewing them with, because most players won't recognize multithreading Huff MT. You can't install the MT version on 64-bit ystem without one of two results: (a) the newer huffyuv becomes disables, or (b) the system won't recognize huffyuv_MT.

The huff MT version is obsolete and was designed for Win98. Note that "multi-threading" and "multi-core" are not the same thing and opretae differently. The newer huffyuv is optimized for milti-core machines and is faster than huffyuv_MT.

In nay case I'm unable to read your samples, and most readers will not have the MT version installed. The current version is 2.2.1,m available here:https://www.videohelp.com/download/huffyuv-2.1.1.zip .

Quote:
Originally Posted by Skitter View Post
So about the loss of A/V sync.
It's a gradual loss, and is only noticeable around 30+ minutes. T009samp comes from the end of a 30 minute tape. The full wedding tape is almost an hour long, and the A/V is off by half a second or so (audio delayed).
I'm using the settings from this guide. I've tried capturing a few times while messing around with the timing settings in Vdub, but nothing seemed to change. I've also tried capturing a retail VHS and ended up with the same gradual loss of sync.
How do I fix such a thing? (or achieve a properly synced initial capture)
- Don't use Huffyuv_MT.

- Don't audition audio while capturing. if you want to see if audio is actually being received and captured, use the "View" menu for the audio display at then bottom of the capture window.

- Don't use any timing options that request VirtualDub to sync audio in any way. Audio sync is performed by the ATI 600.

- Don't capture to the same hard drive where Windows is installed.

- Start captures with the F6 key, not with F5 and not with the "start capture" button. Stop captures by pressing the "Escape" key in the upper left corner of your keyboard.

- Don't use "Overlay" viewing mode. Use "Preview"

- Don't use any VirtualDub filters during capture. If you must use filters, use only those in your capture card proc amp settings. Those settings are in the "video" main menu "Capture filters...." dialog in the "Video proc amp" tab, and in the "Video" -> "Levels...." dialog. The proc amp dialog usually looks like the one at the top of post $3 in the Guide you referenced (Capturing with VirtualDub [Settings Guide]).

Rather than recapture your videos to undo Huffyuv_MT compression, you can make a short sample as follows and encode to either huffyuv 2.2.1, or get a slightly smaller sample using the Lagarith codec and YUY2 color. Using either compressor, save a sample in this manner:
- After you select and cut the sample you want to make...
- Go to "Video..." -> "Color depth" and choose YUY2 4:2:0 colorsapece n the right-hand panel.
- Go to "Video.." -> "compression"
- In the left-hand list of compressor use either huffyuv 2.2.1 or choose Lagarith after installing it.
- For Lagarith, check the configuration menu and set it for YUY2.
- In the "Video..." menu enable "fast recompress". This step is important.
- Close the video dialogs and click "Save Avi...", then give your sample a name and location.

The Lagarith download includes both 32-bit and 64-bit versions. Its installer will automatically analyze your system and install both versions if necessary. The 32-bit version should be used at all times. If you run 32-bit VirtualDub, the 32-bit version will be listed in the compressor listing.
Lagarith auto installer: https://lags.leetcode.net/LagarithSetup_1327.exe
An advantage of Lagarith is that while it is more CPU intensive for capture (use Huffyuv for capture), it can compress YV12, YUY2, and RGB with slightly smaller files than huffyuv. Huff can't compress YV12, which is often used to compress lossless intermediate working files.

Last edited by sanlyn; 04-14-2018 at 02:27 PM.
Reply With Quote
The following users thank sanlyn for this useful post: Skitter (04-14-2018)
  #3  
04-14-2018, 03:23 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
Well, now, I managed to download those samples again onto another computer that had HuffYUV_MT installed. I can read them, but will need to take a look later. The computer that worked is a crummy Netbook with a really teensty screen, so give us some time on analyzing this.

I note the wedding avi has some color channel inversion on the right border. Sometimes this disappears when using a different model player (which is why we recommend that you have more than one player in your arsenal). The outdoor shot also has color problems. I can take another look later after I recompress them and copy them to a better laptop, and hopefully other readers will be able to play these samples and offer some different ideas.
Reply With Quote
  #4  
04-14-2018, 04:10 PM
Skitter Skitter is offline
Premium Member
 
Join Date: Dec 2017
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
In nay case I'm unable to read your samples, and most readers will not have the MT version installed. The current version is 2.2.1,m available here:https://www.videohelp.com/download/huffyuv-2.1.1.zip
Am I supposed to get 2.1.1 or 2.2 (beta)?

Also:

Quote:
Originally Posted by sanlyn View Post
- Go to "Video..." -> "Color depth" and choose YUY2 4:2:0 colorsapece n the right-hand panel.
Is that supposed to be YUY2 4.2.2? Because that's the only one I'm seeing that says (YUY2).
The other ones that are 4.2.0 are planar (YV12) and (NV12)

Quote:
Originally Posted by sanlyn View Post
- Don't use Huffyuv_MT.
Got it.
Quote:
Originally Posted by sanlyn View Post
- Don't use any timing options that request VirtualDub to sync audio in any way. Audio sync is performed by the ATI 600.
Got it.
Quote:
Originally Posted by sanlyn View Post
- Don't audition audio while capturing. if you want to see if audio is actually being received and captured, use the "View" menu for the audio display at then bottom of the capture window.

- Don't capture to the same hard drive where Windows is installed.

- Start captures with the F6 key, not with F5 and not with the "start capture" button. Stop captures by pressing the "Escape" key in the upper left corner of your keyboard.

- Don't use "Overlay" viewing mode. Use "Preview"

- Don't use any VirtualDub filters during capture. If you must use filters, use only those in your capture card proc amp settings. Those settings are in the "video" main menu "Capture filters...." dialog in the "Video proc amp" tab, and in the "Video" -> "Levels...." dialog. The proc amp dialog usually looks like the one at the top of post $3 in the Guide you referenced (Capturing with VirtualDub [Settings Guide]).
Already following these steps.

Thanks.
Reply With Quote
  #5  
04-14-2018, 05:26 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
LOL, you're certainly much better at catching my stupid typos than I am! I hate laptop keyboards. I think forums know when I'm using a laptop and they move characters around after I log off!


Quote:
Originally Posted by Skitter View Post
Quote:
Originally Posted by sanlyn View Post
The current version is 2.2.1,m available here:https://www.videohelp.com/download/huffyuv-2.1.1.zip .
Am I supposed to get 2.1.1 or 2.2 (beta)?
The correct version is 2.1.1, as linked. I read where 2.2 beta still isn't ready for prime time.

Quote:
Originally Posted by Skitter View Post
Quote:
Originally Posted by sanlyn View Post
- Go to "Video..." -> "Color depth" and choose YUY2 4:2:0 colorsapece n the right-hand panel.
Is that supposed to be YUY2 4.2.2?
It sure is. And you're correct, YUY2 is 4:2:2, not 4:2:0 or 4:1:1.
However, you might want something like Lagarith anyway for post processing work files. Many popular Avisynth filters are available for YV12 only. Fortunately Avisynth is very accomplished at making clean colorspace conversions, unlike most NLE editors --and DVD, BluRay, and most h.264 and some HD-DV internet formats are encoded as YV12. Capture from analog tape is at YUY2 because it gives you more color depth to start with and because it more closely resembles the colorspace used by tapes and by broadcast TV. Many capture cards that capture at YV12 don't do such a great job at making that conversion.

If you're following the usual capture steps and recommendations and still getting trailing audio, it has to be a problem with system synergy between some component or another. In capturing over 400 hours of video tapes over the years, I had that sync problem only once and finally figured out what it was (I used F5 to start). Every time I see someone mention this glitch, I'm at a loss for words because I just must be lucky -- I've never had the problem and I've used 4 capture cards, two of them AGP mounts and two USB's, 5 PC's, several VCRs, the same AVT-8710, and even several pass-thru units. On the other hand I was always using XP, but my VC500 capture card performed perfectly for 4 captures with Win7. If the problem continues, the usual recommendation is to switch to AmarecTV. You can do without Amarec's own proprietary codec (not very good, and not free, so pass it up) but it does work with huffyuv and Lagarith. It's little good to switch to the latest VirtualDub because it has other bugs apart from capture.

Thanks again for the captures. I'll see what I can come up with.
Reply With Quote
  #6  
04-15-2018, 12:36 PM
Skitter Skitter is offline
Premium Member
 
Join Date: Dec 2017
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
It sure is. And you're correct, YUY2 is 4:2:2, not 4:2:0 or 4:1:1.
However, you might want something like Lagarith anyway for post processing work files. Many popular Avisynth filters are available for YV12 only. Fortunately Avisynth is very accomplished at making clean colorspace conversions, unlike most NLE editors --and DVD, BluRay, and most h.264 and some HD-DV internet formats are encoded as YV12. Capture from analog tape is at YUY2 because it gives you more color depth to start with and because it more closely resembles the colorspace used by tapes and by broadcast TV. Many capture cards that capture at YV12 don't do such a great job at making that conversion.

If you're following the usual capture steps and recommendations and still getting trailing audio, it has to be a problem with system synergy between some component or another. In capturing over 400 hours of video tapes over the years, I had that sync problem only once and finally figured out what it was (I used F5 to start). Every time I see someone mention this glitch, I'm at a loss for words because I just must be lucky -- I've never had the problem and I've used 4 capture cards, two of them AGP mounts and two USB's, 5 PC's, several VCRs, the same AVT-8710, and even several pass-thru units. On the other hand I was always using XP, but my VC500 capture card performed perfectly for 4 captures with Win7. If the problem continues, the usual recommendation is to switch to AmarecTV. You can do without Amarec's own proprietary codec (not very good, and not free, so pass it up) but it does work with huffyuv and Lagarith. It's little good to switch to the latest VirtualDub because it has other bugs apart from capture.

Thanks again for the captures. I'll see what I can come up with.
I corrected the samples per your instructions.

I now know why I couldn't get any of my captures to play in the usual media players.


Attached Files
File Type: avi T005samp2.avi (94.85 MB, 8 downloads)
File Type: avi T009samp2.avi (79.22 MB, 8 downloads)
File Type: avi Weddingsamp2.avi (69.55 MB, 10 downloads)
Reply With Quote
  #7  
04-15-2018, 09:27 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
Your files T005samp2.avi and Weddingsamp2.avi are downloading only partially and are not usable. I'll work with the earlier downloads of those files which I decoded on another PC with the earlier MT codec.
Reply With Quote
  #8  
04-18-2018, 06:33 PM
Skitter Skitter is offline
Premium Member
 
Join Date: Dec 2017
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by sanlyn View Post
Your files T005samp2.avi and Weddingsamp2.avi are downloading only partially and are not usable. I'll work with the earlier downloads of those files which I decoded on another PC with the earlier MT codec.
Odd, I downloaded them on another PC and they worked fine. (Works on my endô)

Now, I've gone through my PC, making sure nothing major is running in the background, and double-checked the settings in Vdub. I retried capturing a ~50 minute video a few different times, same thing.
I don't know if it's worth noting, but I misspoke before; the audio is ahead of the video, not trailing.

So unless a magician comes in and makes it go poof, the next option is to use AmaRec?
Are there any guides for configuring that properly?
Reply With Quote
  #9  
04-18-2018, 11:23 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
Quote:
Originally Posted by Skitter View Post
So unless a magician comes in and makes it go poof, the next option is to use AmaRec?
Are there any guides for configuring that properly?
The general rule is: whatever works. Likely a system tie-up with VirtualDub that will find you in a rest home before anyone figures out exactly what's going on. I'd say, start putting some time in with Amarec. It's not as detailed as VirtualDub capture, so it's pretty much self-explanatory. Sorry you had such a hard time with ye olde VDub.

I managed to build a package of all-working AVI samples from your earlier posts and the one sample that downloaded properly in the last batch. Thanks for supplying them. I did make some improvements. A couple of them were rather obvious and simple. It's the wedding video that poses the challenges. That tape was either improperly stored (heat damage) or copied/processed incorrectly. It's in horrible condition.

Here are some before/after pics ("before" on the left, "after" on the right) and a few brief notes. I'll get into more detail in the morning, after I clean up my scripts and prepare some VirtualDub settings files for you to post later. For the imahges below and the attached mp4's, I'm working with an non-calibrated laptop monitor (yikes!), so color or levels might be less than perfect.

From the T005 avi sample: before (left), after (right). There was a little tape noise, easy to fix, but a strong cyan color cast, off-color skin tones, murky shadows, and the usual effects of mixed lighting. A mild midrange boost helped the shadows. These were all denoised in Avisynth and color corrected with Virtualdub.



From the T009 avi sample: before (left, after (right). The color cast was a strong green, with an almost crippled blue. I took my cue off the boy's sweater (white?) and skin tones. There was a correction for vertical chroma shift, notably with red. Reminder: No, there's no way to correct an out-of-focus shot. Anyway, it lasted for only a short moment.



Part A (first camera shot) from the wedding avi: before (left), after (right). Really ugly oversaturated reds. The color spectrum is really torturous, some blacks are greenish, others are purple. The color balance and exposure varies several times while the camera is panned, thanks to those wonderful auto "features" in consumer cameras. There's also some lateral distortion from the rolling shutter on the fast pan. Full color correction is likely impossible, but I did what i could. There is also a lot of tape noise. Note the bad color stain on the right edge, evident in the "before" image, lower right margin. It's corrected in the "after" image.



Part B (second camera shot) from the wedding avi: before (left), after (right). It's anyone's guess what the color of the auto is, but I suspect the ribons were white. There's an obvious magenta cast, and side border stains on the left and right margins. There are slowly fluttering color cast changes that couldn't be fully corrected.


Tomorrow I'll post detailed scripts and the VirtualDub settings for the attached mp4's.



Attached Images
File Type: png T005 Before vs After.png (618.2 KB, 96 downloads)
File Type: png T009 Before vs After.png (596.0 KB, 94 downloads)
File Type: png Wedding PartA before-after.png (605.6 KB, 94 downloads)
File Type: png Wedding PartB before-after.png (558.8 KB, 94 downloads)
Attached Files
File Type: mp4 T005_480i_4x3DAR.mp4 (5.99 MB, 3 downloads)
File Type: mp4 T009_480i_4x3DAR.mp4 (5.16 MB, 2 downloads)
File Type: mp4 Wedding_480i_4x3DAR.mp4 (4.23 MB, 3 downloads)

Last edited by sanlyn; 04-18-2018 at 11:52 PM.
Reply With Quote
  #10  
04-19-2018, 06:30 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 2,910
Thanks: 87
Thanked 875 Times in 756 Posts
Information Overload #1,234,851

Your three samples demonstrate that the same filters or settings seldom work for every video source. In this case the wedding sample shows that the same filters often won't work scene-by-scene with VHS. Of course, many defects are common to VHS and are repaired using similar methods. Fortunately, most analog tapes won't need much work.

Attached are the .vcf files (VirtualDub_vcf_files.zip) with the VirtualDub settings I used for the three mp4's posted earlier. You create a .vcf file by loading filters in VirtualDub and click "File.." -> "Save processing settings". It's a plain text file you can read in Notepad (but don't change anything unless you know what you're doing! Save a backup). To load the filters, click "File" -> "Load processing settings" and locate and open the saved .vcf file.

When a .vcf is loaded, any filters you've already loaded in VirtualDub will be overwritten. For the .vcf to load, all of the named filters must be in your VirtualDub plugins folder. The filters used for the mp4's were ColorMill, gradation curves (aka "curves"), and Color Camcorder Denoise (aka CCD). The three named filters plus two others can be downloaded as VirtualDub_filters.zip. Download the zip to a separate folder and decompress. The .zip contains 5 small subfolders with filters. I loaded the filters and adjusted them when running the avs scripts in Virtualdub. When the .vcf loads you can view the filter settings to see how they were set up.

Avisynth plugins: When you start building up your Avisynth plugins, don't download the package into the plugins folder. They are usually zip or rar files, and decompressing them in the plugins folder will soon find your plugins filled with junk. Make a separate dedicated folder somewhere and create subfolders for each plugin's data and docs. That way, you'll always know where the filter and its info are kept.

Script for T005 avi:

Black levels were somewhat high during capture, with a washed-out look. But this often happens when levels change a lot during play. But clipping darks or brights was avoided, which is good. The script begins by using the Import() function (http://avisynth.nl/index.php/Internal_functions#Import) to import the actual text of the ContrastMask and RemoveDirtMC plugins. These two plugins are .avs scripts themselves and are saved as .avs because they come in many versions with similar code. To get more detail about Avisynth functions, use Google with the word "Avisynth" and the name of the filter. Built-in functions are also described in Avisynth's installed Help. Avs plugins should be in the Avisynth plugins folder.

The ColorYUV function was used to lower the black level to more natural proportions (http://avisynth.nl/index.php/ColorYUV). The ContrastMask plugin is used to bring up shadow detail. ContrastMask.avs is attached. It requires the VariableBlur plugin, which you can get from variableblur_070.zip. VariableBlur is a .dll plugin that loads automatically when used in a script, no import required.

The basic denoiser used here is RemoveDirtMC.avs. Some of the filters require non-interlaced video, so SeparateFields() is used to simulate deinterlacing. Later the fields are weaved back into interlaced frames again.

The final step converts color properly to RGB32 for the VirtualDub filters. On colorspace conversions you should always specify interlaced = true or false to avoid screwing up chroma channels. http://avisynth.nl/index.php/Convert

aWarpSharp2 is used to tighten chroma around edges and prevent the a "bleed" look. On the download page for the aWarpSharp2 plugin note that the filter, like many Avisynth filters, requires a Microsoft Visual C++ runtime. Many other programs use MSVC runtime files. The 2015 version is here: https://www.microsoft.com/en-us/down....aspx?id=52982

Code:
Import("Drive:\path\to\Avisynth\plugins\ContrastMask.avs")
Import("Drive:\path\to\Avisynth\plugins\RemoveDirtMC.avs")
 The script begins by using the Import() function 
# --- Adjust the path statement to match your system ---###
AviSource("E:\forum\faq\skitter\T005samp.avi")

# --- Adjust black levels, add a little contrast  ---###
ColorYUV(off_y=-8,cont_y=10)

ConvertToYV12(interlaced=true)
ContrastMask(enhance=2.5)
SmoothUV()
SeparateFields()
RemoveDirtMC(20,false)
MergeChroma(aWarpSharp2(depth=20))
Weave()

# --- Clean/even-up borders, center the image ---###
Crop(6,2,-10,-2).AddBorders(8,2,8,2)
# --- Conversion for VirtualDub processing ---###
ConvertToRGB32(interlaced=true,matrix="Rec601")
Script for T009 avi:

This script is similar to the above, just a few differences. It uses the ChromaShift plugin (attached) to shift red chroma upward by 2 pixels (http://avisynth.nl/index.php/ChromaShift). The sharpener used here is LFSmod. Pay attention to the LSFmod download page at http://avisynth.nl/index.php/LSFmod, which has links to its required support files. LSFmod and its support files are also used by other major plugins, so you can get a few of them all at once. The plugin file itself is LSFmod.avsi -- an avsi file loads automatically, no import required.

Code:
Import("Drive:\path\to\Avisynth\plugins\RemoveDirtMC.avs")

# --- Adjust the path statement to match your system ---###
AviSource("E:\forum\faq\skitter\T009samp2.avi")
ConvertToYV12(interlaced=true)
SeparateFields()
RemoveDirtMC(20,false)
ChromaShift(L=-2)
MergeChroma(aWarpSharp2(depth=20))
LSFMod()
Weave()

# --- Clean/even-up borders, center the image ---###
Crop(6,2,-10,-2).AddBorders(8,2,8,2)
# --- Conversion for VirtualDub processing ---###
ConvertToRGB32(interlaced=true,matrix="Rec601")
Script for Wedding avi, Part A:

The Wedding vid is in sad shape.

The Trim() function (http://avisynth.nl/index.php/Trim) is used to extract the first 160 frames, 0 thru 159, of the sample. For the first part of the script the colorspace is converted from YUY2 to YV24, a variation of YUY2 but with databits arranged differently. Levels and color balance go schizo for the entire camera pan, so the special AutoAdjust plugin (attached) is used to help calm those sudden changes. Use the 32-bit (x86) version of AutoAdjust.

Three Avisynth functions adjust black levels, contrast, and gamma: ColorYUV(), Tweak(), and Levels().

The method used to clean the discolored left and right borders needs some explanation. The code makes a copy of a section of the image that lies just to the left of the right-border discoloration. It then overlays only the chroma (color) of that borrowed section of clean image onto the "dirty" margin. The code then does the same thing for the left margin. This isn't 100% perfect, but it beats doing it manually frame by frame in something more complicated like Photoshop Pro or Premiere.

The color matrix is then converted to YV12 for the remaining filters. Special plugin SmoothUV.dll (from http://avisynth.nl/index.php/SmoothUV) is used to smooth some of the color smearing, which is a tough problem. FixChromasBleeding.avsi (see attached) helps with the ugly saturated reds. FixChromaBleeding.avsi loads automatically, no import needed. It requires ChromaShift.dll, also attached.

The script includes a special function called MVDG2(), whose code appears at the bottom of the script. This is really just a modified copy of the MVDegrain2 filter that comes with the MVTools plugin. It's a medium-strength denoiser. MVTools2_27.21.22 is attached.

Code:
## ##############################
##        WEDDING - PART A
## ##############################
Import("Drive:\path\to\Avisynth\plugins\RemoveDirtMC.avs")
Import("Drive:\path\to\Avisynth\plugins\FixChromaBleeding.avs")

# --- Adjust the path statement to match your system ---###
("E:\forum\faq\skitter\Weddingsamp.avi")
Trim(0,159)

ConvertToYV24(interlaced=true)
AutoAdjust(high_quality=true,auto_gain=true,dark_limit=3.0,gamma_limit=3.0,\
  auto_balance=true,gain_mode=1,chroma_process=200,balance_str=1.0)
#--- Further tweaks for black levels, contraast, avoid clipping ---#
ColorYUV(off_y=-14)
Tweak(cont=1.1,dither=true,coring=false)
Levels(16,1.15,255,16,235,dither=true,coring=false)

#---borrow 32-pixels of chroma from other parts of the right-hand image ---
a=last
b=a.Crop(656,0,-32,0).ColorYUV(off_y=-4)
chr=overlay(a,b,x=684)
MergeChroma(a,chr)

#---borrow 40-pixels of chroma from other parts of the left-hand image ---
a=last
b=a.Crop(40,0,-640,0).ColorYUV(off_y=-4)
chr=overlay(a,b,0,y=0)
MergeChroma(a,chr)

ConvertToYV12(interlaced=true)
SmoothUV()
SeparateFields()
RemoveDirtMC(40,false)
MVDG2()                  # <- MVDG2 function at bottom of script
FixChromaBleeding()
MergeChroma(aWarpSharp2(depth=30).aWarpSharp2(depth=10).\
   fft3dfilter(sigma=.1, sigma2=.3, sigma3=.5, sigma4=25, plane=3))
LSFmod()
Weave()
ConvertToYUY2(interlaced=true)
Crop(8,2,-12,-14).AddBorders(10,8,10,8)
ConvertToRGB32(interlaced=true,matrix="Rec601")
return last


function MVDG2(c)
{ source=c

  super = source.MSuper(pel=2, sharp=1)
  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)
  MDegrain1(source,super, backward_vec1,forward_vec1,thSAD=400) 

 #save cleaned version
    clean=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 cleaned version a little
    sharpen(0.3,0.0)
 #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))

return last }
Script for Wedding avi, Part B:

The script begins by using Trim() to extract frames 160 thru the end of the Wedding sample. The color problems are different here, with the strong magenta cast. This script is very similar to Part A, just slightly different. After filtering, Parts A and B were joined in Virtualdub.

Code:
## ##############################
##        WEDDING - PART B
## ##############################
Import("Drive:\path\to\Avisynth\plugins\RemoveDirtMC.avs")

# --- Adjust the path statement to match your system ---###
("E:\forum\faq\skitter\Weddingsamp.avi")
Trim(161,0)

ConvertToYV24(interlaced=true)

#---borrow 60-pixels of chroma from other parts of the right-hand image ---
a=last
b=a.Crop(620,0,-40,0).ColorYUV(off_y=-4)
chr=overlay(a,b,x=660)
MergeChroma(a,chr)

#---borrow 40-pixels of chroma from other parts of the left-hand image ---
a=last
b=a.Crop(40,0,-640,0).ColorYUV(off_y=-4)
chr=overlay(a,b,0,y=0)
MergeChroma(a,chr)

ConvertToYV12(interlaced=true)
SmoothUV()
SeparateFields()
RemoveDirtMC(40,false)
MVDG2()                # <- see MVDG2 function at bottom of this script

MergeChroma(aWarpSharp2(depth=20).\
   fft3dfilter(sigma=.1, sigma2=.3, sigma3=.5, sigma4=45, plane=3))
LSFMod()
Weave()
ConvertToYUY2(interlaced=true)
Crop(8,2,-12,-14).AddBorders(10,8,10,8)
ConvertToRGB32(interlaced=true,matrix="Rec601")
return last


function MVDG2(c)
{ source=c

  super = source.MSuper(pel=2, sharp=1)
  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)
  MDegrain1(source,super, backward_vec1,forward_vec1,thSAD=400) 

 #save cleaned version
    clean=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 cleaned version a little
    sharpen(0.3,0.0)
 #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))

return last }
You probably noticed that the Crop() function was used several times. Take care with that function. Special rules apply based on frame structure and colorspace. Note the table near the bottom of the page at .http://avisynth.nl/index.php/Crop. The Overlay() function is described here: http://avisynth.nl/index.php/Overlay.

You can test the effects of a script statement or filter by disabling some of the lines with the "#" mark, which marks a line as a comment. Turning the line on and off and clicking F2 in VirtualDub reloads the script so that you can see what's happening with the filter or without it. Of course, if you hit F2 a few dozen times you'll eventually clobber memory and VirtualDub will crash. No problem. Just start it again.


Attached Files
File Type: zip VirtualDub_vcf_files.zip (3.4 KB, 3 downloads)
File Type: avs ContrastMask.avs (476 Bytes, 2 downloads)
File Type: zip ChromaShift27.zip (21.0 KB, 3 downloads)
File Type: zip AutoAdjust260.zip (541.3 KB, 4 downloads)
File Type: zip FixChromaBleeding.zip (1.7 KB, 2 downloads)
File Type: zip MVTools2_27_21_22.zip (407.1 KB, 4 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: lordsmurf (05-17-2018), Skitter (04-27-2018)
  #11  
05-01-2018, 07:38 PM
Skitter Skitter is offline
Premium Member
 
Join Date: Dec 2017
Posts: 9
Thanks: 5
Thanked 0 Times in 0 Posts
Thanks a ton for all the effort.
That is quite a lot of info to go through, it'll take me a while fiddling around with it.

I also must report that I used Amarec and got good results on the wedding video. (A/V sync issues gone)

One thing of note. That hideously over-saturated green flooring... yeah, that's pretty much the actual color. (We had to live with that abomination for years)

I'm sure I'll have more question, but for now I must continue with the task of capturing this box full of tapes.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
CPU spike causing audio sync issues theglenlivet12 Capture, Record, Transfer 12 02-13-2017 11:34 PM
Video restoration newbie: Avisynth scripts? latreche34 Restore, Filter, Improve Quality 33 01-11-2017 02:05 PM
Digital8 TRV480 vs GV-D800 audio sync issues nesburf Capture, Record, Transfer 0 11-16-2016 09:05 AM
VirtualDub audio sync issues? rds11 Capture, Record, Transfer 2 09-20-2014 01:48 PM

Thread Tools



 
All times are GMT -5. The time now is 04:23 AM  —  vBulletin Copyright © Jelsoft Enterprises Ltd