Quantcast Video restoration newbie: Avisynth scripts? - digitalFAQ Forum
  #1  
04-21-2016, 02:49 AM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
I have a small sample from a 3 Hrs SP full size VHS tape recorded on a shoulder held PAL camcorder, This particular sample is from a night scene with incandescent light bulbs, I just want to get started learning to use some filters, So was wondering if someone can help me with some scripts to apply on this video clip such as chroma shifting, color correction, and so on .. for practice purposes only. If HuffYUV is not suitable for some filters I can recapture using another compressor.


Attached Files
File Type: avi Night Gathering.avi (87.73 MB, 27 downloads)
Reply With Quote
Someday, 12:01 PM
admin's Avatar
Ads / Sponsors
 
Join Date: ∞
Posts: 42
Thanks: ∞
Thanked 42 Times in 42 Posts
  #2  
04-21-2016, 07:40 AM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
Thank you for the sample. Will look into it later today.

Huffyuv is a lossless compressor/decompressor. It changes nothing in the original. It has no effect on any filters applied, because filters are applied while the video is decompressed. Therefore the filters don't know that huffyuv exists. Changes are made in decompressed video, which you can later re-compress into a new file with huffyuv or a similar lossless codec with no alteration of the changes you made.
Reply With Quote
  #3  
04-21-2016, 01:07 PM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
I read somewhere that avisynth works better with lagarith, That's why I asked that question.
Reply With Quote
  #4  
04-21-2016, 09:12 PM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
I never heard that version. If you're using Avisynth filters that only work with YV12 and output YV12, how would you recompress and save the YV12 results without another colorspace conversion? Huffyuv won't compress YV12. Lagarith will.

I did some work on your sample today but had to stop for a call from a PC repair client. Some people just don't know better than to trust the Win10 "free" upgrade. Sorry for the delay.
Reply With Quote
  #5  
04-22-2016, 02:17 AM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by sanlyn View Post
I never heard that version. If you're using Avisynth filters that only work with YV12 and output YV12, how would you recompress and save the YV12 results without another colorspace conversion? Huffyuv won't compress YV12. Lagarith will.

I did some work on your sample today but had to stop for a call from a PC repair client. Some people just don't know better than to trust the Win10 "free" upgrade. Sorry for the delay.
Tell me about it, I had that upgrade nagging window going on for months, I got fed up but I was living with it until it started upgrading on its own without my permission so I googled how to get rid of it, Now I'm living in peace.
Sorry don't mean to go off topic.
Reply With Quote
  #6  
04-22-2016, 09:03 AM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
Uh-oh, another long one. Information overload.

The Night Gathering.avi sample is a workable capture. There's not much noise other than the usual combing effects. Consumer cameras didn't interlace well, being designed for CRT's. There are blown out brights in overhead lamps and overly dark backlighted figures, no surprise for home shooting with no fill lights. The camera's autogain was trying to balance very dark stuff and very bright stuff -- a contrast range beyond it's means. Amateur photogs always think that what they see in the viewfinder is what they'll get. Don't we wish it were so! Not unusual. My sister is infamous for this kind of shot, and her videos drive me crazy. You can see some luma pumping as dark and bright objects enter the frame.

The head-switching noise along the bottom is hopping up and down. I suspect this is a fault of the way the tape was originally recorded. Is it being played in the original device?

No one expects bright lights to fall within the contrast range, but it looks to me that darks are being crushed. I'd suspect the Pinnacle card. Then again, there's no way a simple camera without fill lights could record much dark shadow detail. I wouldn't try to brighten the dark figures too much, just enough to get a little more detail. There's no detail down there anyway. Over brightening would simply make crushed darks look grayed out. It would also also completely wipe out the brighter scene in the background, and those bright table tops would start leaping off the screen.

One can brighten darks somewhat without blowing away midtones and brights. But the usual brightness or contrast filters can't handle it. One filter that helps smooth things out is Avisynth's HDRagc plugin. It's a decent design for this sort of thing, But like most such filters it grossly overdoes it and makes it easy to really destroy levels. Fortunately HDRagc has a lot of settings to give one some control.

Likely you don't have HDRagc, LimitedSharpenFaster, or FixVHSoversharp. I zip'd and attached them. I also zip'd VirtualDub's CamcorderColorDenoise, if you don't have it.

Color balance: it's too orange, of course. Trying to make it look like daylight would not be possible and would look unreal. Incandescent light should look warmish anyway, but not as warm as in the sample.

Here 's the script I used to make the attached mp4's:

