Go Back    Forum > Digital Video > Video Project Help > Restore, Filter, Improve Quality

Reply
 
LinkBack Thread Tools
  #1  
05-02-2020, 12:26 AM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
Hi all, I'm on a PC with Avisynth but without any filters, other than CCD.vdf and QTGMC (if that counts as one) installed. I'm browsing through threads trying to figure out what's what again, and upon inputting random scripts to test them out from posts, I see none of them are working...because I don't have said filters, of course. That's why I've come to ask if there is a pack or zip file somewhere, a list, for VHS restoration filters. Even an installer file which would import them all in a click. I'm assuming somebody here would've made one by now, or on another forum, since this stuff has been used by communities for decades, but alas I didn't see anything pinned when I thought I would It would probably be a big help to post/pin a collection for users all around the world that have no idea what to download Finding them one by one is like a weekly Easter egg hunt for eggs you didn't know you needed.

There was a mention of one happening here but the last post was from 2 years ago: http://www.digitalfaq.com/forum/vide...html#post62211

As you can see, that thread above itself sort of answers my question but in terms of VirtualDub, which I don't use. And alas, if I were told to start using it, that thread hasn't been updated in years from what I can tell so I don't know if there's a better updated version somewhere. As I mentioned the only real filter I have installed (I think) in Avisynth is CCD.vdf, which I'm aware is a VirtualDub filter - when I used it I called it via LoadVirtualDubPlugin in Avisynth. Again, I've never used vdub itself (though I think that's what I used to capture when I was capturing...apologies, it's been a while), I've barely used Avisynth and intend to stick with it for restoring and filtering...*unless* it is recommended to me to use vdub instead, because of the filter pack/zip/list you will provide. Or simply because it's better to use than avisynth..if it is? I'm not too sure anymore, and if filters and scripts from vdub could work in avisynth and vise versa. If that's the case then it shouldn't matter, but if it's not the case, then I need to know which route is best, or preferred for most. It's been a couple years, like I said.

Which leads me to the fabled tale of these megascripts or multiscripts certain users were working on reading through threads years ago, for common family VHS capture tapes. Do these exist somewhere, on here (I don't see anything pinned here ) or on another website/forum? Do one of you guys have a script you use for common family VHS tapes or Hi8 tapes you could share (if they're usually the same), where you turn certain things on or off, tinker with things? Again, I wouldn't be asking if I didn't think it was possible but I always see scripts posted left and right for things and problems, and as a newbie to this stuff I'm assuming there are mega or multiscripts for common family VHS captures that you mess around in to do what you will, for people that aren't experts in this field. I just don't see anything pinned, but I'm assuming the experts of this forum or other forums around the world have created and shared these scripts for restoration for people like me lost in the virtual woods.

Any help and links would be appreciated, thank you.
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
05-02-2020, 03:41 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
The VirtualDub filter pack you mention hasn't been updated, mainly because the filters themselves haven't been updated for a couple, of years. As for CCD, it's a VirtualDub filter and is not "installed in Avisynth". The Avisynth plugins folder doesn't recognize .vdf filters.

Forum threads that go into detail on Avisynth and Virtualdub filters list links to the filters used. They have been listing those details for years. Most of those threads are posted by sanlyn. Try including t he phrase "AviSource" when you search for his named posts. The main source for all Avisynth plugins is http://avisynth.nl/index.php/External_filters, with older plugins listed at http://avisynth.nl/index.php/External_plugins_old. Avisynth internal filterrs, of which there are a couple hundred. are documented at http://avisynth.nl/index.php/Internal_filters.

