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

Reply
 
Thread Tools Search this Thread Display Modes
Old 16th October 2021, 23:47   #201  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Quote:
Originally Posted by StainlessS View Post
ScSelect always had the problem of SOS sometimes not following EOS or EOS not always before SOS, my mod does not change that.
EOS frame considers only itself and those either side, SOS frame considers only itself and those either side,
so EOS knows nothing of the frame follwing SOS and SOS knows nothing of the frame before EOS.

It aint the math, its logic that fails, ie the algorithm, but IIRC, mvTools scene change detect has exact same problem. [ie mismatched EOS / SOS detects]

ScSelect_HBD is definitely better than ScSelect, but it aint perfect by any means.

EDIT: Maybe you can make some use of the stuff here:- https://forum.doom9.org/showthread.p...85#post1954985
EndOfSceneClip() and StartOfSceneClip.
Don't worry no software is perfect, otherwise Microsoft would have went bankrupt in the last century.

What I meant was something like this.

If EOS=True
Then nextframe=SOS (not relying on maths but a fact that SOS must be after EOS. Accept for start of video of course.)
Else end of video.
coolgit is offline   Reply With Quote
Old 16th October 2021, 23:54   #202  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
But if its wrong, then they're both then wrong.
And if SOS detected and not EOS, then how does it go back and make EOS true on previous frame [its already gone past it].
There is no easy solution testing only 3 frame, prev,curr,next, and testing 2 prev, curr, 2 next aint without its own problems either.
__________________
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; 17th October 2021 at 00:00.
StainlessS is offline   Reply With Quote
Old 17th October 2021, 01:38   #203  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Quote:
Originally Posted by StainlessS View Post
But if its wrong, then they're both then wrong.
And if SOS detected and not EOS, then how does it go back and make EOS true on previous frame [its already gone past it].
There is no easy solution testing only 3 frame, prev,curr,next, and testing 2 prev, curr, 2 next aint without its own problems either.
If EOS is not detected then there can be no SOS.
If SOS is detected but not previous frame as EOS then there is no SOS.

For scene change to be true there must be EOS and SOS. It can't be either or none.
coolgit is offline   Reply With Quote
Old 17th October 2021, 02:52   #204  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Quote:
For scene change to be true there must be EOS and SOS. It can't be either or none.
Tell that to Kassandro (ScSelect) and the authors of MvTools (Manao, Fizick, Tsp, TSchniede, SEt, cretindesalpes, pinterf).

If you dont like'em, there are others to choose from:- http://avisynth.nl/index.php/SCDetec...ange_Detection
__________________
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 17th October 2021, 17:20   #205  |  Link
MysteryX
Soul Architect
 
MysteryX's Avatar
 
Join Date: Apr 2014
Posts: 2,558
You could add the VapourSynth code version to the first post. I'll remove it from my code but don't want this to get lost.

In VapourSynth, it currently only works with the 32-bit library. The dubhater library has a bug.