Code:
AviSource("E:\forum\faq\Latreche34\C\Night Gathering.avi")
AssumeTFF()
SeparateFields()
HDRagc(coef_gain=1.3,corrector=0.5,protect=1)
FixVHSOversharp(20,16,12)
FixVHSOversharp(20,8,12)
Weave()

ConvertToYV12(interlaced=true)
QTGMC(preset="faster",EZDenoise=4,denoiser="dfttest",sharpness=0.8)
SMoothUV()
ColorYUV(cont_v=-50,cont_u=30)
Levels(16,1.0,255,16,240,coring=false,dither=true)
MergeChroma(awarpsharp2(depth=20))
LimitedSharpenFaster(edgemode=2)

#----- reinterlace for DVD ----
AssumeTFF().SeparateFields().SelectEvery(4,0,3).Weave()

#----- RGB32 for VirtualDub CamcorderColorDenosie and other RGB work -----*
ConvertToRGB32(interlaced=true,matrix="rec601")
Crop(12,2,-8,-10).AddBorders(10,6,10,6)
return last
Avisynth scripts work line by line in the sequence entered, each line feeding its output to the next. Taking the script line by line:

AviSource("E:\forum\faq\Latreche34\C\Night Gathering.avi"). This opens the video and audio for decrompression and processing. In the parentheses you see the path to the file's location in my system. Change the path statement to the file's location on your PC.

AssumeTFF() tells Avisynth to assume top field first interlacing (TFF) during this script. Avisynth's default is BFF, which you don't want for this video. Using the wrong field order causes irreparable damage.

SeparateFields(). AVisynth will separate interlaced fields by top-field (even numbered) scanlines and bottom field (odd-numbered) scanlines, making a new video whose frames are 720x288, or half the height of the original frames. The reason for doing this this is that the next couple of filters insist on using either progressive video or separated fields. The number of images in the video and the frame rate are doubled. We'll re-weave the fields into full-sized interlaced frames later.

HDRagc(coef_gain=1.3,corrector=0.5,protect=1). HDRagc is set to increase saturation in the brightened areas (the coef_gain setting). corrector=0.5 lowers brightening power to avoid burning up everything in sight. protect=1 turns on highlight protection. This plugin works in YUY2 and YV12. The input video is already YUY2.

FixVHSOversharp(20,16,12)
FixVHSOversharp(20,8,12)
. This filter is called twice. The documentation for the plugin explains the settings. Basically the first settings are for a relative wide, whitish over sharpening edge halo. The second pass tweaks the narrow leftovers from the first first pass. Make these settings too high and the filter will soften every bright edge object in sight, which is not good. The filter works in YUY2 only.

Weave(). This Avisynth function re-weaves the separated top and bottom fields into fully interlaced frames.

ConvertToYV12(interlaced=true). Avisynth does pretty clean conversions but you have to be specific about factors like interlaced or progressive to prevent making a mess of chroma pixels and field arrangements. The filters that follow this line of code use YV12 only. Going from YUY2 to YV12 isn't a big problem (when it's necessary), but repeated conversion will take a toll from digital rounding. One thing to be sparing about is YV12-to-RGB-and-back. Avisynth has some clever ways of handling that too without creating disasters.

QTGMC(preset="faster",EZDenoise=4,denoiser="dfttes t",sharpness=0.8). This plugin deinterlaces, not just separating fields but interpolating fields into full sized frames. On the way it does some cleanup to make the new frames look as nice as possible. QTGMC has dozens of adjustments for cleanup, motion interpolation, and some denoising. Most people use pre-designed presets. The default preset is "slow", which can sometimes look overly filtered depending on the video. The preset known as "faster" doesn't cleanup as much as slower ones. The AVI sample has noise in underexposed shadows, so EZDenoise is activated and set to a moderate 4. Denoiser="dfttest" specifies the denoiser, which is also a plugin in its own right. Sharpness=0.8 reduces sharpening to prevent the return of halos.

SmoothUV() is a chroma smoother for things like color blotches and stains. There's a green stain on the right border, and it's very persistent. SmoothUV reduces its intensity. Later, CamcorderColorDenoise will target the stain again. It won't disappear entirely, but it's reduced so that most viewers won't notice.

ColorYUV(cont_v=-50,cont_u=30). The "Cont" values stand for "contrast". The negative value in cont_v=-50 reduces the hot red saturation by lowering contrast in the "V" channel. cont_u=30 is a positive value that increases blue saturation a bit in the U channel.

