Go Back    Forum > Digital Video > Video Project Help > Capture, Record, Transfer

Reply
 
LinkBack Thread Tools
  #1  
06-04-2019, 06:52 PM
ehbowen ehbowen is offline
Free Member
 
Join Date: Feb 2018
Location: Houston, Texas
Posts: 339
Thanked 64 Times in 57 Posts
Sanlyn has criticized (essentially all of) my captures for illegal levels...with reason. I have all of the proper equipment which I need, but I'm still struggling with the techniques for adjusting proc amp settings for a given tape using histograms. I'm using VirtualDub 1.9 capturing to HuffyUV lossless (very rarely VDub2 if I want to capture with ProRes for editing in DaVinci Resolve...mostly for practice at this point).

So far, the only histogram display I've found for capture in VDub is the one under the Video menu in the capture screen which, as far as I can tell, does only brightness levels. I'm having issues adjusting the "Capture filter" proc amp settings to normalize those levels. Are there other tools which I should be taking advantage of for capture which I'm missing? Should I be trying to color-correct during the capture?

I'd really appreciate a detailed, step by step approach to making a proper capture, starting with checking the tape for levels, making the appropriate adjustments, and then saving the results. Editing and restoring quality can be addressed at another time. I'd like to begin capturing the raw material at the highest quality possible so that I can work with Avisynth and other tools later down the road as I get more experienced with using them.

Thanks in advance.
Reply With Quote
The following users thank ehbowen for this useful post: archivarious (09-29-2020), ThumperStrauss (02-23-2022)
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
06-04-2019, 08:44 PM
orbit orbit is offline
Free Member
 
Join Date: Jun 2018
Location: Virginia
Posts: 19
Thanked 5 Times in 1 Post
I'd also be interested in this!
Reply With Quote
  #3  
06-04-2019, 10:22 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
There are updated VirtualDub capture details in the later guide,
Capturing with VirtualDub [Settings Guide].

Details for the proc amp settings are explained in the settings guide, post #4. The same post also explains use of the temporary cropping control and why it's used during level settings.

Quote:
Originally Posted by sanlyn View Post
Levels...


These are proc amp settings usually linked to the capture device's proc amp controls. Different capture cards have different dialogs and defaults. Some cards don't provide a link that VDUb can use here. Above, typical proc amp for AIW cards.

You can fiddle with color/hue if you want, but with analog tape its a losing battle -- tapes change color balance minute to minute and scene to scene. Unless the video has an obvious and severe color cast consistent from start to finish, make hue adjustments after capture.

"Brightness" adjusts black levels, "Contrast" adjusts brights. Use these two controls in conjunction with the capture Histogram and Cropping features to set valid input levels for 16-235 video. The controls interact somewhat, but with some fiddling you can adjust the tonal range for acceptable input levels. Levels fluctuate during play, so at best you should set levels for worst-case scenarios and tweak later.

There are usually sharpness and saturation controls. If your input is badly over- or under-saturated, you can adjust here. Caution: saturation affects the saturation of all colors, not just one. Oversaturation results in color bleed and overload (blooming or glowing colors). "Sharpness: might be able to mitigate sharpening halos, but these are usually pesky nasties that exist in the player output itself. Don't sharpen VHS: all you'll do is sharpen noise.

Cropping...



Cropping can be used to mask off areas that affect the levels histogram, such as black or white borders and head-switching noise. You can crop left, right, top, and bottom. TURN THIS OFF BEFORE STARTING CAPTURE or you'll have an unwanted/unacceptable frame size or an error message. Cropping can be turned off ONLY be resettiing the crop parameters to all-Zero's. Simply clicking the "Cropping..." menu item won't turn it off.
Using the histogram to check signal levels is discussed and illustrated in the same guide in post #3.

Quote:
Originally Posted by sanlyn View Post
3: Video (top menu)

Histogram...
The luma levels histogram works only in preview mode and not during capture. The histogram displays a graphic view of input luma levels for checking if the input signal lies within the preferred video range of y=16-235. The histogram displays 16-235 data as blue data across the graphic horizontally: invalid values beyond 16-235 display as red in the side margins (left=darks, right=brights). Red indicates crushed darks and/or clipped whites during capture. If you see a flood of red at either side of the graph, the signal contains luma values that clip during capture. Some slight spillover is allowed now and then. Remember that black borders or bottom-border head-switching noise affects the histogram. These can be temporarily masked with the "Cropping..." dialog (see next post) during capture setup .

Histogram display (video extending beyond 16-235):






Histogram with levels adjust (slight spillover at left is usually OK):



The histogram shown is called a "parade" style historgram. It measures luminance values. Like almost all such histograms, dark values appear at the left and bright values appear at the right. If you adjust luminance during capture for y-16-235 and keep values out of ythe red zones, you'll will likely keep colors within spec as well, without making additional adjustments.

Quote:
Originally Posted by ehbowen View Post
Should I be trying to color-correct during the capture?
It's seldom done that way. You have to be familiar with color correction differences between YUV and RGB systems, and correction in YUV is far more limited than in RGB. VHS changes color balance every few seconds, and especially every couple of minutes. How would you correct that during capture without stopping every time a change occurred?

If you want an RGB histogram that measures all three colors and average brightness, use an RGB histogram in post-processing after capture. You can spend time and effort trying to color-correct VHS during capture if you really want to go through the frustration it, but it's an exercise in futility with VHS and is best done later. If you wish, however, there are RGB in-capture histograms in various shop-level tools costing $1000 or more; you will have to re-adjust color values using a monitor calibrated with a precision color probe and will have to change color settings every few minutes during capture. If that's what you want, it's up to you. You will still have to us a histogram that lets you know when RGB colors go too far out of spec, and you'll have to learn how to adjust individual color contrast, step-up/step/down settings, curve filters, etc, to avoid illegal chroma values.

Quote:
Originally Posted by ehbowen View Post
I'd like to begin capturing the raw material at the highest quality possible so that I can work with Avisynth and other tools later down the road as I get more experienced with using them.
If you intend to do restoration mods why are you capturing with lossy Prores? I assume you understand that ProRes is designed for pristine digital source, not for noisy VHS. And DaVinci doesn't work with lossless codecs, which is pretty dumb for something at its price point that calls itself "professional". Unless you're familiar with advanced color theory and understand how to use histograms and vectorscopes, you're wasting the features of apps like DaVinci. But use whatever you want.