Code:
# SpotLess denoising method (m1=4) EXPERIMENTAL
def SpotLess(c: vs.VideoNode, radt: int = 1, thsad: int = 10000, thsad2: Optional[int] = None, pel: int = 2, chroma: bool = True, blksize: int = 8, 
overlap: Optional[int] = None, truemotion: bool = True, pglobal: bool = True, blur: float = 0.0, ref: Optional[vs.VideoNode] = None) -> vs.VideoNode:
    if radt < 1 or radt > 3:
        raise ValueError("Spotless: radt must be between 1 and 3")
    if not pel in [1, 2, 4]:
        raise ValueError("Spotless: pel must be 1, 2 or 4")

    thsad2 = thsad2 or thsad
    icalc = c.format.bits_per_sample < 32
    S = core.mv.Super if icalc else core.mvsf.Super
    A = core.mv.Analyse if icalc else core.mvsf.Analyse
    C = core.mv.Compensate if icalc else core.mvsf.Compensate
    pad = max(blksize, 8)

    sup = ref or (c.std.Convolution(matrix=[1, 2, 1, 2, 4, 2, 1, 2, 1]) if blur > 0.0 else c)
    sup = S(sup, hpad=pad, vpad=pad, pel=pel, sharp=2)
    sup_rend = S(c, hpad=pad, vpad=pad, pel=pel, sharp=2, levels=1) if ref or blur > 0.0 else sup

    th1 = thsad
    th2 = (thsad + thsad2)/2 if radt==3 else thsad2
    th3 = thsad2

    bv1 = A(sup, isb=True, delta=1, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)
    fv1 = A(sup, isb=False, delta=1, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)
    if radt >= 2:
        bv2 = A(sup, isb=True, delta=2, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)
        fv2 = A(sup, isb=False, delta=2, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)
    if radt >= 3:
        bv3 = A(sup, isb=True, delta=3, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)
        fv3 = A(sup, isb=False, delta=3, blksize=blksize, overlap=overlap, chroma=chroma, truemotion=truemotion, pglobal=pglobal)

    bc1 = C(c, sup_rend, bv1, thsad=th1)
    fc1 = C(c, sup_rend, fv1, thsad=th1)
    if radt >= 2:
        bc2 = C(c, sup_rend, bv2, thsad=th2)
        fc2 = C(c, sup_rend, fv2, thsad=th2)
    if radt >= 3:
        bc3 = C(c, sup_rend, bv3, thsad=th3)
        fc3 = C(c, sup_rend, fv3, thsad=th3)

    ic =          core.std.Interleave([bc1, c, fc1])           if radt == 1 else \
             core.std.Interleave([bc2, bc1, c, fc1, fc2])      if radt == 2 else \
        core.std.Interleave([bc3, bc2, bc1, c, fc1, fc2, fc3])

    output = core.tmedian.TemporalMedian(ic, radius=radt)
    return output.std.SelectEvery(radt*2+1, radt)  # Return middle frame
MysteryX is offline   Reply With Quote
Old 17th October 2021, 17:27   #206  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
How bout I put link to it in 1st post.
I dont speak python/vapoursynth, so it means little to me and I dont really want to be tip-toe-ing around it, wondering why its there.

EDIT: Put link in first post.
__________________
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; 17th October 2021 at 17:32.
StainlessS is offline   Reply With Quote
Old 17th October 2021, 18:12   #207  |  Link
kedautinh12
Registered User
 
Join Date: Jan 2018
Posts: 1,646
I think you need creat new post in Vapoursynth and add your script in that, MX
kedautinh12 is offline   Reply With Quote
Old 10th November 2021, 02:01   #208  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Hey Stainless, s 3 ep17 war without end f 8013 to 8215 is weird. Had to do that from vob again using assume bff to get it right. Any idea why this happen in the first place? Had this in an earlier ep in s3, can't remember which now.
coolgit is offline   Reply With Quote
Old 10th November 2021, 14:16   #209  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Is that the sequence starting with subs "Special guest star Michael O'hare".
Seems progressive in my VOB, no jumping with AssumeTFF or AssumeBFF. [EDIT: Assume??? then SeparateFields]
__________________
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 10th November 2021, 16:50   #210  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
No, sub produced by john copeland... Sinclair walking away to go indoors. I use assumetff but in some rare cases, need asssumebff.
coolgit is offline   Reply With Quote
Old 30th November 2021, 22:03   #211  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Stainless, can you check you vob filesize for season 5 ep 18. I got 38:42 length with teaser part at the beginning missing.

Last edited by coolgit; 1st December 2021 at 06:07. Reason: add a word
coolgit is offline   Reply With Quote
Old 30th November 2021, 23:56   #212  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
S05E18, Disk 5, ep Clip2, - "The Fall of Centauri Prime".
is 42:21