Levels(16,1.0,255,16,240,coring=false,dither=true) is used to tame one of HDRagc's faults by which it often makes "hot" brights. The first 5 numbers must be stated in the positions shown. The numbers indicate luma values in the following sequence: dark value input (set to 16), gamma (at 1.0, which is the default), bright values input (255). Then the dark values target output level (16, which equals same as the dark value target input, so no change on output). Last is the bright values desired output (240, which is lower than the 255 bright input, so this statement slightly lowers 255 brights to RGB 240 to prevent more clipping). Coring=false disables the coring function which hard clips anything lower than RGB 16 or higher than RGB 255. Dither=true uses dithering algorithms to avoid sharp edges in hue or luma transitions in areas such as flat gradients -- for example, the smooth walls in the sample.

MergeChroma(awarpsharp2(depth=20)). MergeChroma takes the results of the operation in the parentheses and merges only the chroma results with the luma from the existing video. The operation performed is aWarpSharp2. Long story on this one, but the whole line is designed to sharpen chroma at edges to repair blurry edge colors (bleeding).

LimitedSharpenFaster(edgemode=2). A sharpener, obviously. QTGMC uses LSFMod for sharpening, but before there was LSFMod there was LimitedSharpenFaster, which is where the "LSF" name came from. I think LSFMod looks a bit plastic in many videos. Both sharpeners are "limited" in that they attempt to avoid over sharpening halos. I think the older "limited" looks cleaner. edgemode=2 sharpens everything except edges. Edge sharpening in the sample wouldn't look so great.

AssumeTFF().SeparateFields().SelectEvery(4,0,3).We ave() reinterlaces the deinterlkaced video. There are four functions, each separated by periods. Each deinterlaced frame is separated into a top and bottom field, which are actually identical. SelectEvery(4,0,3) takes groups of 4 fields, and from each group chooses the first and last field (field numbers, like frame numbers, start at 0). Then it weaves those fields together as interlaced frames.

ConvertToRGB32(interlaced=true,matrix="rec601") converts the results from YV12 to RGB32 for Virtualdub processing. The video is now interlaced (an important difference in the conversion). The color matrix specified is the standard definition matrix known as "Rec601". HD uses Rec709.

Crop(12,2,-8,-10).AddBorders(10,6,10,6). Most folks already know what Crop() means. The number sequence starts from nthe lkeft border and goes clockwise around the frame. So the numbers crop pixels off the left, top, right, and bottom. Each colorspace and field/frame structure has special rules for cropping. One safe rule is to stick with even numbers. The Crop() function here cuts only unwanted border stuff, not image parts. The image stays the same, while bottom border noise and the half-line top border are removed. You want to restore the frame size without changing the image or its aspect ratio. So we use AddBorders() to add black pixels to the left, top, right, and bottom, also centering the image.

return last outputs the results of the "last" line that was executed, which is the Crop/AddBorders statement.

When VirtuaLDub was displaying the script's output I added CamcorderColorDenoise to apply to the output. The strength setting I used was 42. The video enters VDub as RGB, You can save it that way, but for output I set color depth to YV12 and compression to Lagarith. YV12 will be used by the encoder. Some encoder apps convert from other colorspaces to YV12, some will accept only YUV input.

This script processed at an average 4.5 fps. QTGMC and FixVHSoversharp were the main slowdowns and ran about average. With less filtering, QTGMC at "faster" preset runs about 12 to 15 fps on my Intel Pc.

The attached mp4 is the result. I've also attached a .zip containing the following:
- Avisynth's FixVHSOversharp, with docs.
- Avisynth's HDRAGC, with docs.
- Avisynth's LimitedSharpenFaster, with docs.
- Avisynth's older MaskTools v1.5.1, used by LimitedSharpenFaster. The filter uses both the old v.1 and newer v.2 versions of MaskTools. You can have the old and new .dll's in your plugins folder at the same time. They have different file names, and internally they have different function names, so there won't be a conflict.
- CamcorderColorDenoise v.1.6-MT for Virtualdub (ccd_sse2.vdf).


Attached Files
File Type: zip Project plugins.zip (257.3 KB, 32 downloads)
File Type: mp4 Night_Gathering_576i.mp4 (7.42 MB, 31 downloads)
Reply With Quote
The following users thank sanlyn for this useful post: bilbofett (04-22-2016)
  #7  
04-22-2016, 09:08 AM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
The two attached mp4's show some variations in processing and encoding.