Here are 2 links to a couple of free web tutorials that a very good discussions of histograms and what they can tell you. These are for photo histograms, but the principles are the same for video. After all, video is a stream of still images.

Using Histograms, Part 1: Tones & Color: https://www.cambridgeincolour.com/tu...istograms1.htm
Using Histograms, Part2: Luminosity & Color: https://www.cambridgeincolour.com/tu...istograms2.htm

Last edited by sanlyn; 06-04-2019 at 10:33 PM.
Reply With Quote
The following users thank sanlyn for this useful post: archivarious (09-29-2020), captainvic (06-05-2019), ehbowen (06-05-2019), orbit (06-05-2019)
  #4  
06-05-2019, 01:13 AM
ehbowen ehbowen is offline
Free Member
 
Join Date: Feb 2018
Location: Houston, Texas
Posts: 339
Thanked 64 Times in 57 Posts
I'm not using ProRes or DaVinci for any serious restoration work, mainly just to play around with for practice. (By The Way, if you check the DaVinci support forum you'll see that I have an official feature request in to provide support for lossless video codecs to be used with legacy video.) I'm in full agreement that lossless is the way to go, especially when dealing with the limited image information in legacy video.
Reply With Quote
  #5  
06-05-2019, 04:27 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
I understand, just wanted to make you aware of the DaVinci limitation. I didn't know about it until I installed it a few years ago and had to uninstall. I replaced it with AfterEffects and ColorFinesse.

One of these days you might want to take a look at this very popular guide: Color Correction Handbook: Professional Techniques for Video and Cinema. For a number of years it's been the stock digital color handbook. Covers various software apps, plays no favorites, but mainly deals with principles and details regardless of the software used. You can even use it with VirtualDub's color controls, which mimic some of those from Adobe and others.
.

Last edited by sanlyn; 06-05-2019 at 04:52 AM.
Reply With Quote
  #6  
06-10-2019, 09:33 PM
ehbowen ehbowen is offline
Free Member
 
Join Date: Feb 2018
Location: Houston, Texas
Posts: 339
Thanked 64 Times in 57 Posts
Thank you for the help, sanlyn. I have captured the tapes for my mom's friend. She's a music teacher and wants to be able to show these old VHS films to her students.

I told her going in that I wasn't going to attempt any intensive restoration. But, at the same time, I'd like to show these off to best advantage. She wants them rendered to mp4, but possibly in the future will want them burned to DVD as well. So I'm thinking about two separate passes with Avisynth, one deinterlaced for rendering to MP4 and the other interlaced to render to MPEG-2 for possible future use on a DVD. Script suggestions are welcomed.

Total of six tapes; four clips. The first is a Classical Piano Performance tape for music teachers. There's also a Baroque and a 20th Century Performance techniques tape which are from the same publisher and very similar in color range and contrast.
ClassicalPerformance.20190610.clip.avi

Next clip is from the same series, but of dance performance. The background was pure white on the monitor; looks like it picked up a bit of a color cast during capture.
BaroqueDance.20190610.clip.avi

Finally, there are tapes of two musical performances: Hansel & Gretel (opera) and The Nutcracker (ballet).
HanselAndGretel.20190510.clip.avi
Nutcracker.20190610.clip.avi


Attached Files
File Type: avi ClassicalPerformance.20190610.clip.avi (63.99 MB, 13 downloads)
File Type: avi BaroqueDance.20190610.clip.avi (83.27 MB, 11 downloads)
File Type: avi HanselAndGretel.20190510.clip.avi (38.51 MB, 8 downloads)
File Type: avi Nutcracker.20190610.clip.avi (42.07 MB, 11 downloads)
Reply With Quote
  #7  
06-11-2019, 02:51 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Thank you for the samples. Middle of the night here and I'm just up for a quick look around with a rainstorm moving through, so I'll tackle this tomorrow afternoon.

Offhand they're nice looking captures (I should be so lucky with my own stuff!). You shouldn't have nightmares with these (knock wood). Two quick notes to start:

The Nutcracker piece isn't interlaced. It's telecined with hard-coded 3:2 pulldown, typical for VHS mastered from 23.976fps film source. I've gone through a ton of these. You don't deinterlace this type of media, you inverse-telecine or you'll just get duplicate and triplicate frames.

In any case you can build two renderings but without having to re-process everything twice. I'll post sample scripts.
Reply With Quote
The following users thank sanlyn for this useful post: ehbowen (06-11-2019)
  #8  
06-12-2019, 11:44 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Thanks for the work and time you put into posting the samples. It might save you some upload time if you realized that your first two samples were 3 to 4 times the expected file size because they were uncompressed YUY2. Had they been compressed with HuffYUV or Lagarith they would have been faster to upload or you could have uploaded longer clips.

BaroqueDance.20190610.clip.avi
File size uncompressed YUY2 = 85.3 mb
File size huffyuv YUY2 = 26 mb

ClassicalPerformance.20190610.clip.avi
File size uncompressed YUY2 = 65.3 mb
File size huffyuv YUY2 = 20.3 mb

Also, your audio was sampled at 96KHz and other frequencies, which is unnecessary. Capture audio is usually sampled at 48KHz for later use with DVD or BluRay. For the web, audio would likely be resampled at 44.1Khz. Sampling at 96KHz makes a slightly larger file.

Just more of those pain in the neck details that I often forget myself. In the current post I'll get to the first two samples.

For these movies you can deinterlace and save the results as progressive YV12. For this you'll need the Lagarith codec since huffYUV can't compress YV12 and it's preferable to avoid colorspace conversions back and forth between YUY2 and YV12. The handy Lagarith installer is at https://lags.leetcode.net/codec.html.

You will have to deinterlace anyway for web mounting and usually for smart tv use, and for the specific types of denoising and output formats desired. After denoising and saving the clips as progressive, they can be resized for other formats or reinterlaced for DVD, without reprocessing or filtering again. Below, I'll show how.

