Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion.

Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread Display Modes
Old 12th November 2022, 18:17   #21  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
I'm glad you like it and improved the overall speed. Here's a more tweaked script, I got rid of the superfluous denoising step and other things like use NNEDI3CL and neo_fft3d. I also incorporated the upscale, I used NNEDI3CL for that, not SuperRes (didn't check the differences) but the source has very low detail so I don't think the difference will be night and day. z_ConvertFormat resizes to the final size, converts it to YUV420, corrects the shift caused by NNEDI3 upscaling and also changes the Colorimetry all in one go . Script now also needs LSFplus.

I don't know the quality of your other tapes but this one here works well for low quality VHS with chroma bands and very noisy. Definitely overkill for higher quality footage. Enjoy, and if you come across another hard to denoise clip, please share

Code:
FFVideoSource("tape 37-trim.mkv")
Crop(8,0,-6,-16)
ConvertBits(10)
Levels(20, 1, 1045, 0, 1023, coring=false, dither=true)
Tweak(hue=-3, coring=false, dither=true)
ConvertBits(8)
src = last
NNEDI3CL(3)
o = last

mds().Spline36Resize(o.width(),o.height()/2/4*4)
mds().Spline36Resize(o.width(),o.height()/6/4*4)
mds().Spline36Resize(o.width(),o.height())

o.MergeChroma(last)
nostripes2 = last.MinBlur(1).LSFplus(ss_x=1.0, ss_y=1.0, strength=100, soft=100, overshoot=5)
srchbase   = neo_fft3d(nostripes2,sigma=6, sigma2=4, sigma3=3, sigma4=2, bt=5, bw=16, bh=16, ow=8, oh=8).FluxSmoothT()
pre        = MergeLuma(srchbase, o, weight=.25) 

QTGMCp(src, EdiExt=pre)

NNEDI3CL(1, dh=true, dw=true)
NNEDI3CL(1, dh=true, dw=true)
NNEDI3CL(1, dh=true, dw=true)

z_ConvertFormat(2880, 2160, pixel_type="YV12", colorspace_op="470bg:601:170m:full=>709:709:709:full", \ 
                resample_filter="bicubic", filter_param_a=-0.5, filter_param_b=0.25, src_left=-3.5, src_top=-3.5)



# helper function: vertical-only MinBlur with vertical radius 2

function mds(clip clp)
{
a  = clp.mt_luts(clp,mode="median",pixels="0 -2 0 -1 0 0 0 1 0 2",Y=2,U=3,V=3)
b  = clp.mt_convolution("0 1 0","1 2 1",y=2,U=3,V=3).mt_convolution("0 1 0","1 2 1",Y=2,U=3,V=3)
aD = mt_makediff(clp,a,Y=2,U=3,V=3)
bD = mt_makediff(clp,b,Y=2,U=3,V=3)
DD = mt_lutxy(aD,bD,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",Y=2,U=3,V=3)
clp.mt_makediff(DD,Y=2,U=3,V=3)
return(last)
}
Reel.Deel is offline   Reply With Quote
Old 12th November 2022, 18:24   #22  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RD,
Not sure of your intent there, but
mds().Spline36Resize(o.width(),o.height()/2/4*4)
is same as
mds().Spline36Resize(o.width(),o.height()/2)

as intended ?

maybe something like
mds().Spline36Resize(o.width(),Round(o.height()/2.0/4.0)*4)
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 12th November 2022, 18:31   #23  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
StainlessS, it's a copypasta from a script from Didée, I didn't dare to challenge his logic

Edit: to below - Round() would work, the script is meant for progressive video so mod2 should be enough.

Last edited by Reel.Deel; 12th November 2022 at 19:21.
Reel.Deel is offline   Reply With Quote
Old 12th November 2022, 18:34   #24  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
I bet it should have been as suggested (or eg Int() instead of round), same for the 6/4/4.

EDIT: Whether or not you should use Round() or Int(), it is intended that result height should be mod4. [suggest Round()]
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 12th November 2022 at 18:43.
StainlessS is offline   Reply With Quote
Old 12th November 2022, 19:46   #25  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
Quote:
Edit: to below - Round() would work, the script is meant for progressive video so mod2 should be enough.
This lot would seem to require reduction to 1/2 size (mod4),
and then to reduction to 1/6 size (mod4).
Then resize back to original height.
So downsize to 1/12 height, then back up.
I imagine that the big DD had reason for double downsize, and maybe even the modulo stuff between and ending.
(dont think anything to do with Progressive/Interlaced)
Code:
mds().Spline36Resize(o.width(),o.height()/2/4*4)  # /2
mds().Spline36Resize(o.width(),o.height()/6/4*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())        # back to original
EDIT:
so maybe
Code:
mds().Spline36Resize(o.width(),Round(o.height()/2.0/4)*4)  # /2
mds().Spline36Resize(o.width(),Round(o.height()/6.0/4)*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())                 # back to original
EDIT: And instead of Int() if required, just divide by int instead of float
Code:
mds().Spline36Resize(o.width(),(o.height()/2/4)*4)  # /2
mds().Spline36Resize(o.width(),(o.height()/6/4)*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())          # back to original
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 12th November 2022 at 20:02.
StainlessS is offline   Reply With Quote
Old 12th November 2022, 20:21   #26  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
Quote:
Originally Posted by StainlessS View Post
This lot would seem to require reduction to 1/2 size (mod4),
and then to reduction to 1/6 size (mod4).
Then resize back to original height.
So downsize to 1/12 height, then back up.
I imagine that the big DD had reason for double downsize, and maybe even the modulo stuff between and ending.
(dont think anything to do with Progressive/Interlaced)
Code:
mds().Spline36Resize(o.width(),o.height()/2/4*4)  # /2
mds().Spline36Resize(o.width(),o.height()/6/4*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())        # back to original
EDIT:
so maybe
Code:
mds().Spline36Resize(o.width(),Round(o.height()/2.0/4)*4)  # /2
mds().Spline36Resize(o.width(),Round(o.height()/6.0/4)*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())                 # back to original
EDIT: And instead of Int() if required, just divide by int instead of float
Code:
mds().Spline36Resize(o.width(),(o.height()/2/4)*4)  # /2
mds().Spline36Resize(o.width(),(o.height()/6/4)*4)  # /6 : total /12
mds().Spline36Resize(o.width(),o.height())          # back to original
Gotcha. If I decide to make a VHS band reducer script, I will incorporate those changes. Thanks StainlessS
Reel.Deel is offline   Reply With Quote
Old 13th November 2022, 02:29   #27  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 68
Thanks for the updated script.

I tried it on one of my typical VHS captures. VCR set to norm. Relatively low noise to begin with but I do want to slightly denoise before scaling. Not sure what I prefer.

Source:


Old script:


New script (with RF's first settings, modified)


New script #2 (with RF's second settings, modified)
]

No scaling applied yet. All look clean though. I'll send a sample once I'm off work. If only I could improve text clarity to make it on-par with the source.

Last edited by ENunn; 13th November 2022 at 02:51.
ENunn is offline   Reply With Quote
Old 13th November 2022, 17:32   #28  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
Do you have the edit switch on your VCR turned on? Those captures look pretty soft to me.

If your are unfamiliar with the edit switch, consult your VCR's manual to see the settings they recommend for dubbing to another tape deck. You want to use those settings. Turning that switch ON turns OFF the built-in noise filtering. You do NOT want the VCR to filter noise because it kills details in order to reduce all those little dots. You will never get back that detail once lost. Once you have your capture, the digital noise filters available today are 100x better than the simple analog circuits used in a VCR. The final result will be more detailed and better in every way.
johnmeyer is offline   Reply With Quote
Old 13th November 2022, 19:01   #29  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 68
Quote:
Originally Posted by johnmeyer View Post
Do you have the edit switch on your VCR turned on? Those captures look pretty soft to me.
I honestly prefer Norm over Edit. I'm not a fan of all that added noise. I find Norm to be more natural to me. I only use Edit if I use my ES15.

I'll take your word for it though :P I'll do a capture with Edit on and try it out.

Last edited by ENunn; 13th November 2022 at 19:49.
ENunn is offline   Reply With Quote
Old 13th November 2022, 20:41   #30  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
You are absolutely correct: setting that switch to Edit will make the picture noisier. If you were just watching the video on your TV, that might be what you want, but it is not what you want when digitizing video.

To convince yourself, capture a scene which has a lot of detail (leaves, grass, striped shirt, a shag rug, etc.). Do that with Edit on and then do it again with Edit off. Then do an A/B between your videos while they are running (I do this by putting them above each other in my NLE and then muting/unmuting one track). You can also look at stills captured from each. Ignore the noise, but look at the detail. You should be able to resolve more detail, and even the detail that is already there should reveal more information when Edit is on (i.e., noise reduction is turned off).

There are dozens of AVISynth plugins that can very effectively remove most of the noise without killing the detail. The VCR approach is to just apply a low pass filter which removes the noise and also the details. It has no way to "look" at pixels (because there are no pixels in analog video) and then compare those pixels from one frame to the next, something a temporal denoiser does. It is this frame-to-frame comparison that permits a digital temporal denoiser to get rids of all those dancing dots without removing detail.

BTW, a similar comment applies to removing noise with AVISynth: resist the urge to get rid of ALL the noise because if you do that, you often remove detail.

Remember, "NR" stands for noise reduction, not noise removal.
johnmeyer is offline   Reply With Quote
Old 14th November 2022, 02:43   #31  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 68
Thanks for the help John! I did my first edit mode transfer in a long time, results do look nice, albeit very noisy.

I ran the capture through the script, there's definitely a difference but I do want a little better.

Original:


RealFinder's settings (modified by me):


There's definitely a difference, but I dunno if it's on-par with what my VCR can do. At least detail isn't lost :P

When I try to modify fft3dfilter, MSuper, and mdegrain2, nothing seems to happen. I do want the noise reduced to the point that detail isn't lost.

Last edited by ENunn; 14th November 2022 at 02:46.
ENunn is offline   Reply With Quote
Old 14th November 2022, 04:19   #32  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
TemporalDegrain2 can do it but speed very slow
kedautinh12 is offline   Reply With Quote
Old 14th November 2022, 06:03   #33  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
@ENunn
Post a small sample.

I'm starting to get a little confused. I saw you wrote the name RF earlier and now RealFinder. Are you confusing me with RF?
Reel.Deel is offline   Reply With Quote
Old 14th November 2022, 06:11   #34  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,156
Maybe he think you're a copy ver of RealFinder
kedautinh12 is offline   Reply With Quote
Old 14th November 2022, 07:46   #35  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 68
Quote:
Originally Posted by kedautinh12 View Post
TemporalDegrain2 can do it but speed very slow
Yeah, I used it before I went with SMDegrain. Really slow.

Quote:
Originally Posted by Reel.Deel View Post
@ENunn
Post a small sample.
Got it.

Quote:
Originally Posted by Reel.Deel View Post
I'm starting to get a little confused. I saw you wrote the name RF earlier and now RealFinder. Are you confusing me with RF?
Yeah Little bit confusing on my part.

Quote:
Originally Posted by kedautinh12 View Post
Maybe he think you're a copy ver of RealFinder
It's true, they're the exact same person!!!!!!! It's true!!!1one
ENunn is offline   Reply With Quote
Old 15th November 2022, 00:21   #36  |  Link
Reel.Deel
Registered User
 
Join Date: Mar 2012
Location: Texas
Posts: 1,666
RF and I are most definitely not the same person lol

I took a look at your second sample, and in terms of noise it's much better than the first sample. The luma channel has much less noise and no crosshatch patterns. But the chroma is still noisy, not the same as before but enough to use the same script as post #21. I only made one change:

Code:
pre = MergeLuma(srchbase, o, weight=.75) # was .45
This way it only does a little bit of denoising on the luma channel and helps retain details.

Here are the results:Images are 2x point resampled and crop, levels, tweak, and upscaling parts of script were commented out.

By the way, I think I recognize some of those commercials. Definitely the Neutrogena one. I used to watch WGN in my younger days
Reel.Deel is offline   Reply With Quote
Old 25th November 2022, 22:17   #37  |  Link
ENunn
Registered User
 
Join Date: Dec 2019
Posts: 68
Sorry for the late response.

Quote:
Originally Posted by Reel.Deel View Post
I took a look at your second sample, and in terms of noise it's much better than the first sample. The luma channel has much less noise and no crosshatch patterns. But the chroma is still noisy, not the same as before but enough to use the same script as post #21. I only made one change:

Code:
pre = MergeLuma(srchbase, o, weight=.75) # was .45
This way it only does a little bit of denoising on the luma channel and helps retain details.

Here are the results:
Thanks for this, there's definitely a difference but I do have one issue with it. I don't know how to word it. There's a shift when there's an area of red. I think it's due to the smoothing, but I'd like to alleviate that if possible.

Original:


Script:


I posted another screenshot of the "problem", screenshot 4 on post 27.

Here's a sample.

It's probably not that big of a deal though. I just saw it and it looked a tad off to me.
ENunn is offline   Reply With Quote
Old 28th November 2022, 19:18   #38  |  Link
Emulgator
Big Bit Savings Now !
 
Emulgator's Avatar
 
Join Date: Feb 2007
Location: close to the wall
Posts: 1,545
If you consider the brighter, but narrow red stripes weighed into it seems resonable.
__________________
"To bypass shortcuts and find suffering...is called QUALity" (Die toten Augen von Friedrichshain)
"Data reduction ? Yep, Sir. We're that issue working on. Synce invntoin uf lingöage..."
Emulgator is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.