You'll find more VirtualDub plugins at http://www.infognition.com/VirtualDubFilters/, some of which are no longer archived, meaning that you'll have to go to Google to find a few. For example the VirtualDub ColorTools 1.5 update, (v1.4 won't work in Win7 or later) is at https://sourceforge.net/projects/vdf...1.5%20update1/. I advise that you stick with 32-bt versions of all these filters -- there ain't many 64-bit versions around, and there won't be. A problem with these filter packs is that many are obsolete, many just don't accomplish very much, many are not very good (MSU filers, for example), and many come with no documentation. Most popular Avisynth plugins come with documentation packages and/or have extensive Wiki pages and sometimes hundreds of lines of documentation in the opening lines of their avs or avsi scripts; for instance, the wiki pages for MCTemporal Denoise or dfttest.

If you want to know what VDub documentation looks like for the better VDub designers, try going to Trevlac's ColorTools website on this page http://trevlac.us/colorCorrection/histo.html, or this page http://trevlac.us/colorCorrection/colorTools.html. There is also excellent documentation on the gradation curves at http://members.chello.at/nagiller/vd.../tutorial.html, and http://members.chello.at/nagiller/vdub/readme.html. An illustrated webpage of usage examplesmfor ColorMill is at http://fdump.narod.ru/rgb.htm , and a contribution about ColorMill innards in this forum at http://www.digitalfaq.com/forum/vide...ll-filter.html.

There are more Avisynth and VirtualDub filters still listed on an old site at http://rationalqm.us/mine.html.


Installing these guys is one thing. Using them is something else. Don't say we didn't warn you.
Reply With Quote
  #3  
05-02-2020, 02:21 PM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
Quote:
As for CCD, it's a VirtualDub filter and is not "installed in Avisynth". The Avisynth plugins folder doesn't recognize .vdf filters.
Yeah I know, that's what I said in my second paragraph: "...which I'm aware is a VirtualDub filter - when I used it I called it via LoadVirtualDubPlugin in Avisynth."

Quote:
Most of those threads are posted by sanlyn. Try including t he phrase "AviSource" when you search for his named posts.
*looks at your username* Did you...did you just refer to yourself in 3rd person like you're The Rock..? Or did you forget to log in to your alt account before commenting?

Quote:
The main source for all Avisynth plugins is http://avisynth.nl/index.php/External_filters
Aye, and there is this big list where you have to manually click 219 download buttons individually. Surely one of you guys can make a zip or rar file of your filter and plugins folder and upload them to Drive, Mega, Dropbox, anything for us since you already went out and have the filter collection we need, to save everyone and their ancestors time? Honestly I still don't know why this isn't the case and norm and pinned at the top of this forum when it's something that would take one of you guys with everything about 5 minutes. It would make everyone's life a little easier.

Quote:
You'll find more VirtualDub plugins at http://www.infognition.com/VirtualDubFilters/, some of which are no longer archived, meaning that you'll have to go to Google to find a few. For example the VirtualDub ColorTools 1.5 update, (v1.4 won't work in Win7 or later) is at https://sourceforge.net/projects/vdf...1.5%20update1/. I advise that you stick with 32-bt versions of all these filters -- there ain't many 64-bit versions around, and there won't be. A problem with these filter packs is that many are obsolete, many just don't accomplish very much, many are not very good (MSU filers, for example), and many come with no documentation. Most popular Avisynth plugins come with documentation packages and/or have extensive Wiki pages and sometimes hundreds of lines of documentation in the opening lines of their avs or avsi scripts; for instance, the wiki pages for MCTemporal Denoise or dfttest.

If you want to know what VDub documentation looks like for the better VDub designers, try going to Trevlac's ColorTools website on this page http://trevlac.us/colorCorrection/histo.html, or this page http://trevlac.us/colorCorrection/colorTools.html. There is also excellent documentation on the gradation curves at http://members.chello.at/nagiller/vd.../tutorial.html, and http://members.chello.at/nagiller/vdub/readme.html. An illustrated webpage of usage examplesmfor ColorMill is at http://fdump.narod.ru/rgb.htm , and a contribution about ColorMill innards in this forum at http://www.digitalfaq.com/forum/vide...ll-filter.html.
So judging by all this, I take it you're more savvy on the vdub side and prefer to use that?

Quote:
Installing these guys is one thing. Using them is something else. Don't say we didn't warn you.
Mate I know, I'm already beyond warned and in over my head lol, that's why I'm asking you guys for a script starter kit for common family VHS and Hi8 restoration, where you would turn on filters you would need by erasing the # at the start of certain lines or whatever you do to mess around with everything you could need to do. Alas, you haven't commented on that yet.

I still can't wrap my head around how there isn't this filter collection pack for AviSynth yet (so the average new Joe doesn't have to navigate through an avisynth wiki page and download 289 individual things) as well as a starter VHS restoration script pinned up top like what I'm describing for beginners, to make life easier x100 for people that don't have 5-10 years in this field... *especially* for something so incredibly technical, specific, trivial, and old school niche as this - we need to make this happen ladies and gents. We need a Michael Jordan to step up and take charge and help the community and its future for the better, something like this would not take much time for someone that actually knows what they're doing based on the quick and technical responses I see on this forum, I would say a half hour. I don't know if that's you sanlyn, but it could be
Reply With Quote
  #4  
05-02-2020, 03:25 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
I referred to my own posts because, as far as I'm aware, I'm one of the few members here who posts a script for a specific restoration project and goes through the trouble of posting script and filter details as well as links to them, along with notes on why and how the filter was used.

If you think you're going to get a list of Avisynth plugins and just copy the plugins into your folder, you don't understand Avisynth or its filters. To get you started on a list try MCTemporalDenoise (http://avisynth.nl/index.php/MCTemporalDenoise), one of the most popular denoisers. Try that link to its wiki page. Forget about downloading the thing; first, take a look at the requirements list and then scroll down to look at its many parameters. Just that requirements list alone is a catalog of highly useful filters in their own right. Unless you read up on this plugin and its many parameters and uses, you're spinning your wheels just throwing it at videos. Anyone with a keyboard and a mouse can do that.

Some of my favorites is a handful of components in the Dither Tools package, notably these:
Dither_crop16
Dither_addborders16
Dither_convert_rgb_to_yuv
Dither_convert_yuv_to_rgb
Dither_resize16
GradFun3
SmoothGrad
16-bit dithered version of dfttest
All of those in one filter, plus more. Read about it here: http://avisynth.nl/index.php/Dither_tools. Download the dither package, it has two .avsi files and two dll's. Plug them into your Avisynth folder plus the other required support files and Windows syslib component as directed in the instructions, and have at it. Also comes with a very highly detailed html that tells you what's going on. Mainly the package was developed to help with banding. Don't know what banding is or what to do? Go here: https://avisynth.org.ru/docs/english...olormatrix.htm in a thread entitled "Color banding and noise removal".

Or try a more simple anti-alias filter like Santiag (http://avisynth.nl/index.php/Santiag). It also has parameters and a list of required support files, some of which are required elsewhere. What does the filter do? It helps to smooth aliasing and sawtooth lines and edges.

If you'd like a big list of plugins and all kinds of notes and specs and examples of what they're for, go to the famous Scintilla site: Scintilla's Guide to AVISynth Postprocessing Filters. It's been around for years. He has them all figured out and illustrated, with pictures. The plugins are popular and can be used for anime and "real" video, although his samples could be dirtier, less animation and more street video, and could use more work. The site's been there for so long that Scintilla himself has passed on and some of the links have died, but you can always go to this forum or others and ask for a new link. Many of those filters have copies that were posted on this site over the past few years (mostly by yours truly). If you can't find one of them, plenty of members will help.

When you see Avisynth's list of external filters as linked earlier, read the descriptions of the what the filters do. You don't have a file that was NTSC and used blended frames to make it PAL? Then you don't need that filter. You want a filter to convert the color matrix from standard-def Rec601 to HD Rec709? You might want to pick up that one.

It's not just a pile of laundry cleaners that you dump on a video. It's knowing what the items are for and what you don't need. You find out about that by reading and looking. This forum exists to post examples and suggestions for tons of problems. Your problem now is that you want all your video problems already solved in one neat place. I'd love to find that myself.

Why not post a sample video you're having a hard time with and see what members recommend. That's what most people do, and most people read posts by others who do the same thing.

Last edited by sanlyn; 05-02-2020 at 03:46 PM.
Reply With Quote
  #5  
05-03-2020, 10:28 PM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
Thanks for your detailed response, I always appreciate it.

The Avisynth site currently doesn't work so I can't do anything, "Sorry! This site is experiencing technical difficulties."

Quote:
It's not just a pile of laundry cleaners that you dump on a video. It's knowing what the items are for and what you don't need. You find out about that by reading and looking. This forum exists to post examples and suggestions for tons of problems. Your problem now is that you want all your video problems already solved in one neat place. I'd love to find that myself.
It's not really finding it, what I'm describing is possible. Let me put it like this, let's say that there are 20 filters commonly used by you guys, to restore your old VHS tapes. A generic number. From what I know putting a character at the start of a line (like #) in Avisynth nulls that line, and people have used that to write descriptions in the past for small scripts. So something like this could exist.

Example in layman's terms, fake of course because I don't know what I'm doing:

Code:
# VHS Restore Script, erase the # to enable the filters and plugins you need

AVISource("input here ex: E:\blah-1.avi")

# AssumeTFF is for xyz, explained, for this feature turn this on (erase the below #)
#AssumeTFF()

#White Balance fix, tinker with these, primarily xyz:
#darks=ColorYUV(off_u=3, off_v=-1)
#brights=ColorYUV(off_u=20, off_v=-3)
#Overlay(darks, brights, mask=ColorYUV(cont_y=100, gamma_y=100, off_y=0))
#ColorYUV(gain_y=-23, gamma_y=50, off_y=-15, cont_u=50, cont_v=50)

#halo edges appear, insert and tinker with this, etc.
#insert halo filter here

#excessive fuzziness and grains, use one of these, recommended settings are:12345
#x
#y
#z

#MCTemporalDenoise, load this for xyz, these settings recommended for xyz
#MCTemporalDenoise load filter command line

#for yellow/blue camcorder noise, load this plugin below, alter the U V 100 levels, 2 instances are on the U channel as that usually needs it more, judge with what you need, etc.
#LoadVirtualDubPlugin("C:\Users\CZ\Desktop\Video Capture\VirtualDub-1.10.4\plugins32\ccd.vdf","ccd") 
#Y = last
#ConvertToRGB32()
#U = ccd(100,0).ccd(100,0).ConvertToYV12().UtoY()
#V = ccd(100,0).ConvertToYV12().VtoY()
#YtoUV(U, V, Y)

#convert the color matrix from standard-def Rec601 to HD Rec709 if you need to information
#insert filter here

#QTGMC double frames interlacing, tinker with this, figure out your best preset setting based on xyz, use sharpen feauture if necessary
#QTGMC(preset="super fast",Sharpen(0.08, MMX=True))

#Tweak basic color settings, xyz etc.
#Tweak(hue=0.0, sat=0, bright=0, cont=1.0, coring=True, sse=False, startHue=0, endHue=360, maxSat=150, minSat=0, interp=16)

Spline36Resize(640,480)
I know a lot of what I wrote is nonsense, it's just a concept of what can obviously be done well by someone that knows what they're talking about, making it easier for everybody. All that people would need are all these filters and plugins installed via a collection rar or zip file, and then a mega script like this where they can attempt to fix any problem they may have based on the descriptions that are there. Again, of course it won't fix every problem and you'll sometimes need input from others, but something like this would be EXTREMELY beneficial for the community.

Quote:
Why not post a sample video you're having a hard time with and see what members recommend. That's what most people do, and most people read posts by others who do the same thing.
Well I have so many tapes here that I think it'd be annoying for others if I made a post asking what I should do for every separate thing each week, if every tape and recording and piece of footage is unique and so on like I'm told, I don't think people will appreciate 100 posts from me

Like this 1 tape I'm currently looking at, there's about 4-5 different environments on here. Here are some clips.

1 is of an indoor setting in a house.
2 is of an outside setting during the day.
3 and 4 are inside another house, in the same timeframe or recording session.
5 is in another indoor setting.

All that I know that I should 100% apply to all of them are QTGMC and and splineresize to 640x480(which I think is the correct one) because these are for online/device viewing. I notice that all of the clips have sort of grainy blue/yellow artifacts, similar to what I needed to fix on these camcorder files via CCD.vdf. Not too sure if that'd be the tool to use here. I don't think these are the right colors at all for the indoor ones, in terms of white balance, brightness, saturation, etc. I know how to call histograms, to some extent, but don't know which tools to use for these specific settings. Is it recommened to color/levels fix the outdoor ones too? They look bland as well. I don't know if I need to sharpen, or fix some halos, which colors to fix, what to smooth out, etc. I don't know what to fix and if it needs to be fixed, but it doesn't look good or right to me. I might need some filters or fixes I didn't know I needed. So that's 5 clips from 1 tape of different environments, and me being confused on what to do in all of them individually, you can take a crack at it if you'd like.

I have this situation x50 probably because of all the other tapes. Where I'd be uploading 3-5 clips of different environments each time from each tape and asking what you would implement and input in my shoes.


Attached Files
File Type: avi 1.avi (79.25 MB, 20 downloads)
File Type: avi 2.avi (78.83 MB, 9 downloads)
File Type: avi 3.avi (80.78 MB, 6 downloads)
File Type: avi 4.avi (91.19 MB, 5 downloads)
File Type: avi 5.avi (91.63 MB, 4 downloads)
Reply With Quote
The following users thank CZbwoi for this useful post: ThumperStrauss (01-24-2022)
  #6  
05-04-2020, 02:10 PM
Bogilein Bogilein is offline
Free Member
 
Join Date: May 2016
Location: Bavaria
Posts: 256
Thanked 96 Times in 70 Posts
Download Selurs "Hybrid" which is a Freeware encoder.

After the installation you have an avisynth folder with the most used up to date filters.

If you'll use the software you can try the avisynth filters with your files and you can watch the avisynth script to see which plugins are required for the filters you use.

If you don't wanna use hybrid, delete it and keep the avisynth folder with the filters.

http://www.selur.de/downloads
Reply With Quote
The following users thank Bogilein for this useful post: ThumperStrauss (01-24-2022)
  #7  
05-05-2020, 07:40 PM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
Thanks, I'll check that out and the collection. Not too sure about keeping Hybrid, I've never heard of it on any forum or discussion thread and I'm familiar with using AvsPmod and MeGUI to display and encode out .avs scripts, I'm assuming it does something like that so I'll see.

If sanlyn or anyone wants to tackle the video files I provided or my previous post feel free to, I'm at a standstill currently in over my head.
Reply With Quote
  #8  
05-05-2020, 08:52 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
I've been working on your vids and on a post for you, but Covid-19 volunteer community chores have kept me busy the past couple of days.
Reply With Quote
  #9  
05-05-2020, 09:26 PM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
That's completely understandable, no worries, your posts are worth waiting for - thank you.
Reply With Quote
  #10  
05-09-2020, 10:27 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Thank you for the 5 samples. Sorry for the delay.

In following posts I'll upload Avisynth scripts, plugin links and descriptions, and sample output videos. First, I must mention three main difficulties with processing and cleanup of typical home videos such as these.

The following applies to all of the captures. Mind you, none of this is personal. It's strictly technical, so don't take it in the wrong way. You have some problems to deal with in these videos, so the more you know the easier it will be.

First, the captures all have illegal video levels. This isn't just a technicality. Some websites will not mount illegal video levels -- it's too much trouble to clean them up. Those that do accept them will reprocess them to valid levels in ways that cut off bright and/or dark detail. If you were to submit these videos for broadcast at a local station, they would be rejected. Illegal signal levels are unattractive and are the signature of an inexperienced user. Illegal levels involve crushed darks and/or clipped brights which are lost details and colorless blobs when displayed as RGB. Finally, correcting illegal levels is often not possible, but when it is it's an extra chore that should be avoided in the first place.

The images below are Avisynth YUV histograms from each of the 5 original, unfiltered videos. Their black borders and head-switching noise were cropped from the images to prevent them from affecting the readings. The histograms show the range of YUV "y" luminance readings in each avi capture, which appears printed under each histogram.




Each histogram has three horizontal bands of information. The top white band is the "y" luminance or brightness channel. The middle band is the "U" ("blue") blue/yellow channel. The bottom band is the "v " ("red") or red/green channel. The values in each of those channels is stored in separate pixels in YUV video. Along the left and right side of the histogram are shaded areas called the "clipping" or "unsafe" zones. The area between the shaded borders is the "safe" or "legal" zone. The "safe" zone has a range of 16-to-235. The range y=16-235 is expanded or stretched horizontally during RGB display to RGB 0-255.

The left-hand safe border (dark values) indicates y=16; anything in the left-hand unsafe area is below y=16. Anything in the left-hand unsafe area will be darker than Y=16 and therefore darker than RGB=0, and will be crushed or cut off in RGB. The right-hand safe border (bright values) is at y=235. Anything in the right-hand unsafe area is brighter than y=235 and in RGB will be clipped because Y=235 is expanded in RGB to RGB=255, so values higher than y=235 will be higher than RGB=255 and will be clipped or cut off in RGB.

The display of the U and V bands is not entirely accurate or proportional, although they do show the relative values of the two channels. The accurate point common to all the channels is the dashed line down the middle; this represents y=129, or RGB=128 in display, or middle gray, which is the middle of the spectrum for the two color systems.

The second major problem is severe camera motion. This is so common with home videos that it's never surprising. While it's relatively no problem for analog video or film to render swift or hectic motion, digital video is a gross underachiever when it comes to motion handling. Digital is not a record of a continuous signal stream but is a series of distinct still images that stops 50 or 60 times per second and does not fade into the next image the way a CRT or movie projector flickers and fades between frames. If digital could flicker and fade, you wouldn't see the aliasing and sawtooth edges in most consumer camera videos, nor would you see as much as the persistent tape noise between images. Part of the problem is display technology, part of the problem is consumer camera shutter operation and sloppy interlacing, and part of the problem is users who refuse to employ tripods or shoulder braces. Chaotic zooming and frenzied camera pans are two other factors. Even when these are denoised in processing, these image wrecking actions require very high digital bitrates to encode properly.

The third major problem is that consumers routinely refuse to use light balancing filters. They were sold for as little as $1.99 in many camera stores. The underlying cause for this refusal is that camera owners relentlessly insist on believing that what they see in the viewfinder is what's being recorded. This is far from the truth because even in bright daylight a camera AGC can pump luminance up and down several times within a few seconds. VHS color is not accurate to begin with and shadow detail is anemic even with good cameras and decent light. In low or artificial light, camera histograms and chroma curves are noisy nightmares to work with, especially when the camera's auto gain is having a good time pumping exposures and the camera's circuitry keeps you guessing about how the color balance will change with next camera movement or light angle.

So these are the kinds of impediments you're dealing with. It'll take some getting used to, but with a little experience you learn to work with certain filters and certain properties to get what you want.


Attached Images
File Type: png 1 thru 3 avi illegal YUV levels.png (39.4 KB, 338 downloads)
File Type: png 4 and 5 avi illegal YUV levels.png (29.5 KB, 329 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #11  
05-09-2020, 10:48 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Analyzing and Color Correcting 1.avi:

The first step I take with a file is running ColrYuv's Analyze function and a levels histogram. At the same time, but not always, I load color correction filters in VirtualDub that read the output of the Avisynth script and allow me to tweak the Aviasynth settings.

(Below) The picture below is a composite image. The image on the left is a frame from the 1.av unfiltered original, borders removed, coupled with a Levels histogram that was run in a separate copy of the same script in a second instance of VirtualDub run at the same time. (Yes, you can run multiple instances of VirtualDub at the same time)


The readout and histogram were created with this script:

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\1.avi")
Crop(2,0,0,-8)
ConvertToYV12(interlaced=true)
#ColorYUV(Analyze=true)
#Histogram("Levels")
return last
Notice the two lines beginning with "#", which disables the code and turns them it into comments. What I actually did was run one copy of the script with the "Analyze" line enabled, then ran
another copy of the script with the "Levels" line enabled. You can run the Analyze function and the Levels histogram in the same script because they would affect each other and give invalid results. I captured a picture of the frame with the histogram into a photo app, then captured a picture of the Analyze frame. I then laid the Analyze frame over the part of the image in the photo with the histogram on the side to get the composite image.

The Levels histogram shows the out-of-spec illegal levels. On the left-hand of the white luma band in the histogram you can see the yellow-tinted data that flows into the unsafe zone. That yellow data would be clipped in RGB if not brightened first in YUV. The right-side overflow is harder to see, but it shows up in the Analyze "Luma" column as a value of 249 max, which is 14 points overload above y=235. That overflow would be clipped in RGB if not lowered first in YUV.




The image above is an RGB vectorscope of the same frame without its readout, histogram, or borders. The vectorscpe measures saturation levels and chrioma placement. There is plenty of red and high yellow-orange saturation. Green and Blue hues are in deficit. The small letters around the inside of the inner circle, starting from the upper right quadrant and going clockwise, are "M" (Magenta), "B" (Blue) just under the right-hand horizon, "C" (Cyan) at the bottom, "G" (Green) moving upward on the left, "Y" (Yellow) at middle left, and "R" (Red) in the upper left quadrant. The slanted line between "Y" and "R" is where flesh tones should normally peak. The RGB vectorscope is one of the features in VirtualDub's ColorTools plugin.




(Above). On the left is a reduced-size original unfiltered frame from 1.avi. At its right is the filtered cleanup version. In the filtered frame notice some recovered dark details showing the woman's shoulder and hair more clearly, greater clarity of people and objects in the background, clean blacks throughout the image, and more natural color and illumination. The color correction was initialized in YUV and tweaked with VirtualDub RGB plugins that were applied to the output of the Avisynth script. The script and RGB settings will follow in the next post.



(Above) the same frame following a session of DeShaker to stabilize the chaotic camera motion and jitter. The thick black borders show the amount of image loss from the stabilizer, which was run at 1/2 strength to prevent some distortion effects. The attempt didn't stabilize the image all that much and was hardly worth the effort. It also resulted in visible smearing, blurring and moire on sweeping motions. A copy of the resulting video will be in the next post.


Attached Images
File Type: jpg a.avi Analyze readout and YUV Histogram.jpg (51.3 KB, 334 downloads)
File Type: png a.avi original RGB Vectorscope.png (14.9 KB, 332 downloads)
File Type: jpg a.avi original _vs_ filtered.jpg (97.2 KB, 330 downloads)
File Type: jpg a.avi DeShaker showing image cost.jpg (44.9 KB, 329 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #12  
05-09-2020, 11:36 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Analyzing and Color Correcting 1.avi (Cont'd):

In some cases I've had to name a processed file by "v1.avi" instead of "1.avi". I have one PC system with software that sees a filename beginning with a number and thinks it's a website instead of a file. So for this project please understand that "v1", "v2", etc., actually is a sequence of processing steps that involves your samples "1.avi", "2.avi", and so forth.

Near the end of this post I'll give a summary of the filters and tools used.

The script below is step 1 in a two-step process. I often choose to repair and restore a complicated video in at least two stages because a lot of slow filters in one script takes an intolerably long time to run. There is less memory-swap pileup if separate stages are used. The first script applies levels/color correction and a moderate stabilizer called Stab(), and old standby. Stab() isn't the ultimate stabilizer but it does enough to help deinterlacers and denoisers detect the difference between a piece of motion and a piece of noise. There are other stabilizers; many don't work properly. Those that do are tough to manage for most users.

The scripts below also perform some final format conversions. You probably won't attempt all of these conversions with every file, but I'll include them to show you how they're done.

First, I'll post only the first part of the script that deals with levels and color, to give an idea of a working sequence:
Code:
AviSource("I:\forum5\faq\CZbwoi\v1\1.avi")

Crop(0,0,0,-8)
ColorYUV(cont_y=-20,off_y=8,off_v=-5,off_u=5)
Tweak(cont=1.08,sat=1.3,dither=true,coring=false)
Levels(20,1.05,255,16,235,dither=true,coring=false)
ConvertToYV12(interlaced=true)
# ColorYUV(Analyze=true)
# Histogram("Levels")
Histogram("Color2")
return last
In practice, most of the lines above are added to the script one at a time as processing is set up. Crop(0,0,0,-8) comes first; it removes unwanted border pixels that affect the histograms and charts. The histograms are turned on an off with "#" comment marks as needed. Progress is viewed in VirtualDub. You restart after script changes by clicking "File..." -> "Reopen video file" (or click F2) to get you back to the frame you're working on. Sometimes many restarts will clog VDub memory, so just go back to "Open video file..." and restart from scratch.

ColortYUV was the first new line added, and the first function to get a levels fix was "cont_y=-20". This reduced contrast, or the range between darkest and brightest pixels. "Contrast" in ColorYUV is non-standard. Most standard contrast controls use "brightness" to expand or contract black levels and "contrast" to expand or contract brights separately. In ColorYUV, arrogantly a positive number will expand the range from the middle outward in both directions, and a negative number contracts the range from each end toward the middle. The statement "cont_y=-20" was a negative contrast value that contracted the clip's contrast range to a narrower spread, and "off_y=8" raised all luma values upward 8 steps toward the bright end, which was enough to bring the entire range to just within the limits of y=16-235. You could see it happen in the histogram, which I had turned on for viewing at the time. You can turn it off to check your work because it simply attaches itself to the right side of the image when turned on.

The next modifications were to add off_v=-5 (to slightly lower the values of the red/green channel) and off_u=5 (to slightly raise the values of the blue/yellow channel) one at a time, and scrolled around and readjusted until the colors looked better. Use white, gray, black, flesh tones and other familiar objects as a guide.

With these ColorYUV values as an initial start and YUV histograms turned off, RGB color controls were added in VirtualDub. Gradation curves came first. The image still looked dim and undernourished especially at the bright end and in midtones. All three colors were added in midtones and brights, with a "notch" filter at the top of the scale to keep the bright colors safely within the 0-255 RGB range. ColorMill was then added to boost red gamma a slight bit to keep walls and people from looking too green. Color settings were checked with a Csamp pixel reader and ColortTools RGB histogram.

The filter sequence and settings were saved in a .vcf file, which is attached as "v1.avi VirtualDub settings.vcf". Download the .vcf and store it in a location with the other files for this project. Do not store it in VirtualDub plugins. Keep in the area where your video work files. When you're ready to use the .vcf, use "File.." -> "Load processing settings...", locate and select the .vcf and click "open". The .vcf will load the filters and settings used so that you can have a look at how they're configured. If you have other filters loaded in your VDub filter chain, they will be removed. You can view the contents of the .vcf in a text editor (it is a plain text file). DO NOT MAKE CHANGES unless you know what you're doing, and make a backup before doing so.

Once the levels and color were set up, the overall image still looked somewhat flat and unlively. Tweak(cont=1.08,sat=1.3,dither=true,coring=false) was added to increase contrast from the midtones outward and to boost saturation. This caused a boost in the brights that went past y=235, so Levels(20,1.05,255,16,235,dither=true,coring=false) was used to very slightly darken the lowest dark colors darker than RGB 20 and to gradually reduce brights until they were within the y=235 range.

This is the sort of fixing that takes time. You add something or make another change, then you take a break and come back to check the results. Make another change, take another break, etc. Eventually it looks "correct" and you move on. Don't just sit and stare at it for too long or your brain starts playing tricks. Always work on color and levels in dim light.

Once that phase was set, I set "#" marks on lines that were no longer being used, and added the Stab() plugin to the script. The script now looked like this:

Code:
Import(ppath+"Stab.avs")
AviSource("I:\forum5\faq\CZbwoi\v1\1.avi")

### Crop(0,0,0,-8)
ColorYUV(cont_y=-20,off_y=8,off_v=-5,off_u=5)
Tweak(cont=1.08,sat=1.3,dither=true,coring=false)
Levels(20,1.05,255,16,235,dither=true,coring=false)
ConvertToYV12(interlaced=true)
### ColorYUV(Analyze=true)
### Histogram("Levels")
### Histogram("Color2")
### return last

Stab ()
return last
"return last" is used to stop a script and return the results at the chosen point. Stab() runs quickly. When it was finished I opened the resulting file in another instance of VirtualDub and checked the changing border lines, which Stab() constantly modified. The border changes will flicker and are usually a few pixels at the left, top, and bottom, and sometimes the right. Use VDub's BorderControl plugin to determine new borders in RGB. Once I had new borders determined, I removed that filter (you can't save its settings in a .vcf. It won't work!). I closed the file in the second instance of VirtualDub, then returned to the script and revised the text to make the border changes in YUV.

The fully completed script now looks like this:

Code:
Import(ppath+"Stab.avs")
AviSource("I:\forum5\faq\CZbwoi\v1\1.avi")

### Crop(0,0,0,-8)
ColorYUV(cont_y=-20,off_y=8,off_v=-5,off_u=5)
Tweak(cont=1.08,sat=1.3,dither=true,coring=false)
Levels(20,1.05,255,16,235,dither=true,coring=false)
ConvertToYV12(interlaced=true)
### ColorYUV(Analyze=true)
### Histogram("Levels")
### Histogram("Color2")
### return last

Stab ()
### return last
ConvertToYUY2(interlaced=true)
Crop(4,2,4,-6).AddBorders(4,4,4,4)
ConvertToRGB32(interlaced=true,matrix="Rec601")
return last
After working with the other sample clips I decided to make the final output borders a uniform 4 pixels on each side so that all output files would match in that respect. The actual cropping-off sometimes differed from clip to clip, but the final 4-pixel borders was kept consistent.

ConvertToYUY23interlaced=true)
Crop(4,2,4,-6).AddBorders(4,4,4,4)

The conversion from YV12 to YUY2 is a conversion from YV12 4:2:0 to a 4:2:2 colorspace. The extra chroma resolution is needed because vertical cropping in interlaced YV12 must be done in groups of 4 pixels. But we only needed vertical cropping in groups of 2, which YUY2 allowed. The crop removed 4 pixels from the left, 2 from the top, 4 from the right, and 6 from the bottom. The new 4-pixel border centered the image in the 720x480 frame.

Finally, ConvertToRGB32(interlaced=true,matrix="Rec601") set up the final colorspace conversion for work with VirtualDub's RGB filters. The final output in VirtualDub was saved in a YV12 colorspace with Lagarith lossless compression set for YV12. These output conditions MUST BE SET MANUALLY before saving the final avi output in VDub. The file was saved as Lagarith YV12 both to conserve space and to have it ready for the final denoising script.

The file from step 1 was then used as input use to script 2 below:

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\"v1_00_stb.avi")
###--- input is already YV12. If not, use ConvertToYV12(interlaced=true) ---###
AssumeTFF()
QTGMC(preset="medium",border=true,TR2=3,EZDenoise=4,denoiser="dfttest",\
   ChromaMotion=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
vInverse2()
source=last
  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) 
dfttest()
MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth=10))
LSFMod() 
return last
QTGMC is used here as denoiser, chroma cleaner, line and shimmer smoother ("TR2=3"), general denoiser (EZDenoise), and deinterlacer. The parameter settings enhance the defaults of the "medium" preset. The "vInverse2()" filter helps subdue residual interlace combing. This is followed by an old standy routine that starts with the line "source=last" and ends with the line that begins "MDegrain2...". This is a degraining and motion smoother routine taken directly from Avisynth's MVtools plugin. It's followed by dfttest() used at default settings, which is another smoother working principally on "floating grunge", which is very prominent in this shot.

MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth =10)) combats chroma smear and tightens color around edges. The MergeChroma() function has the sharpener working only on color, not luma, to prevent an oversharpened look. What one would call a normal sharpener is with LSFMod(), an old standby used here because it sharpens (most of the time) without creating edge artifacts. I don't always use it because it can sometimes make soft video look somewhat plastic.

There are some things in noisy video that are not possible to fix completely, but I think the code does all that can be expected. One thing I noticed in the filtered output is the man sitting in the sofa on the lower right and wearing the gray striped t-shirt: at one point the stripes disappear. If you take a look at the source 1.avi, the stripes disappear in the original clip as well. It's a camera recording and rendering fault. We see it quite often.

Finally, you will need "return last" because other clips have been created and named in previous lines for MDegrain2. "Return last" returns the "last" previous clip operation in the script.

The abov script outputs 720x480 double-rate progressive video at 59.94fps. Save it as Lagarith YV12 for further processing. It can be re-interlaced, resized, or whatever, and encoded in any format you choose. The 59.94fps 720x480 output is attached as v1_5994p.mkv

The following script takes the 720x480 59.94fpsm output file and resizes it to 640x480p for online. If you want to mount it on a webiste, check with that website's requirements before doing anything.

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\v1_00_stb_5994pQ.avi")
Spline36Resize(640,480)
The output file is saved as Lagarith YV12. It is attached as v1_640x480_5994p.mp4.

The following script re-interlaces the 720x480 59.95p file for encoding for DVD:

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\v1_00_stb_5994pQ.avi")
AssumeTFF()
SeparateFields().SelectEvery(4,0,3).Weave()
The SepaarteFields() command splits progressive full-size frames into two identical half-height fields, as if the frames were interlaced. It creates a top field and a bottom field from each frame. SelectEvery(4,0,3) takes groups of 4 fields numbered 0 thru 3 (field numbers start with 0) and selects top field number 0 and bottom field number 3. Weave() then weaves the fields together two at a time to make a re-interlaced 29.97i fps file.

The output file was saved as Lagarith YV12 and encoded with MPEG2 for 4:3 standard DVD playback or authoring. You can see some of the effects of severe motion in an occasional crooked line or sawtooth edge, but the cleanup has fixed most of it. It is attached as v1_forDVD_2997i.mpg.

The following script reformats the 720x480 59.94fps file for a 29.97fps frame rate by discarding alternate (odd-numbered) frames and selecting only even-numbered frames. It's a common technique for restoring the original framerate if it's not acceptable to re-interlace a 59.94fps file. However, it removes 50% of the temporal resolution, so choppy playback is often the result, especially on movement and camera pans.

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\v1_00_stb_5994pQ.avi")
SelectEven()
The file is saved as Lagarith YV12 and encoded as 720x480 29.97i with 4:3 DAR playback flags. It is attached as v1_2997p.mkv.

The following did not require an Avisynth script. The 720x480 59.94 filtered file was opened directly in VirtualDub, which converted it to RGB internally. A session of DeShaker was applied. The DeShaker settings are attached as deshaker.vcf. The motion is still severe and has some mild distortions, so I don't think the effort was worth it.

The output file was saved as Lagarith YV12 with the title "V1_00_stb_Dshk.avi". It was opened directly in Virtualdub to determine the crop and border parameters. After these were determined the file was processed with the Avisynth script below.

Code:
AviSource("I:\forum5\faq\CZbwoi\v1\v1_00_stb_Dshk.avi")
Crop(36,22,-20,-26).AddBorders(28,24,28,24)
The file was saved as Lagarith YV12 with the title "v1_00_stb_Dshk_Q.avi". It was then encoded with x264 for 4:3 display using TMPGenc Mastering Works. It is attached as v1_Deshaker_5994p.mp4.

Filters & Tools used in this post:

Downloading filters and filter packages: never download a filter or filter pack into your plugin folders. The plugin folder gets filled with different versions and extra junk that shouldn't be there, and the next thing you know you get undecipherable filter errors. For filter downloads I created a huge master folder called "filters" and divided it into Avisynth, VirtualDub, and Misc subfolders. Within those subfolders are extra subfolders named for the filters and even script samples, articles, and website links that I download. Downloads are unzipped in those subfolders and only the filters themselves are copied into the official plugin folders. In this manner I always have a backup copy and I always know where all the documentation and other materials are located. The entire folder is often occasionally backed up to an external hard drive.

-QTGMC. This is listed first because support files are also stand alone filters in their own right and often used elsewhere. The QTGMC "original" version 3.32 was used here. This version and its support files and documentation can be downloaded at http://www.digitalfaq.com/forum/atta...kagenov2017zip. The .zip package contains simple instructions for 32-bit system dll's that go into your Windows folder, Avisynth 32-bit plugin support files including QTGMC v3.32 .avsi, Source and Documentation for everything (you could spend in there), and a READ_ME FIRST file. If you find when loading the filters that you have a newer version in your plugin folder, keep the newer version. They are backward compatible with QTGMC 3.32.

-Crop(). Avisynth builtin. http://avisynth.nl/index.php/Crop
-AddBordedrs(). Avisynth builtin.http://avisynth.nl/index.php/AddBorders
-AviSource(). Avisynth builtin. http://avisynth.nl/index.php/AviSource
-ColorYUV(). Avisynth builtin.http://avisynth.nl/index.php/ColorYUV
-Tweak(). Avisynth builtin. http://avisynth.nl/index.php/Tweak
-Levels(). Avisynth builtin.http://avisynth.nl/index.php/Levels
-Analyze(). A function in ColorYUV, see above.
-Histogram(). Avisynth builtin. http://avisynth.nl/index.php/Histogram
-Convert(). Avisynth builtin. http://avisynth.nl/index.php/Convert
-Return last. Avisynth builtin. See "Return expression" in opening lines of tutorials in "Avisynth Grammar" (http://avisynth.nl/index.php/Grammar).
-Stab(). External plugin. http://avisynth.nl/index.php/Stab. Requires the DePanEstimate package.
Links are on Stab's home wiki page above, or get the earlier, more compatible DePanTools version at http://www.digitalfaq.com/forum/atta...1&d=1531396979. Also requires the RgTools plugin, which comes with the QTGMC package or at http://avisynth.nl/index.php/RgTools.
-AssumeTFF(). Avisynth built-in. http://avisynth.nl/index.php/Parity. Avisynth's default is BFF.
-vInverse2(). External plugin. http://avisynth.nl/index.php/Vinverse.
-MDegrain2(). External plugin, a function of MVTools2 which comes with the QTGMC package.
-Dfttest(). external plugin. Comes with the QTGMC package and all support files, or at http://avisynth.nl/index.php/Dfttest. Also check http://avisynth.nl/index.php/Dfttest#Requirements, which also come with 32-bit QTGMC.
-MergeChroma(). Avisynth built-in. http://avisynth.nl/index.php/Merge.
-aWarpSharp2(). External plugin. http://avisynth.nl/index.php/AWarpSharp2.
-LSFmod(). External plugin. http://avisynth.nl/index.php/LSFmod. The only real requirements are MaskTools2 and RGTools, both of which come with QTGMC.
-Spline36Resize(). Avisynth Builtin. http://avisynth.nl/index.php/Resize.
-SeparateFields(). Avisynth Builtin.http://avisynth.nl/index.php/SeparateFields.
-SelectEvery(). Avisynth Builtin.http://avisynth.nl/index.php/Select.
-Weave(). Avisynth Builtin. http://avisynth.nl/index.php/Weave.
-SelectEven(). Avisynth Builtin. See "SelectEvery", above.
-Gradation Curves 1.45. VirtualDub External plugin. http://www.digitalfaq.com/forum/atta...1&d=1489408797. The download comes with extra links for html tutorials, and an online html help file that you can copy into the plugins folder..
-ColorMill 2.1. Virtualdub External plugin. http://www.digitalfaq.com/forum/atta...colormill21zip. A brief collection of sample images is at fdump's website athttp://fdump.narod.ru/rgb.htm. A longer post about one's user's experience with ColorMill is at http://www.digitalfaq.com/forum/vide...ll-filter.html. The article's is not completely definitive, for instance the information on the Middle Point setting is not quite correct.
-ColorTools 1.4 and ColorTools 1.5 update. Virtualdub External plugins. The older version 1.4 is used in many scripts and is at http://www.digitalfaq.com/forum/atta...ools_pluginzip. The newer 1.5 update works in all versions of Windows and is found in later scripts. Version 1.5 is at https://sourceforge.net/projects/vdf...1.5%20update1/. You can install both versions in your plugins if you change one of the vdf names so that they're not identical. I have them installed together as "ClrTools.vdf' and "ClrfTools15.vdf".
-BorderControl. VirtualDub External Plugin. https://sourceforge.net/projects/bor...atest/download.
-CSamp.exe. Windows desktop pixel value reader. http://www.digitalfaq.com/forum/atta...on-dv-csampzip. No installer, just copy CSamp.exe to desktop and place it in a corner where it's easy to find. When it's running it places a small blue hourglass icon in your right-hand links toolbar. To get rid of it, right-click the icon and click "Exit".
DeShakedr 3.1. VirtualDub External plugin. https://www.guthspot.se/video/deshaker.htm.

Some older posts that cover some of these and other VirtualDub filters are in the "Information Overload" posts in an older thread, notably post #19 and a botched home video and bad exposure battery in post #21. Be careful of the filter download links in this old thread because many are obsolete.

I'll follow this with more posts on the other.avi samples, but first I have to clean up my messy scripts!


Attached Files
File Type: vcf v1.avi VirtualDub settings.vcf (3.8 KB, 6 downloads)
File Type: vcf deshaker.vcf (1.1 KB, 6 downloads)
File Type: mkv v1_5994p.mkv (8.27 MB, 4 downloads)
File Type: mp4 v1_640x480_5994p.mp4 (8.13 MB, 7 downloads)
File Type: mpg v1_forDVD_2997i.mpg (8.37 MB, 5 downloads)
File Type: mkv v1_2997p.mkv (8.44 MB, 3 downloads)
File Type: mp4 v1_Deshaker_5994p.mp4 (8.37 MB, 9 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), Delta (06-19-2021), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #13  
05-10-2020, 01:30 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Analyzing and Color Correcting 2.avi:

Here come a few more filters you can add to your toolbox.

The original looks slightly boring for 2 possible reasons. One, the camera lens is perhaps shutting down a bit when confronted by shiny metal in a highly contrasty sun situation, which does tend to tame saturation a bit. Two, shadows and darker colors look a bit grim because blacks are crushed. Overall the original image is out of spec because it's contrast range is too much for digital video. Maybe it looked livelier on analog playback into a CRT. To say that the color range needs to be compressed into a range that digital can handle seems counter intuitive, but sometimes that's the case.





(Above). The frames are resized to smaller 4:3 from the videos. The original scene is on the left, cleanup version on the right. Improvement can be seen from the relative absence of aliasing (compare the "SALE" roadside sign on the left with the same sign on the right). The white van seems brighter, even though it really isn't, possibly because the whitish detail that was washing out as a nearly out of spec hot spot in the original was rescued in the cleanup (it's actually 15 RGB points darker in the cleanup).

Many of the controls in this cleanup are familiar from then previous post, so in the summary descriptions I'll stick with new material only. Again, I used two scripts. The first is a quickie stablilization to help the deinterlacer, and color correction. A very shaky camera, again, causing some distortions that can't be completely fixed.

Code:
AviSource("I:\forum5\faq\CZbwoi\v2\2.avi")
###Crop(0,0,0,-8)
ColorYUV(cont_y=-30,off_y=3)
Levels(16,1.0,255,16,250,dither=true,coring=false)
ConvertToYV12(interlaced=true)
###ColorYUV(Analyze=true)
###Histogram("Levels")
###Histogram("Color2")
###return last

stab()
ConvertToYUY2(interlaced=true)
Crop(4,2,-4,-6).AddBorders(4,4,4,4)
ConvertToRGB32(interlaced=true,matrix="Rec601")
return last
Again, the script text has disabling "#" comment marks on the test lines that were no longer used after the initial YUV corrections. As can be seen from "ColorYUV(cont_y=-30,off_y=3)" a considerable reduction in contrast and a slight y-offset correction of off_y=3 brought the most troublesome frames into y=16-235. Levels needed only a slight bright limiting of 250 to keep the range in line. The logic of that 250 limit is that is gradually lessens bright peak output by just a few points, which is all that was needed. This was checked with the Analyze readout and the Levels histogram. There was no need for a Tweak() routine.

It was easier for color this time around, since the average consumer camera is much better with color and far less noisy in good lighting. ColorMill was used to slightly lift the lower midrange hiogher and to add a considerable push of 25 points of saturation. Gradation curves added a boosting curve to the mid and upper mids, and limited bright blue output to just below RGB 255. The ColorTools RGB histogram checked the effects. The filters and settings are attached as "v2_VirtualDub_Settings.vcf".
In VirtualDub the RGB filtering was saved as Lagarith YV12 for the denoising step. Below is the script, which is very similar to the cleanup script for the 1.avi clip:
Code:
AviSource("I:\forum5\faq\CZbwoi\v2\v2_00_stb.avi")

###--- Input is YV12. if not, use ConvertToYV12(interlaced=true) ---###
AssumeTFF()
QTGMC(preset="medium",border=true,TR2=3,EZDenoise=6,denoiser="dfttest",\
   ChromaMotion=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
source=last
  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) 
DeHalo_Alpha()
Santiag(2,2)
MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth=10))
LimitedSharpenFaster(strength=250)