Night_Gathering_576p.mp4 is brighter version of the video. I didn't care for this, mainly because making the darks brighter doesn't add any more detail to the crushed darks, and because brightening revealed how much noise and discoloration is found in crushed or clipped areas. The dark "detail" isn't smooth. It's clumpy and murky with coarse grain in areas that should look smooth. You can smooth it (more filtering, of course) but it still won't look very clean or natural. There's also some flicker at the top of the frame where HDRAG is trying to copewith the uma pumping from the camera. It's exaggerated by the brightening. To some extent It can be seen in the original if you watch it closely.

The brighter mp4 used the same script as above, but one HDRAGC setting was changed. This line:

Code:
HDRagc(coef_gain=1.3,corrector=0.5,protect=1)
was changed to this, with a higher value for corrector:

Code:
HDRagc(coef_gain=1.3,corrector=0.9,protect=1)
Night_Gathering_576p.mp4 is a non-interlaced progressive version of the same video, running at 50 fps. You can't use it for DVD, but the mp4 is suitable for play from a flash drive or external hard drive on BluRay or external media players, and for the internet. The progressive video was created by removing the line in the script that re-interlaces the video.


Attached Files
File Type: mp4 Night_Gathering_Brighter.mp4 (7.40 MB, 11 downloads)
File Type: mp4 Night_Gathering_576p.mp4 (7.42 MB, 12 downloads)

Last edited by sanlyn; 04-22-2016 at 09:18 AM.
Reply With Quote
  #8  
04-22-2016, 09:57 AM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
Thanks man for the detailed analysis, The tape is original but it is being played by JVC HR-S7600AM with TBC ON, So the Weave() filter is what you used to remove the chroma shift and right side vertical stripe as seen in the attached screenshot? Thanks again, Looking forward to experiment with those filters:


Attached Images
File Type: png vlcsnap-2016-04-22-07h47m23s339.png (580.6 KB, 8 downloads)

Last edited by latreche34; 04-22-2016 at 10:15 AM.
Reply With Quote
  #9  
04-22-2016, 01:32 PM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
Quote:
Originally Posted by latreche34 View Post
So the Weave() filter is what you used to remove the chroma shift and right side vertical stripe as seen in the attached screenshot?
Weave() just interleaves separated fields back into full interlaced frames. It doesn't clean up anything. The filters don't work with interlaced video, so the fields are separated into half-sized frames for those cleaners. The separated fields have to be interleaved ("weaved") to restore the original interlaced frames frames.

interleaved means that the lines in the two interlaced frames will alternate vertically in the frames. For Top Field First, the top line (line 0) is at the top of the frame. The next line below it (line 1) is part of the 2nd image in the frame. The next line (line 2) follows, then line 3, and so on. The interleaving is why you see combing effects when the video isn't deinterlaced during play or in an editor.

The lines are also classed as even and odd. The even lines are 0, 2, 4, 6, 8, and so on. The odd lines are 1, 3, 5, 7, etc. If an interlaced frame is 720x576, The fields are separated into two images that are half-height, or 720x288 each. This separation makes a filter think the video is progressive. To restore interlacing, weave() reassembles the original fields in the same arrangement they had originally.

SeparateFields() is often used instead of full deinterlacing. Some filters work OK with separated fields, some are better with deinterlaced.

This morning I noticed some flutter at the top of all the samples, including the original. Haven't yet figured out what's happening there, but it's related to the way the top border in the original flutters as well. I'll have to look at that later. The tape is not playing smoothly.

Original frame 115, 720x576 interlaced:


frame 115, SeparateFields() = two 720x288 images:


Attached Images
File Type: jpg frame 115 interlaced.jpg (38.0 KB, 121 downloads)
File Type: jpg f115 Separated Fields.jpg (44.6 KB, 120 downloads)
Reply With Quote
  #10  
04-22-2016, 09:29 PM
bilbofett bilbofett is offline
Premium Member
 
Join Date: Mar 2016
Posts: 50
Thanks: 77
Thanked 0 Times in 0 Posts
just going to butt into this thread and mention that sanylyn's help/assistance/support is f***ing phenomenal. Just amazing.
We all really appreciate you man!
10,000000000 thanks!
http://i.imgur.com/3uBAmH0.jpg


Attached Images
File Type: jpg ih5.jpg (26.9 KB, 7 downloads)

Last edited by bilbofett; 04-22-2016 at 09:32 PM. Reason: pizza
Reply With Quote
  #11  
04-22-2016, 10:45 PM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
@bilbofett, thanks for the high five. Makes me feel over rated next to the other members here that I learned from. Wonder where they've been lately??? Maybe they worse themselves out.