The most troublesome sample was BaroqueDance.20190610.clip.avi. It's big problem was a lot of embedded digital artifacts and multigenerational distortion. The video itself has been around the block a time or two and has apparently undergone previous digital work. Aliasing, mosquito noise and compression shimmer are strictly digital, not analog. At any rate there isn't a lot you can do with the movie except try to smooth it with a strong filter or two without ruining it, then encode it to any of a few possible formats. Maybe another spot could be sampled so we can analyze what's going on???

The Baroque piece is defintely one for Avisynth. There's not much that VirtualDub alone can do with it. The edge noise is pretty drastic but there's no sense spending weeks on that problem alone since it won't go away 100% anyway. I used the Avisynth script and plugins below to deinterlace and calm the video down a bit, then instructed VirtualDub to save the output using YV12 and Lagarith compression. To do that, Click "Video..." -> "color depth...", and select YV12 for output. Then click "Video"..." -> "compression...", then select Lagarith and configure it for Yv12.

Finally, click "Video..." -> then select "fast recompress" for output (don't use "full processing mode" or you'll get an unwanted RGB conversion along the way). Then click "save Avi..." and give the output file a name and location.

Code:
Import("D:\Avisynth 2.5\plugins\Santiag_v16.avs")
Import("D:\Avisynth 2.5\plugins\MDG2.avs")

AviSource("J:\forum\faq\ehbowen\E\BaroqueDance.20190610.clip.avi")
AssumeTFF()
ConvertToYV12(interlaced=true)
QTGMC(preset="slow",EZDenoise=8,denoiser="dfttest",GrainRestore=0.3,border=true)
Santiag(2,2)
MDG2()
TemporalSoften(4,4,8,15,2)
Crop(4,0,0,-8).AddBorders(2,4,2,4)
Details: The plugins used here and with the other samples are popular and in common use everywhere. No big surprises there. If you're just starting to collect Avisynth plugins, the filters mentioned here form a basic toolkit for VHS and other cleanup. It's a pain in the neck to get them the first time around, but once done you'll use them until you're sick of 'em. The version of Avisynth I use is v2.60 May/2013. You can use later versions if you wish.

Import("D:\Avisynth 2.5\plugins\Santiag_v16.avs")
Import("D:\Avisynth 2.5\plugins\MDG2.avs")

These two statements import the entire text of the code of the two .avs filters mentioned. The filters are explained below. Some filters are supplied as .avs scripts instead of compiled dll's, for reasons best known by their designers. If the Avisynth plugin file ends in .dll or .avsi and if they're in the plugins folder, the plugins are added automatically when the script calls for them. But files as .avs scripts must be imported manually as shown above. There will often be several versions of very similar code with slightly different .avs names.
http://avisynth.nl/index.php/Internal_functions#Import

AviSource("J:\forum\faq\ehbowen\E\BaroqueDance.201 90610.clip.avi")
Change the path statement to match the file's location in your system. AviSource is a builtin, mainstay file decoding utility for Avi containers. Avisynth will look for and use the codec contained in the Avi video.
http://avisynth.nl/index.php/AviSource

AssumeTFF()
ConvertToYV12(interlaced=true)

The Avisynth default for field-order priority is BFF (Bottom Field First), so you'll have to use the AssumeTFF() directive early in the script to override that default. if you don't, deinterlaceg and inverse telecine routines will give unwanted results. Get into the habit of using AssumeTFF() early when it's needed. ConvertToYV12(interlaced=true) is self-explanatory; the input file is YUY2, which is the preferred method of VHS capture, but YV12 will be required for the filters that follow. Don't worry, Avisynth makes this conversion with great precision -- but you do have to tell Avisynth whether or not the video is interlaced. Yes, it does matter or you'll mess up the color. Telecined video is treated as interlaced.
Assume(TFF): http://avisynth.nl/index.php/Parity
Convert: http://avisynth.nl/index.php/Convert