###--- RemapFrames routine starts here ---###
save_audio=a1

BaseVid=a1
Source2=BaseVid

BaseClip=BaseVid
BaseClip=BaseClip.RemapFrames(mappings="
214 215
215 214
216 217 
217 216
", SourceClip=Source2)

AudioDub(BaseClip,save_audio)
###--- RemapFrames routine ends here ---###
return last
At first it seemed it would be a lark, a repeat of the earlier clip. But it wasn't. Things began easily enough until -- zap -- a deinterlace problem popped up just near the end, apparently caused by camera shake. Not unusual, but it took some fancy tricks and a headache to fix it.

QTGMC was used as before, followed by the same MDegrain2. DeHalo_ALpha() fixed the right-side bright halos on the telephone poles, softening the overall video a little. Santiag(2,2) calmed the aliasing on several objects, which also caused slight softening. Some sharpness was restored with MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth =10)) and LimitedSharpenFaster(strength=250) with its normal strength of 100 pushed to 250. Then comes the routine to fix the deinterlace problem:

Just as the first dark blue van speeds out of the scene past the right border, the camera introduces added interlacing echos to the last few frames. This causes 4 frames to appear out of sequence. Frames 214 through 217 occur as 215, 214, 217, 216 and give a kind of shudder" as the van passes. A handy plugin called RemapFrames is used to restore the sequence, but because this plugin cuts off audio on frames it fixes, Save_audio is created to give a home to the unharmed audio from previous steps.