@latreche34, I forgot about a little trick with QTGMC concerning fluttery borders. One of many parameters available is the "border" value (must be true or false), which when turned on treats border areas a little differently than other areas during resize. By default the more complicated border handling is turned off. Setting it to true turns it on, even if does slow things a bit. If you can notice a processing speed difference, let us know. No one else can tell the difference.

To turn on special border handling, change this line in the original script:
Code:
QTGMC(preset="faster",EZDenoise=4,denoiser="dfttest",sharpness=0.8)
To this:
Code:
QTGMC(preset="faster",EZDenoise=4,denoiser="dfttest",sharpness=0.8,border=true)
That trick isn't a big secret. It's documented in several places.

Let us know if you get any Avisynth errors. If you do, post the error's wording because there are literally thousands of possible errors. When running a script some error messages come from Avisynth, some from VDub, others from Windows.
Reply With Quote
  #12  
04-22-2016, 11:29 PM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by bilbofett View Post
just going to butt into this thread and mention that sanylyn's help/assistance/support is f***ing phenomenal. Just amazing.
We all really appreciate you man!
10,000000000 thanks!
http://i.imgur.com/3uBAmH0.jpg
Not many like him are around anymore.
Reply With Quote
  #13  
04-22-2016, 11:34 PM
latreche34 latreche34 is offline
Free Member
 
Join Date: Dec 2015
Posts: 131
Thanks: 0
Thanked 12 Times in 12 Posts
Quote:
Originally Posted by sanlyn View Post
latreche34, I forgot about a little trick with QTGMC concerning fluttery borders. One of many parameters available is the "border" value (must be true or false), which when turned on treats border areas a little differently than other areas during resize. By default the more complicated border handling is turned off. Setting it to true turns it on, even if does slow things a bit. If you can notice a processing speed difference, let us know. No one else can tell the difference.
Thanks Sanlyn, I will not be doing all the filters at least for now, I will be going nuts, It takes a skilled person like yourself, I would like to know however how to do some corrections to the chroma layer as well as experimenting with some de-interlacing to see how it looks in the modern media players. I will go thru your posts again to pick some filters and report any errors.

One more question; When I load a script file into Vdub should I just click on save as AVI to start the process ?

Last edited by latreche34; 04-22-2016 at 11:58 PM.
Reply With Quote
  #14  
04-23-2016, 12:11 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 5,657
Thanks: 532
Thanked 808 Times in 727 Posts
Because VHS chroma smears (4:2:2, and not 4:4:4), sometimes offset can't be fixed. What I see in this clip is a mild 1-2px left offset, but it's not static (all over frame). So I'd leave offset alone.

I see almost no chroma noise here. PAL doesn't suffer as much as NTSC here.

At most, I'd use the CCD filter in VirtualDub, which can help with the issues that I do see.

The main issues are:
- jitter about 2/3rds through the clip, several times
- dark video in need of gamma recovery

The jitter issue can be caused by JVC TBCs. Or it could be the tape. Both are possible.

@sanlyn:
- Combing isn't noise. Combing is combing (interlace).
- You didn't remove the jitter. All you did was cover up the overscan, making it harder to correct jitter later. For that, it needs QTGMC deinterlace and a stab() or stabmod(). But I think the VCR is at fault.
- Never used HDRagc. Interesting. It's always neat to compare scripts.

Want to see Mercalli in action? I actually could not get a quality stabilize with Avisynth here. See my attached.

Where is everybody, you ask? Well, I'm still recovering from 2012. Part of my day, every day, is still to that end. That's often where I am. For example, this week, I finally was able to jog for a short burst, but hurt my foot doing so. I may have given myself a stress fracture, as my body isn't used to that anymore. If it still bother me Monday, I've got to get a x-ray. Two steps forward, one step back. But it's still slow progress. I post online, mostly here at digitalFAQ, when I can.


Attached Files
File Type: mp4 test NG1.mp4 (23.54 MB, 11 downloads)

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
  #15  
04-23-2016, 12:34 AM
bilbofett bilbofett is offline
Premium Member
 
Join Date: Mar 2016
Posts: 50
Thanks: 77
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by lordsmurf View Post
I finally was able to jog for a short burst, but hurt my foot doing so.
lordsmurf, what do you think about swimming? I think it's the Lord's exercise
Awesome cardio, 99.9% zero-impact, you work muscles you don't normally work anywhere else, great on the back, neck, can't really damage the foot further (I guess unless you slipped or twisted getting into the pool?)