EDIT:
Quote:
Stainless, can you check you vob filesize for season 5 ep 18. I got 38:42 with teaser part at the beginning missing.
I really dont know how to answer that, episodes are combined in DVD VOB so VOB size is all 4 episodes and who knows what else.
38:42 is a time, not file size and teaser is part of the clip.
OK, cutting out all of "teaser", and starting at first frame of B5 intro/credits with first frame showing very small but distinct "2258", [frame before is black]
leaves 58024 frames, 38:40.96 duration. [but it depends upon where you cut the black sequence - I cut on very first visible "2258" so you should get exactly the same if cut at that point]

EDIT: My season 5 is not boxed version as my other seasons, is single DVD case with multiple flip disk holders (6).
__________________
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; 1st December 2021 at 01:20.
StainlessS is offline   Reply With Quote
Old 1st December 2021, 08:29   #213  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Well it seems my dvd got a defect. Tried other software and can't read it. Tried vdub and as soon as i move to the first frame it crashes.

If you have time could you upload the missing vob clip up to the first keyframe of intro for me.

Cheers.

Last edited by coolgit; 1st December 2021 at 11:25.
coolgit is offline   Reply With Quote
Old 1st December 2021, 17:53   #214  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Check PM.
__________________
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 18th December 2021, 21:36   #215  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Any of you mask wizards out there improve on this ?

Code:
AviSourcE(".\somefile.avi")
ConvertToYV24
#ConvertBits(16)
Src=Last
Filtered=SpotLess(RadT=2)
YTH8 = 12
CTH8 = 12
CAMP = True
SHOW = True
SpotTest(Src,Filtered,YTH8,CTH8,CAMP,SHOW)
Return Last.ConvertToRGB32

/*
    SpotTest(),
    Purpose:
        Spotless produces frame global changes [most pixels are changed], here we want to try alter only real spots where there is significant change in spotless Y [by YTh8]
        and also that are near grey in source [by CTh8], these targeted pixels are then overlayed from Spotless result onto original src.

    Src,      Pre-Spotless source
    Filtered, Spotless result
    YTh8,     threshold for Y in 8 bit range.
    CTh8,     threshold for Chroma in 8 bit range.
    CAMP,     If True amplify chroma MaskC when Show
    Show,     Show Masks. Mask is the final mask made from MaskY and MaskC.

*/
Function SpotTest(clip Src,clip Filtered,int "YTh8",int "Cth8",Bool "AmpC",Bool "Show") { # 8 -> 16 bit YUV444 only
    YTh8 = Default(YTh8,12)
    CTh8 = Default(CTh8,12)
    AmpC = Default(AmpC,True)
    Show = Default(Show,False)
    try {bpc = Src.BitsPerComponent} catch(msg) {bpc=8}
    try {Y444=Src.IsYV24||Src.Is444} catch(msg) {Y444=false}
    Assert(Y444,"SpotTest: Must be YV24/YUV444")
    YTh = BitLShift(YTh8,bpc-8)
    CTh = BitLShift(YTh8,bpc-8)
    MaskY = Mt_Lutxy(Src.ExtractY,Filtered.ExtractY,"x y - abs " + String(YTh) + " > range_max 0 ?")  # "(abs(x-y) > YTh) ? range_max : 0"
    MU    = Mt_Lut(Src.ExtractU,"x range_half - abs")                                                 # "abs(x - range_half)"
    MV    = Mt_Lut(Src.ExtractV,"x range_half - abs")                                                 # "abs(x - range_half)"
    MaskC = Mt_Lutxy(MU,MV,"x x * y y * + 0.5 ^")                                                     # "((x^2)+(y^2)) ^ 0.5"    # 2D chroma (by Pythagoras)
    Mask  = Mt_Lutxy(MaskC,MaskY,"x " + string(CTh) + " < y 0 ?")                                     # "(x < CTh) ? y : 0
    Mask  = Mask.mt_Expand.Blur(1.0)
    MaskC = (!AmpC) ? MaskC : MaskC.mt_lut("x 8 *")                                                   # 2D chroma Amp'ed for view if AmpC
    Overlay(Src,Filtered,Mask=Mask,Opacity=1.0)
    CGREY = Mask.Mt_lut("range_half")
    TOP=StackHorizontal(Src.Subtitle("Src"),Filtered.Subtitle("Filt"),YtoUV(CGrey,CGrey,MaskY).Subtitle("MaskY"))
    BOT=StackHorizontal(Last.Subtitle("Result"),YtoUV(CGrey,CGrey,Mask).Subtitle("Mask"),YtoUV(CGrey,CGrey,MaskC).Subtitle((AmpC)?"MaskC Amp'ed":"MaskC"))
    STK = StackVertical(TOP,BOT)
    (Show) ? STK : Last
}
Hopefully reduces the number of changed pixels, and avoids arms and legs and balls and stuff going missing.
__________________
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; 18th December 2021 at 22:02.
StainlessS is offline   Reply With Quote
Old 18th December 2021, 22:00   #216  |  Link
Dogway
Registered User
 