The routine begins with "a1=last", which saves previous processing as a new clip called "a1". The name is strictly an invention, safe to use because no other entity in this code has that name. A copy of clip "a1" is then created and given the invented name of "save_audio". Then yet another copy of the clip is created and saved as "BaseVid", which is a name used in the RemapFrames plugin. Another copy called by the invented name "Source2" is created as a copy of BaseVid. Actually these clips are all copies of "a1". Why? Unfortunately RemapFrames in its present function requires some very specific naming conventions and convoluted syntax because of the way it's internally programmed in an ancient version of c-language. That's the way I've seen it explained. It's other internal functions are far simpler. Here, it's intended to work with multiple copies of the same clip ("a1").

"BaseClip" is a required named parameter in Remapframes. It is assigned the value of the clip BaseVid. The easiest part to understand is that BaseClip is modified by remapping frames from
named parameter SourceClip, which is really set to the copy named Source2. The frames reassigned from the new clip to BaseClip are frame 214 replaced by frame 215, frame 215 replaced by 214, 216 by 217, and 217 by 216. In effect the old frame sequence 214-217 is replaced by the proper frames in the proper sequence. That is, the incorrect sequence 215-214-217-216" is reformatted as 214-215-216-217. You have to lay the old and new frame numbers on a piece of paper to work it out in your head. The name of the new, fixed copy is BaseClip.