I enjoy running. I had an injury awhile back that really jacked me up, sleep messed up, breathing, gained weight.. I tried light jogging, couldn't do it. But I started swimming, got better and better at that, got my strength and endurance back, did light weights on the machines, and eventually worked my way back to jogging, now running.

Also, re: jogging/running, I heard concrete is the absolute worst, wood/basketball type floors is a little better, but grass is the absolute best. Not sure about sand/the beach, I think its comparable to grass. Think of grass like S-VHS, and concrete as composite And if you can swing barefoot, or those fivefinger shoes (Vibram), even better (provided there's no severe ankle/foot/toe issues already, which you said there now is).

Just some thoughts. If none of this is new, then disregard of course. And if your doc tells me to jump in a lake, remind him this was on a video editors forum
Reply With Quote
  #16  
04-23-2016, 12:42 AM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 5,657
Thanks: 532
Thanked 808 Times in 727 Posts
Quote:
Originally Posted by bilbofett View Post
lordsmurf, what do you think about swimming? I think it's the Lord's exercise
The purpose is to learn to run again, not exercise. I forgot how to run. That sounds stupid, yes, but my body lost all coordination. I was halfway run-jogging outside, on the grass, chasing a stray cat out of the yard. It just means that I've got to sit/lay for a while. So time to watch TV + sit at a computer more. (Of course, even sitting for too long hurts my legs and back.) I'm all kinds of screwed up. Time heals, so it's a good things that I'm patient.

Video taught me patience. Nothing goes quickly.

I don't want to derail the topic too much.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
The following users thank lordsmurf for this useful post: bilbofett (04-23-2016)
  #17  
04-23-2016, 12:48 AM
bilbofett bilbofett is offline
Premium Member
 
Join Date: Mar 2016
Posts: 50
Thanks: 77
Thanked 0 Times in 0 Posts
This site needs a chatroom!
Ok, lordsmurf, I've got a prescription for you:

1) Run on grass
2) Run on grass and chase dumb cats (or get a well-trained dog to do it automated for you! like a TBC!)
3) Design avisynth filters for bilbofett to use
4) Repeat

j/k

I used to be quite a good dancer..I think my accident did something to my balance/coordination.

I really wish you the best and believe in your progress. Good for you for persisting. It sounds like you are doing great so far!
Reply With Quote
  #18  
04-23-2016, 01:11 PM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
Thanks for the input and mp4 sample, LS.

I wouldn't know of a stabilizer that won't have fits with the top and bottom of the sample. Most of the time I use one to correct a frame hop or two, or projector jitter that shows up in some movies. But those are moderate corrections, just a few pixels. Moving 24 pixels around cuts deep into the image. Most people crop off the new black borders and then resize to fill the frame, which has a quality cost. Filling the frame IMO doesn't make that much sense, as most TV's still have overscan and will mask parts of the resized image during TV viewing.

Quote:
Originally Posted by lordsmurf View Post
@sanlyn:
- Combing isn't noise. Combing is combing (interlace).
Correct, as usual. My target was some ragged edges and aliasing seen in the table at the lower right, both common with consumer cameras. The worst of it could be fixed but would destroy too much otherwise. Hardly any of it is visible in the progressive version.

Quote:
Originally Posted by lordsmurf View Post
- You didn't remove the jitter. All you did was cover up the overscan, making it harder to correct jitter later. For that, it needs QTGMC deinterlace and a stab() or stabmod(). But I think the VCR is at fault.
Not sure what you mran there. Stab won't correct it, top and bottom junk just shows up lower in the frame. What I did was crop 10 pixels off the bottom (headswitching noise) and 2 off the top (the 2 broken top border lines). Then I added 6 pixels each to top and bottom to vertically center the image. Even at that, I had to turn on the borders param in QTGMC to stop top flutter altogether. But you're right in that stabilizers will have problems with those borders.

Agreed, it looks as if the tape isn't playing properly. Either that, or the tape was misaligned during the original shoot. Jitter isn't just at the top and bottom, either. I could think of ways around tricky stabilizing, but it would take me all day to explain it and a day to do it. I don't think the results would be worth it. In any case you'd lose image parts on all sides.

Quote:
Originally Posted by lordsmurf View Post
- Never used HDRagc.
Filters like HDRagc are last-ditch efforts. I don't think it helped here. The original looks dark on a PC but will look brighter on TV. Other auto filters do too much luma pumping, which would be a shame because there's very little of that in the sample. Those "auto" filters are dangerous. At least HDRagc has a lot of controls, but you still have to use care. Over the years I used it maybe 3 times, tops. I used in an earlier post, with before/after demos: Encoding from Huffyuv?. Would be nice if my sister's camera battery hadn't started dying during the shoot. Most of the rest of that home video didn't need much fixing.