Join Date: Nov 2009
Posts: 2,102
It might be obvious but maybe looking into current algorithms (Wiki) can provide some insight. I plan to give it a stab in a few weeks.
__________________
i7-4790K@Stock::GTX 1070] AviSynth+ filters and mods on GitHub + Discussion thread
Dogway is offline   Reply With Quote
Old 18th December 2021, 23:16   #217  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Thanks doggie, looks like Gobble-De-Gook to me though.

Above script does pretty well with VOB where looks like original film stock had emulsion chipped off (or something),
white-ish dots every now and then.
[will undergo further processing and did not want to overdo it with spotless - RADT=2 was just to make it more difficult test (with repaired disappearing arm ),
RADT=1 is quite sufficient for my clip]

Just tried with dirty home movie where various color dirt, not so good.

Anyways, I think it does pretty much exactly as I want for current clip, and really quite simple.

EDIT: Here, two frames from very jerky InGoldie clip that you might remember [boy in purple throws ball in the air, Spotless removes it but we use original source pixels not spotless result].
[no white spots for demo here]




__________________
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; 18th December 2021 at 23:44.
StainlessS is offline   Reply With Quote
Old 19th December 2021, 01:57   #218  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
A new code....mmmm. The results looks good but shouldn't both source should have a 'spot' in it to ensure the code doesn't put it back in.

If it works it could replace spotlessF.
coolgit is offline   Reply With Quote
Old 19th December 2021, 02:20   #219  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,558
Quote:
shouldn't both source should have a 'spot' in it to ensure the code doesn't put it back in.
No,
MaskY is white where change in pixel Y [for src->spotless] is > YTh, MaskC is amount Chroma in SOURCE pixels [*8 Amplified in images for view only],
will only overlay with Spotless pixels where MaskC is < CTh and MaskY = white.
Code:
    Mask  = Mt_Lutxy(MaskC,MaskY,"x " + string(CTh) + " < y 0 ?")     # "(x < CTh) ? y : 0 # x is MaskC pixel and y = corresponding MaskY pixel
Its really a bit specific for white or black noise only. [and its where are white pixels in MASK that are overlaid from Spotless filtered onto source]
(we are selecting what we want rather than restoring what we dont want)
There are not usually that many white dots on final mask, probably down to all them there daisies.
__________________
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; 19th December 2021 at 02:39.
StainlessS is offline   Reply With Quote
Old 19th December 2021, 18:20   #220  |  Link
coolgit
Registered User
 
Join Date: Apr 2019
Posts: 170
Inserted the code into Spotless and got it to work.

Does well in restoring hands (a common problem) but also does well in restoring all kinds of defects. It rarely removes anything.

What a pity.
coolgit is offline   Reply With Quote
Reply

Tags
denoise, despot, prefilter

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 12:41.


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