"AudioDub(BaseClip,save_audio)" replaces the damaged audio in BaseClip with the original audio from save_audio. "return last" returns that new copy of BaseClip and ends the processing.

The output from this script is 720x480 double-rate progressive video running at 59.94 fps. It is saved as a Lagarith YV12 video file. It can be resized, re-interlaced, and/or encoded in any format desired. This file is encoded into 59.94p and attached as "v2_5994p.mp4"

The script below takes the 720x480 59.94fps progressive file and reformats it as a square-pixel 640x480 mp4 file:

Code:
AviSource("I:\forum5\faq\CZbwoi\v2\v2_00_stb_Q.avi")
Spline36Resize(640,height)
Santiag(3,3)
Santiag(3,3) running at a vertical and horizontal strength of 3 is used to smooth sawtooth edges and aliasing from resized objects, such as the roadside "SALE" sign and some contours in the vans. There is a flashing spot of moire on the front of the blue van and some momentary line twitter in the bumpers of the vans as they approach. These disturbances result from severe camera motion -- unfortunately, stopping the motion entirely creates other distortions that are equally annoying.

The output of the encoded 640x480 progressive file is attached as "v2_640x480_5994p.mp4".

New plugins and tools used in this post:

-DeHalo_Alpha: Avisynth External plugin. Older, more compatible earlier version at http://www.digitalfaq.com/forum/atta...dehaloalphazip. Requires MaskTools2 and RgTools, both of which come with QTGMC. An illustrated article describing DedHalo_Alpha is at https://www.aquilinestudios.org/avsf...rs.html#dehalo. Scroll down the page to the demo image and slide your mouse pointer on and off the image to see it turn the filter on and off. Other filters are discussed on this site.
-Santiag v1.6 avsi: Avisynth external plugin. A very popular anti-alias fixer, home wiki page at http://avisynth.nl/index.php/Santiag. Two of its requirements are MaskTools2 and NNEDi3, which come with QTGMC. It's other requirements are listed on its home wiki page. One of those added requirements is Microsoft's 2012 VisualC++ runtime, which comes with (you guessed it!) QTGMC.
-LimitedSharpenFaster.avsi: Avisynth External plugin. A favorite sharpener instead of LSFmod, which made this softer video look plastic. Athttp://avisynth.nl/index.php/LimitedSharpen. Requirements of MaskTools2 and RgTools come with QTGMC. An older requirement of aWarpSharp can use aWarpSharp2, which you alread have from the previous post for 1.avi.
-Remapframes: Avisynth External plugin. Very handy utility from a gadget guru named StickBoy, at http://avisynth.nl/index.php/RemapFrames. Make a copy of the wiki page html, which your browser can read again later. Very useful documentation. I have used this plugin many times.
-AudioDub(): Avisynth builtin. http://avisynth.nl/index.php/AudioDub