Quote:
Originally Posted by lordsmurf View Post
- dark video in need of gamma recovery
It sure does. HDRagc does that and so does AutoAdjust. But I'd caution latreche34: Those filters make it too easy to wreck levels. They're rarely needed. They usually do exactly what you don't want. There are cleaner and better ways to do it manually or during capture.

@latreche34:
I don't think any auto filter or even a contrast mask (which I tried) would help here. Darks are crushed, so there's really no detail down there that anything could retrieve. Crushed is another word for destroyed. You can't retrieve something that no longer exists.

The attached mp4 video shows the original, unaltered interlaced sample with a YUV levels histogram attached to the right of the image. That mp4 plays square-pixel in a 976x576 frame, so it won't play at 4:3. In the histogram you'll see that data never goes into the left zone below RGB 16. That's OK, but not if the data starts crowding into peaks at the left and climbs up the wall, indicating cut-off darks. There is also what appears to be mild clipping at the bright end, too, so you might lower a contrast a little and see if you can save any highlights. You can always tweak the image later, which you'll do anyway.

You might encounter more videos like this, especially with home cameras. In this case I'd suggest that you recapture this, if only for those segments that have this problem. Something is crushing darks. I think your Pinnacle is the culprit. You can get around that by adjusting brightness and contrast during capture. Don't use anything in VirtualDub's "filter stream..." menu. Any filter you enter there would be unsuitable. Rather, use your capture driver's proc amp controls by looking in VDub capture's "Levels..." menu. You should find at least a brightness and contrast control, which are all you'll need.

Contrary to what you'd think, "Brightness" controls black levels. "Contrast" controls brights. To some extent they interact, so you have to fiddle a bit but you'll soon get the idea. Instead of trusting your eyes on this, especially with an uncalibrated monitor, use VirtualDub's capture histogram. The histogram is available only in Preview mode. At the bottom of the capture window it looks like this:



Data in the unsafe "red" zones is in the crushing/clipping sector (darks on the left side, brights on the right). While the tape plays you adjust brightness and contrast so that as little as possible can overrun into the red sectors. Levels will change during play, but play just a few minutes to get an idea of how much they change. The area between the red zones indicates the video range RGB 16-235.

NOTE: black borders and head switching noise affect the histogram and can be deceptive. Black borders will always be a red "spike" at the left end. While you test levels, activate VDub capture's "Crop" menu. Use the little x and y inputs to crop off black borders and head switching noise while you view the histogram. When you get the levels you want inside the safe area, TURN OFF cropping. You can do that only by setting all crop values to zero again. Just clicking the crop menu item won't turn it off.

Don't forget to turn off cropping. I forgot it once and captured 90 minutes at the wrong frame size, making the whole capture useless.


Turn off the histogram before you begin capture. Some darks might look a bit bright but that's easily fixed afterwards and better than losing them. If your capture card is crushing everything below RGB 16, this is one way to fool the damn thing -- just don't feed it video darker than RGB 16, which would be in the "red" area on the left. Even with a card that doesn't crush anything (my AIW's don't), you would still have to play tricks to clean up out-of-range data.

Vdub capture's "Video" menu also has items named "extend luma white point" and "extend luma black point. Please don't turn on those items. Not ever.


Attached Images
File Type: png Capture histogram.png (24.2 KB, 125 downloads)
Attached Files
File Type: mp4 Gathering_Original_YUV.mp4 (6.23 MB, 2 downloads)
Reply With Quote
  #19  
04-23-2016, 01:22 PM
sanlyn sanlyn is online now
Premium Member
 
Join Date: Aug 2009
Location: Tennessee and NY, US
Posts: 1,756
Thanks: 54
Thanked 516 Times in 474 Posts
Quote:
Originally Posted by latreche34 View Post
Thanks Sanlyn, I will not be doing all the filters at least for now, I will be going nuts, It takes a skilled person like yourself, I would like to know however how to do some corrections to the chroma layer as well as experimenting with some de-interlacing to see how it looks in the modern media players.
You'll be a skilled person, too, if you use this stuff. Read up on its docs, yes, but you won't understand much without use.

