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.

Domains: forum.doom9.org / forum.doom9.net / forum.doom9.se

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 30th March 2021, 03:30   #41  |  Link
edwin_r
Registered User
 
Join Date: Sep 2019
Posts: 4
Dear StainlessS. Sorry to revive such an old thread. I need to ask if can you give me please an example of MCDegrain to denoising an interlaced source, but with a prefiltered clip for more reliable motion estimation. I need to make some DVD's

Thank you.
edwin_r is offline   Reply With Quote
Old 30th March 2021, 15:38   #42  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
I totally dislike Interlaced stuff and always deinterlace, others would likely be better source of advise here.
If was me, then deinterlace using least denoise (whatever args give least denoise for eg QTGMT), to doublerate.
Apply McDegrain to result and then re-interlace.

Boulder gave good args for little denoising something like this [excluding Preset, and NoisePreset,
Code:
QTGMC(Preset="Medium",NoisePreset="Faster",SourceMatch=2, Lossless=2, EZKeepGrain=0.4, Sharpness=0.1, tr2=0)  # After Presets, from Boulder
And to re-interlace its something like
Code:
Deint.SeparateFields.SelectEvery(4,0,3).Weave   # Singlerate Re-Interlacing : EDIT: BFF maybe  SelectEvery(4,1,2).Weave
__________________
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; 30th March 2021 at 15:41.
StainlessS is offline   Reply With Quote
Old 30th March 2021, 15:52   #43  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,783
There is always this old chestnut. You'll find it on the AVISynth Wiki:

ApplyInterlacedFilter

Code:
#This applies any filter to an interlaced source. The filter can be used for both spatial filters, like Blur and temporal filters like TemporalSoften. 
#Example of usage 

#AviSource("file.avi")
#ApplyInterlacedFilter(last, "blur(1.5)")


function ApplyInterlacedFilter(clip v1, string filter)
{
   v2 = separatefields(v1)
   selecteven(v2)
   even = Eval(filter)
   selectodd(v2)
   odd = Eval(filter)
   interleave(even,odd)
   return weave()
}

Last edited by johnmeyer; 30th March 2021 at 15:54. Reason: added link
johnmeyer is offline   Reply With Quote
Old 30th March 2021, 19:27   #44  |  Link
edwin_r
Registered User
 
Join Date: Sep 2019
Posts: 4
Quote:
Originally Posted by johnmeyer View Post
There is always this old chestnut. You'll find it on the AVISynth Wiki:

ApplyInterlacedFilter

Code:
#This applies any filter to an interlaced source. The filter can be used for both spatial filters, like Blur and temporal filters like TemporalSoften. 
#Example of usage 

#AviSource("file.avi")
#ApplyInterlacedFilter(last, "blur(1.5)")


function ApplyInterlacedFilter(clip v1, string filter)
{
   v2 = separatefields(v1)
   selecteven(v2)
   even = Eval(filter)
   selectodd(v2)
   odd = Eval(filter)
   interleave(even,odd)
   return weave()
}
Thanks. I tried this yesterday, but it only access internal commands. You can't cast external ones like LSF, Awarpsharp2, etc. Thank you anyway
edwin_r is offline   Reply With Quote
Old 30th March 2021, 19:32   #45  |  Link
edwin_r
Registered User
 
Join Date: Sep 2019
Posts: 4
Quote:
Originally Posted by StainlessS View Post
I totally dislike Interlaced stuff and always deinterlace, others would likely be better source of advise here.
If was me, then deinterlace using least denoise (whatever args give least denoise for eg QTGMT), to doublerate.
Apply McDegrain to result and then re-interlace.
Question: if it gets doublerated, will a temporal denoiser work fine just after that?. Thanks
edwin_r is offline   Reply With Quote
Old 30th March 2021, 20:00   #46  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
For interlaced HDTV (currently produced) I use mvtools with high enough tr :
Code:
tr=12
fields=AssumeTFF().SeparateFields()
super=MSuper(fields,pel=1)
multi_vec=MAnalyse (super, multi=true, delta=tr, overlap=4)
MDegrainN(fields,super, multi_vec, tr, thSAD=250, thSAD2=180)
Weave()
where tr - the half num of frames (fields ?) to process for each output field. The more the better noise suppression but also lower speed.

thSAD and thSAD2 - to be adjusted for the noise amount in the input. Too low do not touch noise, too high start to smooth low-contrast details. For newer HDTV cams it is about 250, for old more noisy it may be 400 and more. thSAD2 typically 1/2..2/3 of thSAD I think.

With finally coded MDegrainN() function it starts to be very good and easy to use tool.

Last edited by DTL; 30th March 2021 at 20:03.
DTL is online now   Reply With Quote
Old 30th March 2021, 20:06   #47  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
Quote:
Originally Posted by edwin_r View Post
Question: if it gets doublerated, will a temporal denoiser work fine just after that?. Thanks
I think for perfectionists it must be deinterlaced to doublerate (full frame height output) - process and re-interlace. Very slow processing. Because high-quality HDTV deinterlace is also slow. Also perfectionists-level re-interlace is also not very easy task and must be aligned with previous deinterlacing stage.

At least after non-linear deint, the process of interlacing like
Code:
SeparateFields.SelectEvery(4,0,3).Weave
Must be preceded by vertical (and possibly also some horizontal) low-pass filter. Because advanced end-only deinterlacer like QTGMC may significally changes spectrum and add new high frequency content that will cause aliasing after simple weaving (it is equal to PointResize(height/2)). And user of pointresize is responsible for spectrum-shaping (conditioning) before downscaling. And spectrum-shaping may be also motion-dependent for not blur static areas etc.

If interlaced content was conditioned by high$$$$ pro/broadcast-graded video camera it is not easy to do same quality level 'interlaced-progressive-interlaced' conversion with freeware tools.

Simple processing of separated fields as frames give acceptable result though may be a bit degrade vertical resolution.

Last edited by DTL; 30th March 2021 at 20:26.
DTL is online now   Reply With Quote
Old 30th March 2021, 20:11   #48  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 11,407
EDIT:
Quote:
Question: if it gets doublerated, will a temporal denoiser work fine just after that?. Thanks
Yes, should do.
Here latest McDegrain() on-line ver$:- https://forum.doom9.org/showthread.p...03#post1926403


Can call McDegrain(bblur=0.6) [default=0.0, as Didee original] to use same pre-filter blur as McDegrainSharp().

EDIT: If you change tm=false [truemotion], then also set Glob=true [default is currently same as tm, maybe it should always be true].

EDIT: Might also like to play with one of these experimental funcs:- https://forum.doom9.org/showthread.p...74#post1932874
__________________
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; 30th March 2021 at 21:47.
StainlessS is offline   Reply With Quote
Old 2nd April 2021, 04:16   #49  |  Link
edwin_r
Registered User
 
Join Date: Sep 2019
Posts: 4
Quote:
Originally Posted by DTL View Post
For interlaced HDTV (currently produced) I use mvtools with high enough tr :
Code:
tr=12
fields=AssumeTFF().SeparateFields()
super=MSuper(fields,pel=1)
multi_vec=MAnalyse (super, multi=true, delta=tr, overlap=4)
MDegrainN(fields,super, multi_vec, tr, thSAD=250, thSAD2=180)
Weave()
where tr - the half num of frames (fields ?) to process for each output field.
@DTL. I was looking the mvtools2 docs, and saw an example for Mdegrain in case of interlaced stuff.
Obviously, when fields=AssumeTFF().SeparateFields(), deltas becomes evens:

backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=overlap, dct=dct)
forward_vec2 = super.MAnalyse(isb = false, delta = 2, overlap=overlap, dct=dct)
backward_vec4 = super.MAnalyse(isb = true, delta = 4, overlap=overlap, dct=dct)
forward_vec4 = super.MAnalyse(isb = false, delta = 4, overlap=overlap, dct=dct)