3.avi and 4.avi are next.....


Attached Images
File Type: jpg v2 original _vs_ cleanup.jpg (105.8 KB, 327 downloads)
Attached Files
File Type: vcf v2_VirtualDub_Settings.vcf (3.7 KB, 5 downloads)
File Type: mp4 v2_5994p.mp4 (7.30 MB, 3 downloads)
File Type: mp4 v2_640x480_5994p.mp4 (7.13 MB, 5 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #14  
05-11-2020, 12:53 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Post-processing 3.avi and 4.avi:

RGB color correction is a little different between 3.avi and 4.avi, possibly because they are videos shot in two different environments. But noise and bad camera motion pose about the same script solutions.

The composite image below consists of an unfiltered frame from the original 3.avi (left), and a cleanup version of the same frame after processing (right). The left image is dim and has too much red and green (yellow). The right-hand image is denoised and color corrected as much as practicable, considering that AGC pumped luminance levels several times and the color balance fluctuated continuously.



Because the camera was tracking through the house, exposure and color balance change several times during the clip. The color balance developed for 3.avi wouldn't work for 4.avi.

The stabilization script for 3.avi was quick, moderate, and simple, with no color work:

Code:
AviSource("I:\forum5\faq\CZbwoi\v3\3.avi")
ConvertToYV12(interlaced=true)
stab(range=2,dxmax=6,dymax=6)
ConvertToYUY2(interlaced=true)
Crop(4,2,-4,-6).AddBorders(4,4,4,4)
return last
Color work was postponed until the next denoising step. The output of this script was saved as Lagarith YUY2 for the color/levels fix and denoising.

Denoising ran very slo-o-o-ow for these two avi's. Hectic camera motion and lots of video noise gave the filters a lot of work to do. That slows the run of the script, especially when the processing plowed through the most hectic parts of the clip, which also had the most noise.

Below, the denoising script and color work for the stabilized 3.avi:

Code:
AviSource("I:\forum5\faq\CZbwoi\v3\v3_00_stb.avi")

###--- Input is interlaced YUY2 ---###
###Crop(4,4,-4,-4)
ColorYUV(cont_y=-25,off_y=5,gain_u=40,off_u=-17) #,gain_v=-10)
Levels(16,1.0,255,16,245,dither=true,coring=false)
ConvertToYV12(interlaced=true)
###ColorYUV(Analyze=true)
###Histogram("Levels")
###return last

AssumeTFF()
QTGMC(preset="medium",border=true,TR2=3,EZDenoise=4,denoiser="dfttest",\
   ChromaMotion=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
vInverse2()
source=last
  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400) 
dfttest()
GradFun2DBmod(thr=2.0,mask=true)
MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth=10))
LimitedSharpenFaster(edgemode=2,strength=200) #(edgemode=2)

###--- Create new clean borders ---###
Crop(2,4,-2,-4).AddBorders(2,4,2,4)
return last
The early lines made into comments with the "###" comment marks were disabled after determining settings for levels and color balance and applying RGB filters while viewing the script's output in VirtualDub. YUY2 was used in the opening lines because I thought ColorfYUV and levels dithering looked a little cleaner in YUY2. Maybe its just my imagination.

Starting with QTGMC the script follows the same path that was used for earlier avi's, but an extra dose of dfttest at default values was needed for the thick floating grain noise. GradFun2DBmod(thr=2.0,mask=true) is an anti-banding filter. It's used to smooth hard gradient edges and color banding in the many solid wall surfaces seen in the interior shots. See more notes about this popular filter at the end of this post.

The rest of the script should be familiar by now. Conversion to RGB32 is for work with VirtualDub filters. Filters included were the same as before: ColorCamcorderDenoise, ColorMill, and Gradation Curves. ColorMill mainly handled the midtone and bright corrections, gradation curves kept response curves under RGB 255. RGB settings are attached as "v3_VirtualDub_Settings.vcf".

The above script outputs 720x480 NTSC video running at double frame rate 59.94fps progressive. It can be re-interlaced, resized, and/or encoded into several different formats. Below is the script for formatting the video into 640x480 progressive frames for 59.95fps viewing at a 4:3 aspect ratio:

Code:
AviSource("I:\forum5\faq\CZbwoi\v3\v3_00_stb_Q_5994p.avi")
Spline36Resize(640,height)
A copy of the encoded 640x480 mp4 is attached as "v3_640x480_5994p.mp4".

(Below) The full-size image is an unfiltered frame from the original 4.avi showing disturbed noise from severe camera motion and excessive grain from interior lighting.




(Above) The same frame from 4.avi after color/levels correction and denoising:
4.avi after cleanup.jpg

The script below is the moderate stabilizing script for 4.avi. As you can see, it's the same as the script for 3.avi:

Code:
AviSource("I:\forum5\faq\CZbwoi\v4\4.avi")
ConvertToYV12(interlaced=true)
stab()
ConvertToYUY2(interlaced=true)
Crop(4,2,-4,-6).AddBorders(4,4,4,4)
return last
The output was saved as lagarith YUY2 for color correction and denoising in the next script (below) for 4.avi:

Code:
AviSource("I:\forum5\faq\CZbwoi\v4\v4_00_stb.avi")

###--- Input is interlaced YUY2 ---###
###Crop(4,4,-4,-4)
ColorYUV(cont_y=-30)
Levels(14,1.0,255,16,240,dither=true,coring=false)
ConvertToYV12(interlaced=true)
###ColorYUV(Analyze=true)
###Histogram("Levels")
###return last

AssumeTFF()
QTGMC(preset="medium",border=true,TR2=3,EZDenoise=4,denoiser="dfttest",\
   ChromaMotion=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
vInverse2()
source=last
  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
dfttest()
GradFun2DBmod(thr=2.0,mask=true)
MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth=10))
LimitedSharpenFaster(edgemode=2,strength=200) #(edgemode=2)

###--- Create new clean borders ---###
Crop(4,4,-4,-4).AddBorders(4,4,4,4)
return last
As before, the lines beginning with "###" were disabled after detrmining levels and color fixes for 4.avi. The YUV corrections were different for this clip and won't work for 3.avi. The crummy noise was about the same, though, so slow denoising filters were used again. RGB Color correction for this clip is also different, but still using CamcorderColorDenoise, ColorMill, and Gradation Curves. The RGB settings are attached as "v4_VirtualDub_Settings".

The above script outputs 720x480 NTSC video running at double frame rate 59.94fps progressive. It can be re-interlaced, resized, and/or encoded into several different formats. Below is the script for formatting the video into 640x480 progressive frames for 59.95fps viewing at a 4:3 aspect ratio:

Code:
AviSource(vidpath+"v4_00_stb_Q_5994p.avi")
Spline36Resize(640,height)
The output was saved as Lagarith YV12. The encoded 640x480 mp4 is attached as "v4_640x480_5994p.mp4".

New Filter used for these clips:

-GradFun2DBmod.avsi: AVisynth External filter. http://avisynth.nl/index.php/GradFun2DBmod. Three of its requirements -- AddGrainC, MaskTools2, and RgTools -- come with QTGMC. Any other requirements are on the home download above. An image that shows color banding effects and shows how the filter works is at https://www.animemusicvideos.org/gui...l.html#banding. Click on the filter names under the website image and the image will reload and change; after the image reloads you can right-click quickly on the filter names and watch an instant replay of the filtering. These filters aren't limited to anime, but the simplified drawings and contours make it easier to see how these filters work.


5.avi will be next and last...


Attached Images
File Type: jpg 3.avi original _vs_ after.jpg (66.6 KB, 322 downloads)
File Type: jpg 4.avi original with camera jiggle and noise.jpg (113.5 KB, 319 downloads)
File Type: jpg 4.avi after cleanup.jpg (60.7 KB, 323 downloads)
Attached Files
File Type: vcf v3_VirtualDub_Settings.vcf (3.9 KB, 4 downloads)
File Type: mp4 v3_640x480_5994p.mp4 (8.88 MB, 2 downloads)
File Type: vcf v4_VirtualDub_Settings.vcf (3.8 KB, 3 downloads)
File Type: mp4 v4_640x480_5994p.mp4 (9.58 MB, 2 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #15  
05-12-2020, 09:16 AM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
Processing 5.avi:

The capture looks better than the others. Not too bad. But you can see that the original (in the left image, below) is relatively dingy and gritty with some grain in the walls, and crushed blacks elsewhere, and a hot spot that's a little too hot on the right-hand girl's sweater. The image on the right is the filtered version of the same frame.


The clip needed a mild stabilization as usual, but wasn't as shaky as the others. Here is the usual stab() script:

Code:
AviSource("I:\forum5\faq\CZbwoi\v5\5.avi")
ConvertToYV12(interlaced=true)
stab()
ConvertToYUY2(interlaced=true)
Crop(4,2,-4,-6).AddBorders(4,4,4,4)
ConvertToYUY2(interlaced=true)
return last
The output from the above script was saved as Lagarith YUY2 for the next step. Below is the denoising and color correction script for that output file:

Code:
AviSource("I:\forum5\faq\CZbwoi\v5\v5_00_stb.avi")

###--- Input is interlaced YUY2 ---###
###Crop(4,4,-4,-4)
ColorYUV(cont_y=-30,gain_u=15)
ConvertToYV12(interlaced=true)
###ColorYUV(Analyze=true)
###Histogram("Levels")
###return last

AssumeTFF()
QTGMC(preset="medium",border=true,TR2=2,EZDenoise=4,denoiser="dfttest",\
   ChromaMotion=true,ChromaNoise=true,DenoiseMC=true,GrainRestore=0.3)
vInverse2()
source=last
  super = source.MSuper(pel=2, sharp=1)
  backward_vec2 = MAnalyse(super, isb = true, delta = 2, blksize=8, overlap=4, dct=0)
  backward_vec1 = MAnalyse(super, isb = true, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec1 = MAnalyse(super, isb = false, delta = 1, blksize=8, overlap=4, dct=0)
  forward_vec2 = MAnalyse(super, isb = false, delta = 2, blksize=8, overlap=4, dct=0)
  MDegrain2(source,super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
dfttest(sigma=8) 
GradFun2DBmod(thr=2.0,mask=true)
MergeChroma(aWarpSharp(depth=30).aWarpSharp2(depth=10))
LSFMod()

###--- Create new clean borders ---###
Crop(4,4,-4,-4).AddBorders(4,4,4,4)
ConvertToRGB32(interlaced=false,matrix="Rec601")
return last
Cleanup was less aggressive this time. As usual, the opening test lines are disabled with "###" characters. With QTGMC, motion smoothing isn't as strong (TR2=2 instead of 3). YUV levels and colors were easier with "ColorYUV(cont_y=-30,gain_u=15)" lowering Y contrast by 30 points to bring the spectrum into Y=16-235 and U-channel gain to get some upper midtone blue. A second dose of dfttest was given at half-strength of 8 (the default is 16). GradFun2DBmod smoothed grain and hard gradients in the background walls and ceiling to prevent block noise during encoding. LSFmod was used as the shartpener this time just to give the clip a smoother look. The clip has just enough sharpness to keep mild sharpeners from looking artificial.

Denoising looked OK for this scene, but if other parts of video from this environment involve more frantic camera motion again, bitrate and denoising will have to increase.

RGB color used ColorCamcorderDenoise and ColorMill, with the ColorTools 1.5 histogram keeping a check on chroma and luma levels in RGB. Color correction this time required only a mild midrange boost in blue and a little taming of red and very bright blue. This made the director's coat look more gray and took some of the ugly yellow out of skin tones. The RGB settings are attached as "v5_VirtualDub_Settings.vcf".

The above script outputs 720x480 NTSC video running at double frame rate 59.94fps progressive. It can be re-interlaced, resized, and/or encoded into several different formats. Below is the script for formatting the video into 640x480 progressive frames for 59.95fps viewing at a 4:3 aspect ratio:

Code:
AviSource("I:\forum5\faq\CZbwoi\v5\v5_00_stb_Q_5994p.avi")
Spline36Resize(640,height)
The output was saved as Lagarith Yv12, then encoded to a 640x480 square-pixel video. It is attached as "v5_640x480_5994p.mp4".

Here's another recent restoration and repair post that will give you a few more ideas for dealing with difficult subjects: http://www.digitalfaq.com/forum/vide...html#post68463.


Attached Images
File Type: jpg 5.avi original _vs_ corrections.jpg (84.7 KB, 318 downloads)
Attached Files
File Type: vcf v5_VirtualDub_Settings.vcf (1.1 KB, 8 downloads)
File Type: mp4 v5_640x480_5994p.mp4 (8.91 MB, 4 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bar72 (08-21-2023), CZbwoi (05-12-2020), OBNOXIUs (11-13-2020), ThumperStrauss (01-24-2022)
  #16  
05-12-2020, 05:43 PM
CZbwoi CZbwoi is offline
Free Member
 
Join Date: Apr 2016
Posts: 72
Thanked 1 Time in 1 Post
Wow, you are the absolute best sanlyn. I was swamped and not able to check this thread for a few days and I come back to this, fantastic effort and write-ups. I read through everything once but I'll be needing to do that some more to take everything in...some quick comments/questions that come to mind in regards to everything.

Quote:
First, the captures all have illegal video levels. This isn't just a technicality. Some websites will not mount illegal video levels -- it's too much trouble to clean them up. Those that do accept them will reprocess them to valid levels in ways that cut off bright and/or dark detail. If you were to submit these videos for broadcast at a local station, they would be rejected. Illegal signal levels are unattractive and are the signature of an inexperienced user. Illegal levels involve crushed darks and/or clipped brights which are lost details and colorless blobs when displayed as RGB. Finally, correcting illegal levels is often not possible, but when it is it's an extra chore that should be avoided in the first place.
This is something I don't have control over, lordsmurf did these captures for me a few years ago. I suspected the results to be from bad filming settings/equipment. The tapes were in bad shape (dusty and so on) and not stored correctly, so he had to do some hard work with them, make a new capturing environment, and I fully trust that this was the best possible capture result. I'm not an expert on the topic, but I know people like him and you are. He can comment on this if he wants to, but I don't know if he's aware of this thread and I haven't heard from him in quite some time...

Quote:
The second major problem is severe camera motion. This is so common with home videos that it's never surprising. While it's relatively no problem for analog video or film to render swift or hectic motion, digital video is a gross underachiever when it comes to motion handling. Digital is not a record of a continuous signal stream but is a series of distinct still images that stops 50 or 60 times per second and does not fade into the next image the way a CRT or movie projector flickers and fades between frames. If digital could flicker and fade, you wouldn't see the aliasing and sawtooth edges in most consumer camera videos, nor would you see as much as the persistent tape noise between images. Part of the problem is display technology, part of the problem is consumer camera shutter operation and sloppy interlacing, and part of the problem is users who refuse to employ tripods or shoulder braces. Chaotic zooming and frenzied camera pans are two other factors. Even when these are denoised in processing, these image wrecking actions require very high digital bitrates to encode properly.
Here's something that I failed to mention, I'm a very...traditional type of guy when it comes to preserving how things were shot, if that makes sense. If someone didn't know how to film and moved all the way around and about, I'm okay with that because that's what happened, and because fixing it removes image from what I know. I'm all for fixing color problems, denoising, artifacts in the way, etc - that's why I'm here. But for this one aspect, the camera motion...I'm okay with it remaining as it is because that's how it occurred and because I don't want any data or footage lost, like what we see in "Analyzing and Color Correcting 1.avi:" with DeShaker applied. So my question to you is, if I don't want any image lost and want to preserve everything, I remove the DeShaker part of the script...but do I also remove the stab() instances? Does using stab() remove any of the image and footage like we see the DeShaker do? If it doesn't remove anything, then I guess I could see keeping that step in - but if it does, then I'd probably want to not add it to preserve all of the image instead of a little stabilization. Because I don't really know how it would keep all of the image exactly, from what I understand of stabilization filters in NLEs.

+ to add onto this similar point, I sort of maybe also think about wanting to preserve the head-switching noises at the borders of the videos, that vintage feel is always cool to me to let you know what it was like back then watching the tapes, and it puts you back into that time. Is this odd and wrong? It seems counter-intuitive for me to want to fix everything, remove the noise and deinterlace, correct colors, and then not cropping out that noise in the end and adding it back...but at the same time, I sort of like the idea. I don't know, I don't know if I'm the only one with this thought... Feel free to comment on this and to let me know if I'm committing video blasphemy.

Quote:
I load color correction filters in VirtualDub that read the output of the Avisynth script and allow me to tweak the Avisynth settings.
I see this and that you attached .vcf files in the posts - from what I understand, you're applying filters in vdub as well, but I can't seem to see where in the process you're doing that in the avisynth scripts and where it applies. In the past, when I used a vdub filter, I would do so my inputting it into my avisynth script like so, users pointed me to doing something like this:
Code:
LoadVirtualDubPlugin("C:\Users\CZ\Desktop\Video Capture\VirtualDub-1.10.4\plugins32\ccd.vdf","ccd") 
ConvertToRGB32()
ccd(24,0) # threshold (0-100), multithreading (0=off. 1=on)
ConvertToYV12(interlaced=true, matrix="pc601")
I view whatever changes take place live via AvsPmod.

Could you implement the virtualdub settings and filters into the avisynth scripts you provided like above ^, by editing or reposting them? I'm just trying to get rid of learning or using another program in this process, if it's possible to use and see these filters in avisynth and AvsPmod without having to go through vdub as well it would be a lifesaver. From what I know all the filters you used could be implemented into the scripts like so, I don't think I'd be reading or inputting them correctly if I attempted to read those .vcf files...I tried to read one in notepad just now and it was nothing familiar.

And just now reading the last post and seeing you say "RGB color used ColorCamcorderDenoise and ColorMill", I don't see any of those called or loaded into the script above it - which leads me confused as to where it was implemented, I must have missed something. So if we could just implement everything into the avisynth script, I load them like in my above example, and then convert back to right colorspace when needed - that'd be best, if possible.

Sorry for my beginner problems and questions, just a few thoughts after my first read-through!
Reply With Quote
  #17  
05-13-2020, 02:22 PM
sanlyn sanlyn is offline
Premium Member
 
Join Date: Aug 2009
Location: N. Carolina and NY, USA
Posts: 3,648
Thanked 1,308 Times in 982 Posts
I understand your concern about remarks I made concerning signal levels and severe motion, etc. Of course, nothing can be done to re-shoot anything now, but they were giv en to explain to, myou (and oto others) why they require certain kinds of filterng. You don't just throw filters randomly at video. Most Aviaynth plugins are specialized and designed with a specific purpose in mind.

Stabilization in shaky videos improves the performance of denoisers and deinterlacers. If you leave 100% of the shaky stuff as-is, expect to see more noise in many areas and more edge noise in deinterlaced and interlaced segments.

You can leave head-switching noise in the videomis you wish.

AvsPmod is a great hindrance when trying to interface with other apps with features that you can't find in Avisynth. Many VurtualDub filters won't work in Avisynth scripts. DeShaker is one that won't, along with RGB histograms, many color controls, and some unique denoisers and smoothers. None of VirtualDub's built-in filters like their important Levels GUI will work in a script.

You can insert some filters into Avisynth, but how will you reconfigure them or eve learn how to do it? You can't get someone to give you a script that will correct every color sequence in your videos. The filters givcen are for specific segments. The color filters for 3.avi won't work in 4.avi. What about other segments and videos you haven't shown yet?

Here is a typical Avisynth entry for mounting a gradation curves filter in Avisynth:

Code:
# ----------- Load Curves plugin -----------------------
ConvertToRGB32(matrix="Rec601",interlaced=true)
VDpath="D:\VirtualDub\plugins\"
LoadVirtualDubPlugin(VDpath+"gradation.vdf","Curves1",1)

Curves1(1,"0001010202030404050606070809090a0b0c0d0e0f1011121314151618191a1c1d1e20212224252628292a2b2d2e2f30313334353637383"\
+"a3b3c3d3e4041424344454748494a4b4d4e4f50515354555657595a5b5c5d5f6061626365666768696a6c6d6e6f7071737475767778797a7c7d7e7"\
+"f808182838485868788898a8b8c8d8e8f90919293949596969798999a9b9c9d9e9e9fa0a1a2a3a4a4a5a6a7a8a8a9aaabacadadaeafb0b0b1b2b3b"\
+"4b4b5b6b7b7b8b9babbbbbcbdbebebfc0c1c1c2c3c4c4c5c6c6c7c8c9c9cacbcccccdcececfd0d1d1d2d3d3d4d5d5d6d7d7d8d9d9dadbdbdcdcddd"\
+"ededfdfe0e1e1e2e2e3e4e4e5e5e6e6e7e8e8e9e9eaeaeb00010203040405060708090a0b0c0d0d0e0f101112131415161718191a1b1c1d1e1f202"\
+"1222324252627282a2b2c2d2e2f3031323435363738393a3c3d3e3f40414344454647484a4b4c4d4e5051525354565758595a5c5d5e5f606263646"\
+"56768696a6b6d6e6f70717374757677797a7b7c7d7f8081828385868788898a8c8d8e8f9091929495969798999a9b9d9e9fa0a1a2a3a4a5a6a7a8aa"\
+"abacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacacbcccdcecfd0d1d1d2d3d4d5d5d6d7d8d8d9dadadbdcdcdddeded"\
+"fdfe0e0e1e1e2e2e3e3e4e4e4e5e5e6e6e6e7e7e7e8e8e8e9e9e9e9eaeaeaebebebebebebebebebebebeb00010203040506070708090a0b0c0d0e0f"\
+"101112131415161718191a1b1c1d1e1f2022232425262728292a2b2d2e2f3031323334363738393a3b3c3e3f4041424345464748494a4b4d4e4f505"\
+"1525455565758595b5c5d5e5f60626364656667696a6b6c6d6e6f71727374757678797a7b7c7d7e8081828384858687898a8b8c8d8e8f9092939495"\
+"969798999a9b9c9e9fa0a1a2a3a4a5a6a7a8a9abacadaeafb0b1b2b3b5b6b7b8b9babbbdbebfc0c1c3c4c5c6c7c9cacbcccdcfd0d1d2d3d4d5d6d7d8"\
+"d9dadbdcdddedfdfe0e1e1e2e3e3e4e4e5e5e6e6e6e7e7e7e8e8e8e8e9e9e9e9e9eaeaeaeaeaeaeaeaebebebebebebebebebebebebebebebebebebeb"\
+"00010203040405060708090a0b0c0d0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2d2e2f3132333435363738393b"\
+"3c3d3e3f4041424445464748494a4c4d4e4f50515354555657585a5b5c5d5e6061626364656768696a6b6d6e6f70717374757677797a7b7c7d7f8081"\
+"828385868788898a8c8d8e8f90929394959697999a9b9c9d9e9fa1a2a3a4a5a6a7a9aaabacadaeafb0b1b2b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c"\
+"5c6c7c8c9cacbcbcccdcecfd0d1d1d2d3d4d5d5d6d7d8d8d9dadadbdcdcdddddedfdfe0e0e1e1e2e2e3e3e4e4e5e5e5e6e6e7e7e7e8e8e9e9e9eaeaee"\
+"bebebecececededededeeeeeeefef000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f202122232425262728292a2b2c2"\
+"d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f6061626364656667686"\
+"96a6b6c6d6e6f707172737475767778797a7b7c7d7e7f808182838485868788898a8b8c8d8e8f909192939495969798999a9b9c9d9e9fa0a1a2a3a4a"\
+"5a6a7a8a9aaabacadaeafb0b1b2b3b4b5b6b7b8b9babbbcbdbebfc0c1c2c3c4c5c6c7c8c9cacbcccdcecfd0d1d2d3d4d5d6d7d8d9dadbdcdddedfe0e"\
+"1e2e3e4e5e6e7e8e9eaebecedeeeff0f1f2f3f4f5f6f7f8f9fafbfcfdfeff,15222220a06070702000019142625393c586176839ca6c4c5dcd6ffeb"\
+"00001614818fafc0d2ddf5eb0000161537398997adbfc8ddf1eb00001513727b9dadb5c6d4deffef0000ffff")
Do you know what that configuration looks like? That text had to be formatted for the script because in the .vcf the lines are several hundred characters long. How would you make necessary adjustments if you can't see what you're doing in AvsPmod? How would you set up that color control in the first place without viewing the video in VirtualDub?

Here is an entry for ColorMill:
Code:
# ----------- Load ColorMill plugin -----------------------
ConvertToRGB32(matrix="Rec601",interlaced=true)
VDpath="D:\VirtualDub\plugins\"
LoadVirtualDubPlugin(VDpath+"ColorMill.vdf","ColorMill",1)
ColorMill(25700, 25680, 29540, 25685, 26460, 25700, 25700, 25700, 25700, 25702, 25444, 25700, 25700, 1124, 4)
What do those numbers mean? What the does the configuration look like? Where did the codes come from? They came from mounting your video in VirtualDub and making the correction in that program. Save the settings in a .vcf and then copy them into Avisynth, etc. What a hassle! That's one of many reasons why I don't use AvsPmod. And it won't interface with my AfterEffects editor or ColorFinessee app, either.

Here is the Blue RGB panel from a curves control making a complex blue correction. Could you make that correction in an Avisynth plugin? At the same time you'd make an opposite RGB luminance curve to correct the brightness change from adding blue in an s-curve manner. Would a curve like that work in other segments or some of your other videos? Because of the nature of this special correction, I doubt it. You would have to make diferent corrections elsewhere. How would you do that without using VirtualDub?


Since you have to set RGB color correction in the app that has the filters, you should save your denoised video as a separate file and open it later in VirtualDub for RGB correction, then save it for encoding. Also, save the YUV color and levels settings for that last step, because YUV and RGB corrections go together. Levels clipping can't be fixed in RGB after they happen, so you have to work on both together by viewing your video in VirtualDub and running a script that corrects levels and other factors while you tweak with RGB.


Attached Images
File Type: png curves filter blue adjustment.png (48.9 KB, 311 downloads)
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Line TBC with Avisynth script? jjdd Restore, Filter, Improve Quality 3 11-14-2019 01:43 AM
Avisynth can't open script? What am I doing wrong? unclescoob Restore, Filter, Improve Quality 14 03-27-2019 11:03 AM
For VHS to DVD, mask (crop) before other restore filters? Laserer Restore, Filter, Improve Quality 34 04-09-2017 09:51 PM
VHS restore filters using Avisynth and VirtualDub - advice? Zoink187 Restore, Filter, Improve Quality 13 07-24-2014 09:38 PM




 
All times are GMT -5. The time now is 02:48 AM