QTGMC(preset="slow",EZDenoise=8,denoiser="dfttest" ,GrainRestore=0.3,border=true)
QTGMC is the world's premium deinterlacer. In this case it's set for double-rate deinterlacing, meaning that you double the frame rate to 59.94 fps and double the frame count (unless you specify otherwise, which you can do with a couple of QTGMC's several dozen parameters). QTGMC's options are explained in its very comprehensive documentation, but most of the time you'll use the same options again and again, and might even use the more basic "presets" more often. The preset stated here is "slow", which is actually the default but it's modified here with some denoising options. "Slow" is indeed slow at about 7 or 8 frames per second, but the preset configures about 40 cleanup options automatically. EZDenoise is an extra filtering operation. It's called at a fairly high strength of 8 and specifies "dfttest" as the denoiser. GrainRestore puts back a small amount (.3) of the original grain to help prevent an over-smoothed clay-face look. "border=true" invokes special frame resizing routines to prevent line twitter in frame borders.

QTGMC has had several major revisions, most of them every 6 months intended to make geeks deliriously happy and to frustrate the heck out of the rest of us. The preferred version is still the "original" 3.32. It's available with a complete set of all of its support files and documentation as QTGMCPluginsPackageNov2017.zip at http://www.digitalfaq.com/forum/atta...kagenov2017zip. It includes links to Microsoft VC++ runtimes also required by dozens of Avisynth plugins and several video apps. The support files include standalone filters you'll use in these samples. If you are just starting to collect Avisynth and VirtualDub plugins, make life easier for yourself by creating a special "Filters" master folder on your PC. Add-ins are usually supplied as zip'd packages that contain many different files you don't want in your main plugin folders. So in your "Filters" master folder create a subfolder for each filter download. Then copy only the filter itself into your plugins. That way, you'll always know where the filters and support files are located, and you'll keep trash out of your plugin folders.

Santiag(2,2)
Santiag is an anti-alias filter used here to help smooth some ragged edges. It works only with non-interlaced video. It's used at a medium strength of 2 for vertical edges and 2 for horizontals. Santiag is available as Santiag_v16.zip. For support files, Santiag requires NNED13, EED12, and the 2012 VisualC++ runtime, all of which are included in the QTGMC package. Under some circumstances it also requires Sangnom2, which you can get at http://avisynth.nl/index.php/SangNom2. The x86 version is what you want. SangNom2 also wants the 2012 runtime which, again, comes with the QTGMC package.

MDG2()
This is a customized degraining filter in .avs script form. It contains code based on (and actually copied from) the MDegrain2 utility inside the big MVTools plugin (which also comes with QTGMC!). There are umpteen versions of it but the one posted at digitalfaq originated at doom9 and videohelp. It's posted as MDG2.avs at http://www.digitalfaq.com/forum/atta...1&d=1524917341.

TemporalSoften(4,4,8,15,2)
TemporalSoften is a built-in temporal smoother, also used here to help smooth harsh edges in facial contours that result from all the degraining done by the other filters. Also helps to smooth some of the block noise in the yellow areas.
TemporalSoften(): http://avisynth.nl/index.php/Soften

Crop(4,0,0,-8).AddBorders(2,4,2,4)
Crop is used to remove dirty, uneven, or otherwise unwanted border pixels, and AddBorders is used to create new border pixels and to maintain the original frame dimensions. In this case, Crop() removes 4 noisy pixels from the left border, 0 from the top, 0 from the right, and 8 pixels of head-switching noise from the bottom border. Cropping has rules based on colorspace and frame structure, most of the time limiting pixels to groups of 2. After the unwanted pixels are chopped off, AddBorders() centers the image in the frame by adding 2 new border pixels to the left, 4 to the top, 2 to the right, and 4 along the bottom.
Crop(): http://avisynth.nl/index.php/Crop
AddBorders(): http://avisynth.nl/index.php/AddBorders

The script's results were saved as a progressive 59.94 fps avi file in YV12 color with Lagarith compression. As with the other samples that were saved in the same way, another script was used to resize the video to square-pixel 640x480 (in a 4:3 frame size) for encoding for PC playback and web mounting. The resize script:
Code:
AviSource("J:\forum\faq\ehbowen\E\Baroque_5994p.avi")
Spline36Resize(640,height)
Pretty simple and straightforward. The results of the above script were saved out of Virtualdub as Lagarith lossless YV12 and submitted to an h.264 encoder. The results are attached as Baroque_5994p_PC_Playback.mp4.

Another choice that's available from the saved 59.94fps 720x480 progressive file is re-interlacing for DVD. Edges in the image are still a little buzzy, so they won't look so great as interlaced video but an example can tell the story better than words. A typical re-interlace script was used to return the video to 29.97fps interlaced:
Code:
AviSource("J:\forum\faq\ehbowen\E\Baroque_5994p.avi")
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()
SeparateFields() takes each of the full-sized progressive frames and from each frame it creates 2 half-height fields, treating each frame as if it contained two interlaced fields. The two half-height fields will actually contain exactly the same image. Then for every 4 of those half-height fields, SelectEvery(4,0,3) selects fields numbered 0 and 3 -- remember that field and frame numbers start with zero, so fields number 0 and 3 are the first (top) field and the last (bottom) fields of the four. Weave() then arranges the two selected fields as the top and bottom interlaced fields into a new interlaced frame.
SeparateFields(): http://avisynth.nl/index.php/SeparateFields
SelectEvery(): http://avisynth.nl/index.php/Select
Weave(): http://avisynth.nl/index.php/Weave

The output of that script is saved as Lagarith YV12, interlaced, 29.97 fps. The encoding with MPEG2 for DVD spec is attached as Baroque_2997i_DVD.mpg.

Yet another choice is available: as noted, the noisy edges and multigenerational noise on the original sample might not look so great as pure interlace. A common way around that is to discard alternate frames from the 59.94fps file, returning it to 29.97fps but still progressive, and then instructing the MPEG or BluRay encoder to encode the file with interlace flags. If you wanted standard definition 720x480 Bluray, you have no choice: you must have either true-interlaced video, or progressive video encoded as interlaced. The other choice for DVD or Bluray is telecine, which in many ways is treated as interlaced.

The second choice of interlace flags is commonly used, but note that by discarding alternate frames you discard 50% of the video's temporal (motion) resolution. This wouldn't be so great with fast action movies such as sports, but something with less action could fare pretty well with most viewers.

Here is the script to select only even-numbered frames, thus discarding alternating, odd-numbered frames, returning the video to 29.97fps, and returning the frame count to the original total:

Code:
AviSource("J:\forum\faq\ehbowen\E\Baroque_5994p.avi")
AssumeTFF()
SelectEven()
You could just as easily specify SelectOdd() to discard even frames, but the even-numbered frames tend to look a little cleaner. That isn't always the case. The progressive-encoded-as-interlaced version is attached as Baroque_2997p_as_interlaced_DVD.mpg.

Processing is a little easier with the second sample, ClassicalPerformance.20190610.clip.avi. This isn't nearly as noisy or "disturbed" as the Baroque clip, and color looks better. Here is the script I used for this video to get a 59.94 progressive Lagarith YV12 file:

Code:
AviSource("J:\forum\faq\ehbowen\F\ClassicalPerformance.20190610.clip.avi")
AssumeTFF()
ColorYUV(cont_y=10)
ConvertToYV12(interlaced=true)
QTGMC(preset="very fast",EZDenoise=4,denoiser="dfttest",ChromaMotion=true,\
  border=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
MergeChroma(aWarpSharp2(depth=30).aWarpSharp2(depth=10))
Crop(4,0,0,-8).AddBorders(2,4,2,4)
You've already seen some of these statements, but here are some newer ones:

ColorYUV(cont_y=10)
This is a very mild increase in luminance contrast ("cont_y") to give a very slightly but visibly more "snappy" and dimensional image. Looking at a YUV histogram of the capture, the darks of the piano seem a little tame and unrealistic -- this is because black levels seemed a little high, hovering around y=40 at their most intense. It's a matter of opinion, of course. Most contrast filters pump or depress the brights, but "contrast" in the ColorYUV() filter tends to stretch values in each direction from the middle, only slightly increasing brights but giving more weight to darks. It's a subtle but visible difference.
ColorYUV() has many features: http://avisynth.nl/index.php/ColorYUV

QTGMC(preset="very fast",EZDenoise=4,denoiser="dfttest",ChromaMotion= true,\
border=true,ChromaNoise=true,DenoiseMC=true,GrainR estore=0.3)

QTGMC is deinterlacer as well as the only denoiser in this script by making use of its EZDenoise feature. The "very fast" preset sets many automatic options but does less noise processing than the slower preset modes. Again, dfttest is the specified denoiser, set to a rather mild srength of 4. In this case we want more options enabled, such as cleaning ChromaMotion noise as well as luma, cleaning ChromaNoise (the default would be luminance only but not color cleaning), and enabling motion compensation with DenoiseMC (analyzing noise changes over multiple frames).

The links for all of the QTGMC stuff was covered earlier, above.

MergeChroma(aWarpSharp2(depth=30).aWarpSharp2(dept h=10))
MergeChroma tells Avisynth to perform a warp-sharp operation only on the colors in the images and to ignore luminance, then merge the cleaned chroma with the former luma. That means it sharpens colors only and avoids oversharpening luma. Note that in YUV color you can process luma and color differently and separately. If you want to know more about how YUV colorspaces behave, the internet has tons of free tutorials and articles. The net effect of this method is to allow aWarpSharp2 to reduce color bleeding and to make colors hug edges more closely (yes, it really does "warp" contours near edges). In this case the script applies 2 doses of aWarpSharp2, one with a wide range of 30 and another with a narrower range of 10 -- these are relative values, not absolutes. All of the samples had color bleed, especially with red.

Download aWarpSharp2 as WarpSharp2_2015.zip. It requires VisualC++ 2015, which installs with the QTGMC package. It also requires non-interlaced video, which is what we're working with now that QTGMC has deinterlaced this video.
MergeChroma(): http://avisynth.nl/index.php/Merge

There is still some noise in the form of tape grain and the floating "sludge" seen in darker areas like the piano. Also, sloppy consumer-camera style interlacing creates excessive combing artifacts during motion. Even with the best of methods, this type of out-of-phase interlace field structure is a tough customer when it comes to cleanup, since it was designed for the CRT era. Because we don't have a great amount of action in a video of this type, we still have the choice of discarding alternate frames and encoding the progressive results with interlace flags.

After deinterlacing and filtering this sample, I used a similar script as before to resize to 640x480 and encode an mp4 for 59.95fps progressive PC play or web mounting. It's attached as Classical_5994p_PC_Playback.mp4.

A DVD version with "real" interlace is attached as Classical_2997i_DVD.mpg.

I used the same re-interlace logic as with the earlier sample in order to create the 29.97i video from the 59.94p file:
Code:
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()
But the 29.97i version has some noisy combing artifacts on movement (look at the hands). A "fake interlace" DVD version of 29.97p video encoded with interlaced flags is attached as Classical_2997p_as_interlaced_DVD.mpg. To make the 29.97 fps progressive version I used a similar SelectEven() Avisynth script to discard alternate frames.

One could take more measures to do more cleanup and run more scripts and more complicated routines, but as you say there's a point of diminishing returns. What I've suggested so far should at least give visibly improved results that shouldn't be too difficult to work with.

In the next post I'll discuss the third and fourth samples, which have different problems. Some of the same filters can be used, but with a few differences.

To be continued. . .


Attached Files
File Type: mp4 Baroque_5994p_PC_Playback.mp4 (2.59 MB, 7 downloads)
File Type: mpg Baroque_2997i_DVD.mpg (2.40 MB, 0 downloads)
File Type: mpg Baroque_2997p_as_interlaced_DVD.mpg (2.25 MB, 0 downloads)
File Type: mp4 Classical_5994p_PC_Playback.mp4 (2.04 MB, 3 downloads)
File Type: mpg Classical_2997i_DVD.mpg (2.20 MB, 3 downloads)
File Type: mpg Classical_2997p_as_interlaced_DVD.mpg (2.09 MB, 0 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: captainvic (06-12-2019), ehbowen (06-12-2019)
  #9  
06-12-2019, 12:05 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Continuing with the next two samples, I apologize for the delay in posting. I also congratulate you on good control of some difficult signal levels in these clips, especially in the next two samples. These two samples have difficult levels to work with, especially with the dark backgrounds.

Many new users tend to let dark or bright detail get destroyed by neglecting to control signal levels. In these samples the darkest and brightest details remain intact. Many new users also make the mistake of trying to make VHS and digital video look as if it had the wide contrast range of film. Sad to say, digital video is limited to y=16-235 in YUV colorspaces and to 0-255 in RGB. Film has far greater capabilities. Within those digital limits, VHS itself holds together fairly well at the bright end but tends to fall apart in the shadows.

You have two samples that illustrate how tricky it is to work with VHS while keeping shadows and dark details from looking like empty black blobs. One of the toughest problems of working with VHS is that the dark parts are really noisy. This is just a fact of life with VHS.

The image below is a frame from the Nutcracker sample, which is a darkish video with a problematic dark background. The HanselAndGretel sample is brighter but has a similar problem with dark background noise, typical for VHS. After a little denoising, the dark areas in the image below look as if they're solid and clean. But the right-hand panel is a 200% enlargement of the area indicated by the green arrow.


If you brighten only the dark background, the high noise level becomes visible. When this video is encoded the noise is accentuated. When later displayed more brightly on TV, those horizontal bands of noise become even more obvious and distracting and tend to dominate the image.

You can do a lot more work on both these samples, but I tried keeping the scripts shorter and used only commonly found plugins rather than esoteric stuff like NeatVideo or KNLmeansCL to handle some noise problems. The script below for the HanselAndGretel sample is fairly typical for VHS work, where you managed to keep the dark levels in good control. So only a slight levels tweaking is needed to get improved results -- another typical trick in working with VHS.

Code:
Import(ppath+""D:\Avisynth 2.5\plugins\TemporalDeGrain.avs")

AviSource("J:\forum\faq\ehbowen\G\HanselAndGretel.20190510.clip.avi")
ColorYUV(cont_Y=10)
Tweak(cont=1.05,sat=1.3,dither=true,coring=false)
Levels(18,1.0,255,16,255,dither=true,coring=false)
AssumeTFF()
ConvertToYV12(interlaced=true)
QTGMC(sharpness=0.6,border=true)
TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
TemporalSoften(4,4,8,15,2)
MergeChroma(aWarpSharp2(depth=20))
AddGrainC(1.5,1.5)
Crop(4,0,0,-10).AddBorders(2,4,2,6)
You've seen some of the above statements before, but here are some new points;

ColorYUV(cont_Y=10)
Tweak(cont=1.05,sat=1.3,dither=true,coring=false)
Levels(18,1.0,255,16,255,dither=true,coring=false)

Viewing the capture and looking at histograms, it seems black levels are just slightly too high (but that's better than having shadows unrecoverable and destroyed by clipping !!). Levels vary scene by scene in VHS so it's common to have to tweak some scenes now and then. In this case I wanted to tweak only the darkest of the dark areas from about y=40 (very dark grays) on down to y=16 (black). This makes residual noise more difficult to notice and brings it down to a more realistic level. Increasing "y" contrast with ColorYUV by just a small amount stretches the dark end downward a little. The Contrast setting with the Tweak() filter has the opposite effect of pumping brights by a very small amount (1.05, which isn't much), and saturation ("sat=1.3") also needs a moderate boost for better skin tones. The sample could use more color correction in VirtualDub but I don't think most viewers would notice.

The Levels() settings need explanation. What I want Levels() to do is make things a little darker from the low dark noise around y=30 and y=20 and bring them down to y=16. The sequence of numbers in the Levels() function explains what the code is doing: the first number (20) is the target level for incoming darks that we want to work with. The second number (1.0) is the gamma level (midtones) we want to set -- in this case 1.0 is neutral, so it doesn't change gamma. The third number (255) is the target of the incoming brights that we want to work with. The fourth number (16) is the desired output of darks that we want. Our target input for the darks was y=20, which we want brought down to y=16. The last number (255) is the same target output as the 255 target input, so this won't make any change in the bright levels.

The "dither" and "coring" parameters deal with disabling the default behavior of Tweak() and (Levels); we want the chroma smoothing of dither operations but we don't want the dark and bright sharp cutoff of coring. So we turn dithering on and we turn coring off.
ColorYUV(): http://avisynth.nl/index.php/ColorYUV
Tweak(), Levels(), dither, coring: http://avisynth.nl/index.php/Tweak, http://avisynth.nl/index.php/Levels

QTGMC(sharpness=0.6,border=true)
Again, QTGMC is used here for both deinterlacing and denoising/repair. But where is the denoising specified? Actually the default QTGMC preset is "slow", which doesn't have to be stated and which does include QTGMC's denoising and repair defaults. This statement could have been written as "QTGMC(preset="slow",sharpness=0.6,border=true)" and it would mean the same thing. Sharpness is reduced from 1.0 to 0.6 because the original sample already has some mild oversharpening effects.

TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
TemporalDegrain is a powerful denoiser, but at default values it can be very destructive. In this case some parameters are lowered (the SAD's are search parameters and Sigma is a filter strength value). The target noise is the clumpy, mushy grain in the darkest shadows that looks like darkish-gray "horizontal rain" during play.

TemporalDegrain is very popular. It requires several support files that are already available in the QTGMC package. It also requires the HqDn3d plugin. I suspect that a .zip package for TemporalDegrain has been posted at digitalfaq in the past but I couldn't find it. So I've attached TemporalDegrain.zip to this post. Create a subfolder somewhere for the .zip package, which contains TemporalDegrain.avs, HqDn3d, and documentation. Everything else eeded is in the QTGMC package. The internet Wiki home pages for TemportalDegrain and HqDn3d are at http://avisynth.nl/index.php/Temporal_Degrainand http://avisynth.nl/index.php/Hqdn3d respectively.

AddGrainC(1.5,1.5) is used to restore some of the very fine film-like grain to prevent an over-filtered plastic look and to mask some of the harsh edges of noise in the shadows. AddGrainC is part of the QTGMC package.

Crop(4,0,0,-10).AddBorders(2,4,2,6)
As used here, Crop() chops off 10 bottom pixels, a little more across the bottom than the usual 6 or 8 because of the thicker head-switching noise, and there's also some left-hand border noise. AddBorders() restores the original frame dimensions and centers the frame vertically by adding 4 pixels at the top and 6 at the bottom. In this case the cropping rules require pixels in groups of 2 minimum, while some formats require vertical groups of 4. In YUV you can't use odd-numbered pixels because of the way chroma information is stored.

As with the previous two samples, the same Avisynth Spline36Resize routines were used to make 640x480 square-pixel mp4's for 59.94fps playback and mounting. The same re-interlace routine was used to make a standard DVD at 29.97fps interlaced sample, which I have attached as HanselAndGretel_2997i_DVD.mpg.

The HanselAndGretel interlacing is cleaner than the other samples, so I didn't see the need to use routines for discarding alternate frames and making a "fake interlace" version. You can if you wish.

The last sample has similar noise and background problems but it isn't interlaced.
your Nutcracker.20190610.clip.avi is telecined with 3:2 pulldown. If you examine the video frame-by-frame in VirtualDub you'll see during motion that in every group of 5 frames, 3 frames are progressive and 2 frames look interlaced. If you use normal deinterlace you'll get duplicate and triplicate frames. If you want to make the video entirely progressive and restore the original 23.976fps film speed, you have to use inverse telecine. The script below shows how it was done:

Code:
      
Import(ppath+""D:\Avisynth 2.5\plugins\TemporalDeGrain.avs")
Import("D:\Avisynth 2.5\plugins\RemoveDirtMC.avs")

AviSource("J:\forum\faq\ehbowen\H\Nutcracker.20190610.clip.avi")
Levels(20,1.0,255,16,255,dither=true,coring=false)
AssumeTFF()
TFM().TDecimate()
ConvertToYV12(interlaced=true)
TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
TemporalSoften(4,4,8,15,2)
FixChromaBleeding()
RemoveDirtMC(40,false)
MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(depth=10))
Crop(0,0,0,-6).AddBorders(0,2,0,4)
The two Import() statements bring in two .avs plugins. You've seen TemporalDegrain before but RemoveDirtMC is a new one, explained below.

Levels(20,1.0,255,16,255,dither=true,coring=false)
In this case, Levels() is used in the same way that it was used in the previous sample, targeting the input dark region around y=20 and lowering values in that region from 20 to y=16. The Nutcracker video might look a little dim on your PC, but my calibrated monitor says the levels look normal for many videos that look just like it. It will look brighter on TV. But if you really want to make it brighter on a PC for some reason, do it by adjusting gamma with Levels(). The gamma value here is 1.0, so increase it to 1.05, 1.1, or 1.2. Don't use contrast for this because the video already contains bright values that are at y=235 and later scenes will likely be brighter overall.

TFM().TDecimate()
These are the two functions used to remove telecine effects and to create a fully progressive video. TFM() checks interlaced telecine fields and converts those to progressive frames. TDecimate() discards periodic duplicate frames. Keep in mind that most pulldown schemes include duplicated fields which, if deinterlaced, become duplicate and even triplicate frames. Inverse telecine works by field-checking, not by simply deinterlacing all the frames.

The Avisynth plugin that contains TFM(), TDecimate() and some other specialized utilities is TIVTC at http://avisynth.nl/index.php/TIVTC. There's really no substitute for TIVTC. it's a very smart and very fast filter that works in both YUY2 and Yv12. TIVTC in this case produces a progressive video at 23.976 fps. You might now ask, if you want DVD how do you get the speed back to 29.97fps ??? Easy. You tell your DVD encoder to restore 3:2 pulldown when it encodes MPEG2. You can also apply the same 3:2 pulldown for standard definition BluRay encoding, which requires interlace or telecine for SD output. Meanwhile, 23.976 progressive video can be posted on the 'net and played on TV.

TIVTC and many other plugins are supplied as a file zip'd with 7Zip compression (.7z files). 7Zip is free, with an interface similar to Pkzip and .zip files. You can download the 7zip installer from https://www.7-zip.org/. The 32-bit version is likely all you'll need.

FixChromaBleeding()
This filter reduces color bleed around edges. There are stronger ways of doing it but they tend to have bad color side effects. FixChromaBleeding is an .avsi plugin. It loads automatically when a script needs it. Its posted as FixChromaBleeding.zip. The plugin requires the ChromaShift.dll plugin, which is available as ChromaShift27.zip.

RemoveDirtMC(40,false)
This .avs plugin comes in many versions, which is why it's furnished as an .avs script that geeks keep modifying whenever they feel like confusing us. It's partially a degrainer but it also smooths hazy, muddy fuzz and some mosquito noise and can even remove small white spots and dropouts. You'll find it all over the place in many forums. The value of "40' is about middle of the road but as values approach 80 moving objects start disappearing, so be careful. The "false" parameter means that the video isn't monochrome.

RemoveDirtMC is posted as RemoveDirtMC.avs. It's a small plugin with a lot of required support files. Most of those support files come with the QTGMC package, which you also need. If you get error messages trying to run RemoveDirtMC in Windows7 or later it's Microsoft's fault. There's a simple fix posted at http://www.digitalfaq.com/forum/vide...s-running.html. The plugin also requires the original Removedirt package, posted as RemoveDirt_v09.zip.

The 23.976fps video can be directly resized to 640x480 or any other frame size for PC playback, TV, and web mounting. A square-pixel 23.976fps mp4 is attached as Nutcracker_PC_playback.mp4.

The DVD version with 3:2 pulldown restored by the MPEG encoder is attached as Nutcracker_pulldown_for_DVD.mpg.

########################

The same filters can probably be used for the entirety of each video, but you might have to change individual settings for some segments. This is not unusual for analog sources, which are not as consistent as digital source. While digital itself is cleaner it's not without noise -- the myth that digital is noiseless is pure fiction. All you need is to check a few YouTube videos and bad BluRay releases to dispel that myth.

How to quickly change an .avs script and check the results in VirtualDub:

When opening an Avisynth script in VirtualDub you can use the lower-left scroll controls to scroll through the video -- it will be slow scrolling if you're running slow filters, so be patient. Stop when you find a place you want to observe, and bring up the script's text in a Notepad window. You can change values by typing over the old ones, or you can disable an entire statement by preceding the statement with the "#" comment character.

After you make your script change, save the text in Notepad and then in VirtualDub click "File..." -> "reopen video file", or press the F2 button. Give the script a few seconds to restart and it will open at the same frame position you're looking at.

Good luck with all this. if you get any errors using Avisynth, let us know the complete error message.


Attached Images
File Type: jpg hidden noise.jpg (44.5 KB, 222 downloads)
Attached Files
File Type: zip TemporalDegrain.zip (50.2 KB, 2 downloads)
File Type: mpg HanselAndGretel_2997i_DVD.mpg (4.53 MB, 5 downloads)
File Type: mp4 Nutcracker_PC_playback.mp4 (3.96 MB, 5 downloads)
File Type: mpg Nutcracker_pulldown_for_DVD.mpg (3.56 MB, 3 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: captainvic (06-12-2019), Delta (04-12-2021), ehbowen (06-12-2019), ThumperStrauss (02-23-2022)
  #10  
06-12-2019, 01:04 PM
ehbowen ehbowen is offline
Free Member
 
Join Date: Feb 2018
Location: Houston, Texas
Posts: 339
Thanked 64 Times in 57 Posts
Got to run to my day job, but I'll take a closer look at all of this tomorrow. Thanks for the help. As far as the compression, I was using two separate capture workflows. I thought I had both of them set for HuffyUV, but obviously I didn't. Something to double-check next time.
Reply With Quote
  #11  
06-12-2019, 02:05 PM
captainvic captainvic is offline
Premium Member
 
Join Date: Sep 2018
Posts: 47
Thanked 6 Times in 5 Posts
Wow, thanks sanlyn for your detailed explanations. This is GREAT info!
Reply With Quote
The following users thank captainvic for this useful post: sanlyn (06-12-2019)
  #12  
06-20-2019, 03:59 AM
ehbowen ehbowen is offline
Free Member
 
Join Date: Feb 2018
Location: Houston, Texas
Posts: 339
Thanked 64 Times in 57 Posts
First, let me thank Sanlyn again for such an informative and comprehensive reply. I have managed to get the full "Baroque Dance" capture processed; I'm attaching a clip of the final output. Final script used was:

Code:
Import("C:\Program Files (x86)\AviSynth+\plugins+\Santiag_v16.avs")
Import("C:\Program Files (x86)\AviSynth+\plugins+\Mdg2.avs")

SetFilterMTMode ("QTGMC", 2)
AviSource("K:\Hanks\BaroqueDance.20190610.avi")
AssumeTFF()
ConvertToYV12(interlaced=true)
QTGMC(preset="slow",EZDenoise=8,denoiser="dfttest",GrainRestore=0.3,border=true)
Santiag(2,2)
Mdg2()
TemporalSoften(4,4,8,15,2)
Crop(4,0,0,-8).AddBorders(2,4,2,4)
Spline36Resize(Width,540)
Prefetch(14)
I also have to acknowledge Andrew Swan's wonderful YouTube and blog tutorial on setting up AviSynth and using QTGMC; along with Sanlyn's advice it got me over the hump.

However, the next script I have been working on is for the Nutcracker. Here's what I have so far:

Code:
Import("C:\Program Files (x86)\AviSynth+\plugins+\TemporalDeGrain.avs")
Import("C:\Program Files (x86)\AviSynth+\plugins+\RemoveDirtMC.avs")

AviSource("K:\Hanks\Nutcracker.20190610.avi")
Levels(20,1.0,255,16,255,dither=true,coring=false)
AssumeTFF()
TFM().TDecimate()
ConvertToYV12(interlaced=true)
TemporalDegrain(SAD1=100, SAD2=75, sigma=4)
TemporalSoften(4,4,8,15,2)
FixChromaBleeding()
RemoveDirtMC(40,false)
MergeChroma(aWarpSharp2(depth=20).aWarpSharp2(depth=10))
Crop(0,0,0,-6).AddBorders(0,2,0,4)
Spline36Resize(Width,540)
Prefetch(14)
Unfortunately, although this displays perfectly in AVSPMod's preview window, whenever I try to load it into VirtualDub 1.9 in order to save it VDub crashes and burns (insufficient memory). VDub2 will load it as 64 bit, but many of the plugins and scripts Sanlyn specified are 32 bit only and don't mix and match. So, what I've done so far is to use VDub2 to break it up into a segmented .avi file...2 GB per segment, 20 segments. I specified "direct stream copy" while saving the segments. Now, though, when I try to open the segments in 32 bit VDub or in AVSPMod, I get the error message, "AVISource: couldn't locate a decompressor for fourcc HFYU" (see screenshot):


First, how do I solve the immediate problem of opening and saving the segments? Secondly, since this situation is likely to recur again, is there a way of making a batch file to process and save all 20 (or howevermany) segments in one swell foop?


Attached Images
File Type: jpg Screenshot.20190620.jpg (32.4 KB, 213 downloads)
Attached Files
File Type: avi BaroqueDance.20190610.proc.avi (55.65 MB, 2 downloads)
Reply With Quote
  #13  
06-21-2019, 07:18 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,307 Times in 982 Posts
Because avsPmod was little more than a continuous pain in my experience 10 years ago, I can't offer advice. The codec message in your jpg looks like something you'd get with a 64-bit app trying to use a 32-bit codec, or vice versa, which won't work.

As for segments, you can use AVisynth's Trim() function or VirtualDub edit functions to break files into multiple segments, which everyone does all the time, and save the segments as lossless intermediates. I save the segments separately because a segment is cut in a spot that requires different processing, not just because I want to cut stuff into parts and process the parts simultaneously with the same logic and settings. Batch processing can be done with VirtualDub's script language. If you Google "how to run batch processing with VirtualDub" you'll get a whole page of links. I've never used those methods because the videos I work with require more specific treatment. Most of the projects that I repair look like the kind of problem you get with all-at-once and one-size-fits-all processing. Once I've cleaned the saved segments, I join them and run additional processing or encoding in one step. The thing about segments is that eventually you have to join them again. I'm working now and then on a long project, a retail movie VHS that's badly mastered with lots of on-and-off dark to light shots; every time I brighten a dark one the noisy dark garbage shows up and I'm stuck with tough cleanup work, or the color balance suddenly goes haywire. Too bad I can't use the same filters for the whole thing, but that wouldn't look so good.

Plugins like QTGMC, TemporalDegrain, MCTemporalDenoise and other slow critters often compete for memory when running in the same script. I've run plenty of two part scripts with one slow filter in the first script, saved that result, then run the results with the other filter in the second script. That's something I never had to do with pristine or digital sources (except consumer DV, which is horrible). More cleanup requires more time.

Your .avi processing looked fine to me. Good work. I don't think the Nutcracker video would have all of its scenes with a noisy dark background that requires such hard work with TemporalDegrain, so you shouldn't have to use tough filters all the time. But I could be wrong, as I've seen Nutcracker done quite a few ways.
Reply With Quote
Reply




Tags
capture, histogram, proc amp, settings

Similar Threads
Thread Thread Starter Forum Replies Last Post
JVC S-VHS VCR realignment instructions [GUIDE] lordsmurf Video Hardware Repair 9 08-27-2023 01:06 AM
How to get histograms to show in VirtualDub? stevevid Restore, Filter, Improve Quality 4 12-31-2018 11:25 AM
Interpreting histograms? (color correct VHS) SimpsonsRule Restore, Filter, Improve Quality 8 05-07-2015 07:59 PM
VLC upscale blocky, but MPC-HC not? (but less detailed?) premiumcapture General Discussion 4 02-22-2015 08:11 PM
Vidicraft Detailer II instructions? Mode, VNX? Argalby Restore, Filter, Improve Quality 3 04-12-2012 06:05 PM

Thread Tools



 
All times are GMT -5. The time now is 12:54 PM