I'm not sure if MdegrainN's delta parameter gets evens values too i have the doubt, since many scripts i've seen are not made for interlaced. Thus, i modified directly Mdegain2i2, and set
specifically those values for delta, and added a prefilter. It seems to work ok, results are better now (thsad lowered to 200, before prefilter was 300, and even denoises better)
Sorry, i didn't mention before that i don't want to deinterlace.
Now, my question is, if you have a better recomendation for a prefilter than "pre=fluxsmootht(3).removegrain(11)", (this is the example for smdegrain, but i don't use smdegrain anymore, since it stops working randomly in my system and some black blotchers appear, but classic Mdegrain works flawlessly, so i tend to prefer the original scripts)

Thank you
edwin_r is offline   Reply With Quote
Old 2nd April 2021, 08:26   #50  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
" an example for Mdegrain in case of interlaced stuff.
Obviously, when fields=AssumeTFF().SeparateFields(), deltas becomes evens:
backward_vec2 = super.MAnalyse(isb = true, delta = 2, overlap=overlap, dct=dct)"

It is old very large and not user-friendly syntax for initial degarin2/3/4/5/6 functions. Later the lovely MDegrainN function was coded finally in mvtools and you no more need to type awful number of strings for every tr-param value. Also looks MAnalyse was modified to use
multi=true
and gives required multi-frames vec data for MDegrainN.

MAnalyse->multi

When set to true, MAnalyse generates the motion vectors for all the reference frames −delta…−1 and +1…+delta. The resulting clip is made of single MAnalyse results interleaved in the delta order −1, +1, −2, +2, …, −delta, +delta, where negative values indicate backward searchs. This order is similar to the motion vector parameters in MDegrain3. The output clip is intended to be used directly in MDegrainN.

"Mdegain2i2"

tr=2 is too few for great results I think. I usually use something like 10..20+. And above script is for interlaced processing - in and out.

Last edited by DTL; 2nd April 2021 at 08:30.
DTL is online now   Reply With Quote
Old 2nd April 2021, 08:38   #51  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,083
Quote:
Originally Posted by edwin_r View Post
Obviously, when fields=AssumeTFF().SeparateFields(), deltas becomes evens .....
Maybe I am missing something, but shouldn't spatial-temporal filtering of interlaced video preferably be done on grouped even and odd fields individually, rather than just on the separated fields?
Sharc is offline   Reply With Quote
Old 2nd April 2021, 08:48   #52  |  Link
DTL
Registered User
 
Join Date: Jul 2018
Posts: 1,480
Quote:
Originally Posted by Sharc View Post
Maybe I am missing something, but shouldn't spatial-temporal filtering of interlaced video preferably be done on grouped even and odd fields individually, rather than just on the separated fields?
It may help to not degrade vertical resolution but will doubles distance to next moving block in case of moving I think. Also at time of move block may also change its content so will fall outside thSAD more quickly and will be lost from processing.

With large enough tr values it is even become visible sometime how static areas become noise-free but moving areas still noisy. Though noise at moving areas is less visible.

For photon-shot noise each doubling number of processed images lowers noise to -3 dB I think. So for visible noise level lowering if is required to double or better quadruple tr param value. So degrain 2/3/4/5/6 is too limited in processing num of frames and can provide only about -6..8 dB (about 2 times in amplitude) less noise level.

Last edited by DTL; 2nd April 2021 at 08:52.
DTL is online now   Reply With Quote
Old 2nd April 2021, 22:44   #53  |  Link
Sharc
Registered User
 
Join Date: May 2006
Posts: 4,083
Quote:
Originally Posted by DTL View Post
It may help to not degrade vertical resolution but will doubles distance to next moving block in case of moving I think. Also at time of move block may also change its content so will fall outside thSAD more quickly and will be lost from processing.

With large enough tr values it is even become visible sometime how static areas become noise-free but moving areas still noisy. Though noise at moving areas is less visible.

For photon-shot noise each doubling number of processed images lowers noise to -3 dB I think. So for visible noise level lowering if is required to double or better quadruple tr param value. So degrain 2/3/4/5/6 is too limited in processing num of frames and can provide only about -6..8 dB (about 2 times in amplitude) less noise level.
SMDegrain has an interlaced mode: SMDegrain(....,interlaced=true) which seems to do the even/odd fields grouping and supports large tr. I didn't try it out much though.
Sharc is offline   Reply With Quote
Old 7th April 2021, 18:53   #54  |  Link
hello_hello
Registered User
 
Join Date: Mar 2011
Posts: 5,062
I tried the following idea, just to see....

A = Last
B = A.Bob(0.0, 1.0)
C = B.SeparateFields()
D = C.SelectEvery(4, 0)
E = C.SelectEvery(4, 3)
F = Interleave(D, E).Weave()
return F
As best as I can tell, clips A & F above would be identical. So....


1. A low quality PAL source deinterlaced with Yadif and upscaled to 1080p for a look-see.
Yadif(Mode=1).CropResize(1920,1080, 20,0,-20,0, InDAR=20.0/11.0)



2. SMDegrain in interlaced mode, followed by the same de-interlacing and upscaling.
SMDegrain(Interlaced=true)
Yadif(Mode=1).CropResize(1920,1080, 20,0,-20,0, InDAR=20.0/11.0)



3. I was expecting this to look a fair bit better than SMDegrain in interlaced mode, but there wasn't a lot in it.
It's followed by Yadif de-interlacing and then it's upscaled again.
A = Last
B = A.Bob(0.0, 1.0).SMDegrain().ComplementParity()
C = B.SeparateFields()
D = C.SelectEvery(4, 0)
E = C.SelectEvery(4, 3)
Out = Interleave(D, E).Weave()
return Out.Yadif(Mode=1).CropResize(1920,1080, 20,0,-20,0, InDAR=20.0/11.0)



Maybe not for every frame, but I think #3 usually had a very slight edge over #2, although it doesn't seem worthwhile. I might find something more grainy later and try again.
I didn't try for perfect denoising, or even good denoising. I just wanted to see if bobbing first might make a difference.


4. While I was at it... just for fun.... bobbing with QTGMC, then re-interlacing.
A = Last
B = A.QTGMC(EzDenoise=1.5)
C = B.SeparateFields()
D = C.SelectEvery(4, 0)
E = C.SelectEvery(4, 3)
Out = Interleave(D, E).Weave()
return Out.Yadif(Mode=1).CropResize(1920,1080, 20,0,-20,0, InDAR=20.0/11.0)



5. And just because.... a progressive output from QTGMC. No need for Yadif on playback this time.
QTGMC(EzDenoise=1.5)
CropResize(1920,1080, 20,0,-20,0, InDAR=20.0/11.0)


Last edited by hello_hello; 7th April 2021 at 19:00.
hello_hello is offline   Reply With Quote
Old 8th April 2021, 11:23   #55  |  Link
lollo2
Registered User
 
lollo2's Avatar
 
Join Date: Aug 2017
Location: Italy
Posts: 147
For my scripts I follow the recommendation given here https://forum.doom9.org/showthread.php?t=86394 and experimented that the best result when applying spatio-temporal or motion compensated filters to interlaced materials is obtained after double rate deinterlacing (I reinterlace back at the end).
This example uses RemoveDirtMC, MVDegrainMulti and sharpen as filtering; since then I moved to TemporalDegrain2 and LSFmod (and lossless nnedi3(field=-2) deinterlacing), but it shoud also give an idea (over-sharpened to highlight the difference)

original s-vhs capture
https://forum.doom9.org/attachment.p...3&d=1617876847

mode A: just filtering without deinterlacing
https://forum.doom9.org/attachment.p...4&d=1617877002

mode B: SeparateFields() / SelectEven().<filtering> / SelectOdd().<filtering> / Interleave() / Weave()
https://forum.doom9.org/attachment.p...5&d=1617877091

mode C: <Bobbing deinterlacer> / <filtering> / SeparateFields() / SelectEvery(4,0,3) / Weave()

Bob version
https://forum.doom9.org/attachment.p...6&d=1617877195

QTGMC version
https://forum.doom9.org/attachment.p...7&d=1617877254
Attached Images
File Type: jpg ufo_sII2a_spot_amtv_2_cut_step3.jpg (49.9 KB, 249 views)
File Type: jpg ufo_sII2a_spot_amtv_2_cut_modeA.jpg (66.2 KB, 246 views)
File Type: jpg ufo_sII2a_spot_amtv_2_cut_modeB.jpg (69.6 KB, 247 views)
File Type: jpg ufo_sII2a_spot_amtv_2_cut_modeC_Bob.jpg (57.1 KB, 242 views)
File Type: jpg ufo_sII2a_spot_amtv_2_cut_modeC_QTGMC.jpg (68.3 KB, 249 views)

Last edited by lollo2; 8th April 2021 at 11:28.
lollo2 is offline   Reply With Quote
Old 8th April 2021, 11:31   #56  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,170
Can't access your link
kedautinh12 is offline   Reply With Quote
Old 8th April 2021, 17:03   #57  |  Link
lollo2
Registered User
 
lollo2's Avatar
 
Join Date: Aug 2017
Location: Italy
Posts: 147
Thanks for your interest. I suspect that the images are waiting admin approval, or that I did some mistake. I will wait a little bit and eventually repost...
lollo2 is offline   Reply With Quote
Old 20th July 2021, 13:33   #58  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 2,170
Quote:
Originally Posted by feisty2 View Post
theoretical quality compare of some common video denoise filters
BM4D > NLMeans > Motion Compensate > Frequency Filters (FFT/DFT..) > Bilateral > Median Filter > simple linear filters (Gaussian Filter, Wiener Filter...)
How about KNLMeanCL??? Where i get BM4D??
kedautinh12 is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 08:25.


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