First, deinterlacing: You can make deinterlacing look pretty good, and sometimes it can look "better" if there are noise problems, but there's always a cost. As for modern players, they deinterlace on the fly just like older players do. The 576p progressive video doesn't show many of the effects of sloppy interlacing in the original, but keep your desired final format in mind. 50fps can't be used for DVD, standard definition BluRay/AVCHD, or several HD formats. And those formats are either interlaced or telecined, or inverse-telecined to run at film speeds. Some people think they'll get a nice 25 fps by deinterlacing and discarding alternate frames. It destroys half the motion resolution, so movement never looks as smooth especially during horizontal motion, and often displays as judder in both directions. Interlaced video and motion still look cleaner on CRT's.

Color correction is a skill, too. It can be very simple or it can be a hassle, depending. You have to develop an eye for color problems, then get into color theory on how to correct them. I learned by watching others and by browsing color correction tutorials and videos for Photoshop and AfterEffects.

Look at the reduced image below (i no longer have the original video). It has one major color problem and several minor but very visible ones. If you think HD always look great by default, this frame is from an HD video recorded off cable TV and reprocessed by the user.



By looking at that image, can you tell what's wrong? Color aside, the original video has a very low bitrate and lacks some fine detail. A friend of mine who taught me about color correction reworked this frame. He used Avisynth for fixing basic levels, then Virtualdub's ColorMill, curves, and histograms. There's still some edge defects from previous processing, and camera panning blurs the background. But he got the color result below. I knew what was wrong and replicated his results myself:



Besides what one's eyesight can see about what's amiss, a histogram and pixel value readings off the image showed what was wrong and how to fix it. By color theory I don't mean you need a UCLA Fine Arts degree. If from color theory you know that the color white (better known as a hue, and hues include black) and all hues from mild whites to very bright white contain equal proportions of red, blue, and green, you'd know what's wrong with many colors in the image.

Color correction can be learned, just like all the other stuff. But even color by itself would take a very very very long thread. You can get there, but in stages.

Quote:
Originally Posted by latreche34 View Post
One more question; When I load a script file into Vdub should I just click on save as AVI to start the process?
"Save As Avi" generates a new video file. The playback and frame advanced buttons don't make a new video, they just cruise through whatever Avisynth is sending. With slow filters, playing it won't be fast. To save your processing, you have to save a new Avi.

If you're not using VirtualDub filters on your output, check your output color depth and compression settings, and use "fast recompress" mode to prevent an unwanted RGB conversion. If you want Virtualdub filters appied, you have to use "full processing mode". In that mode, you have to check your colorspace and compressor settings anyway -- VirtualDub's default output is uncompressed RGB.


Attached Images
File Type: jpg SBS 19051 original.jpg (23.4 KB, 108 downloads)
File Type: jpg SBS 19051.jpg (40.6 KB, 106 downloads)
Reply With Quote
  #20  
04-23-2016, 06:51 PM
lordsmurf's Avatar
lordsmurf lordsmurf is offline
Site Staff | Video
 
Join Date: Dec 2002
Posts: 5,657
Thanks: 532
Thanked 808 Times in 727 Posts
Quote:
Originally Posted by sanlyn View Post
TMoving 24 pixels around cuts deep into the image. Most people crop off the new black borders and then resize to fill the frame, which has a quality cost. Filling the frame IMO doesn't make that much sense, as most TV's still have overscan and will mask parts of the resized image during TV viewing.
Remember: Restoration = makes it better, not make it perfect. You often trade a worse error from a newer lesser error.

In this case, you have two options:
- cropped many pixels on all sides, enjoyable middle
- non-cropped and seasick

My preference is the first. My eyeballs will thank me.

- Did my advice help you? Then become a Premium Member and support this site.
- Find television shows, cartoons, DVDs and Blu-ray releases at the TVPast forums.
Reply With Quote
Reply




Similar Threads
Thread Thread Starter Forum Replies Last Post
Improving Video Quality of old VHS for Newbie AfxTwn Restore, Filter, Improve Quality 2 04-22-2013 03:34 AM
Various AVISynth scripts to clean noise and convert PAL to NTSC metaleonid Restore, Filter, Improve Quality 12 01-09-2012 07:49 PM
PAL/NTSC Conversion Guide updates + de-blur restoration (add Avisynth use) admin Restore, Filter, Improve Quality 2 02-19-2011 11:42 AM
AVISynthesizer: Build complete Avisynth scripts using pre-made templates [DOWNLOAD] lordsmurf Encode, Convert for discs 0 11-09-2010 01:13 AM

Thread Tools



 
All times are GMT -5. The time now is 05:37 AM  —  vBulletin Copyright Jelsoft Enterprises Ltd