VideoHelp Forum
+ Reply to Thread
Results 1 to 10 of 10
Thread
  1. I want to remove rainbows, and this source has a lot of strong rainbows in it.

    My rainbow removal filter of choice is bifrost.

    This source requires a high secenlumathresh setting of 10-20 to actually remove most of the rainbows in several parts. Some parts can use a lower setting like 4 and it gets them all. The problem is, once I set it any higher than 6, a lot of the scenes with faster moving motion or that have a panning screen in them get colors/chroma from other frames in them, and it messes up the colors. This is a side effect of more aggressive rainbow removal.

    https://forum.videohelp.com/images/imgfiles/52lA2E9.png
    https://forum.videohelp.com/images/imgfiles/XK576cL.png


    I tried using altclip like this hoping it would only use a higher scenelumathresh when needed.
    bifrost(scenelumathresh=6, altclip=bifrost(scenelumathresh=14))

    It works, but the problem is the motion scenes are above the threshold so it is still using the higher scenelumathresh even in the motion parts, and causing the color/chroma issue just the same.

    I tried a few other derainbow filters as well and they either have the same problem or don't work as well as bifrost at removal of the rainbows.


    Is there any good way I can use a high scenelumathresh for derainbow, but protect the motion frames from the color distortions better?

    If it were only one movie or 1-4 episodes I would just go through every individual frame, and only use the higher scenelumathresh on frames that need it, leaving the motion frames to go with the lower setting of 6. This is a lot of episodes though, and would take more time/patience than I have for that option.

    Nothing else comes to mind when I think about how to solve the issue. Any ideas would be appreciated.
    Last edited by killerteengohan; 8th May 2023 at 16:00.
    Quote Quote  
  2. Rainbows usually occur at moving sharp luma edges. So you can use an edge+motion mask to protect other areas. As usual, need source sample.

    Oops, that description was for dot crawl artifacts. Rainbows are caused by high frequency luma detail interfering with the chroma when digitizing a composite signal.
    Last edited by jagabo; 8th May 2023 at 21:55.
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Rainbows usually occur at moving sharp luma edges. So you can use an edge+motion mask to protect other areas. As usual, need source sample.
    Here are a couple samples.

    In this one, the rainbows are quite strong and requires at least scenelumathresh=10 to clean up the white mages face when he smirks. The part right after where the candle flames flicker around is one of the motion parts where the colors mess up. Anything higher than a setting of 4 and those begin to show.
    https://mega.nz/file/twx2UAgD#ikjif3pKe51aa92_ms7jXacTUxK-v0CdXi8EQvT2jHI


    In this one, the screen pans, and at a setting of 10 you can clearly see the colors blending from multiple frames, especially in the red hair. It seems it needs to go down to at most 8 to get it to stop.
    https://mega.nz/file/B8ZCWDID#1lTZm8rOzLzRinFjm-Z3OnmD_aOhuPE3EXUv1kmfQXc


    In this one there is very fast motion when the guy is being thrown from the rooftop. Anything higher than a setting of 4 seems to start the color issues here.
    https://mega.nz/file/Mko2mRSB#yGLO1cefLiVjYPCJpZF4-nE6GD3b_Dl9zCDy37mNCKk
    5 is acceptable and wont be noticed during playback here, but it certainly cant go with 10 like most of the other parts of the episode needs such as in the first example.


    I would like to be able to use a setting of 10-20 and not have to deal with these colors distorting with other frames that have motion in them.
    Last edited by killerteengohan; 8th May 2023 at 16:20.
    Quote Quote  
  4. You can use ASTDRmc for motion compensated rainbow removal
    http://avisynth.nl/index.php/ASTDR
    Quote Quote  
  5. I can reproduce the problem with BiFrost in both Avisynth and Vapoursynth.
    -> best report the issue over at https://github.com/dubhater/vapoursynth-bifrost


    Cu Selur

    Ps.: SSIQ seems to work better in removing the rainbows while not creating those artifacts.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  6. Try this:

    Code:
    MPEG2Source("Motion Sample 2.demuxed.d2v", cpu=0)
    ConvertToYV16(interlaced=true) 
    orig=last
    ev=orig.assumetff().separatefields().selecteven()
    od=orig.assumetff().separatefields().selectodd()
    ev
    ue_chroma = UToY(ev).SpotLessUV() # use YV16!
    ve_chroma = VToY(ev).SpotLessUV() # use YV16!
    YToUV(ue_chroma, ve_chroma)
    MergeLuma(ev)
    ev_filtered=last
    od
    uo_chroma = UToY(od).SpotLessUV()# use YV16!
    vo_chroma = VToY(od).SpotLessUV() # use YV16!
    YToUV(uo_chroma, vo_chroma)
    MergeLuma(od)
    od_filtered=last
    interleave(ev_filtered,od_filtered)
    assumefieldbased().assumetff().weave()
    converttoyv12(matrix="Rec601",interlaced=true)
    
    TFM(order=1)  # order=1 (TFF)
    vinverse() # Remove  residual combing
    TDecimate(mode=1) # for Cartoons
    
    U = UToY().ttempsmooth(maxr=1,lthresh=150, strength=1)
    V=VToY().ttempsmooth(maxr=1,lthresh=150, strength=1)
    
    FastLineDarken()
    #deen("a3d",4,8,9)
    #dfttest()
    super = MSuper(pel=2, sharp=1)
    backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=4)
    backward_vec1 = MAnalyse(super, isb = true, delta = 1, overlap=4)
    forward_vec1 = MAnalyse(super, isb = false, delta = 1, overlap=4)
    forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=4)
    MDegrain2(super, backward_vec1,forward_vec1,backward_vec2,forward_vec2,thSAD=400)
    Spline36Resize(last.width*2,last.height*2)
    AddBorders(4, 0, 4, 0)
    aWarpSharp(depth=6,blurlevel=4,thresh=0.2,cm=1)
    FastLineDarken()
    #aWarpSharp(depth=6,blurlevel=4,thresh=0.7,cm=1)
    #Crop(4,0,-4,0)
    #FastLineDarken()
    Crop(4,0,-4,0)
    DeHalo_Alpha()
    Spline36Resize(last.width/2,last.height/2)
    Image Attached Thumbnails Click image for larger version

Name:	ORIGINAL.jpg
Views:	29
Size:	199.4 KB
ID:	70868  

    Click image for larger version

Name:	THEMASTER1_SCRIPTAVS.jpg
Views:	35
Size:	189.5 KB
ID:	70869  

    Image Attached Files
    *** DIGITIZING VHS / ANALOG VIDEOS SINCE 2001**** GEAR: JVC HR-S7700MS, TOSHIBA V733EF AND MORE
    Quote Quote  
  7. Originally Posted by poisondeathray View Post
    You can use ASTDRmc for motion compensated rainbow removal
    http://avisynth.nl/index.php/ASTDR
    I don't care about rainbow removal in motion so much. I use chubbyrain2 to cover the motion parts which bifrost cant hit on it's own. I can clean the rainbows up almost perfectly.
    What I care about is the colors mixing from other frames when there is motion from derainbow filters needing to be set too strong to hit the majority of the rainbows in general when there is no motion.
    I will check that one out.



    Originally Posted by Selur View Post
    I can reproduce the problem with BiFrost in both Avisynth and Vapoursynth.
    -> best report the issue over at https://github.com/dubhater/vapoursynth-bifrost


    Cu Selur

    Ps.: SSIQ seems to work better in removing the rainbows while not creating those artifacts.
    You can reproduce that with many derainbow filters. It's a typical side effect of them when they get set more aggressive, and is nothing new.

    I recall trying SSIQ and believe I didn't like how blurry things got with it. I will mess with it one more time.
    Last edited by killerteengohan; 8th May 2023 at 16:18.
    Quote Quote  
  8. Originally Posted by killerteengohan View Post
    What I care about is the colors mixing from other frames when there is motion from derainbow filters needing to be set too strong to hit the majority of the rainbows in general when there is no motion.
    That's what it's for - remove the rainbows without the artifacts during high motion in your screenshots (or at least less bad), or having to adjust per scene

    ASTDRmc is a motion-compensated variant that helps avoid chroma bleeding in moving scenes.
    If you still can't get what you want, despite playing with the settings , an interesting machine learning model is 1x_BleedOut_Compact. It will do rainbow removal without chroma ghosting (pure spatial) and "sharpen" the chroma simulatneously. But it can shift the colors slightly in some areas, increase saturation in some areas but decrease in some others. You can get similar problems with "traditional" derainbow filters with strong settings, and they tend to denoise/blur the chroma. 1x_BleedOut_Compact is quite useful for rainbows and chroma bleeding on cartoon content and definitely worth checking out . Vapoursynth version using vs-mlrt will be significantly faster if you have a Nvidia card. Avisynth+ version is limited to NCNN/vulkan (but at least it works)
    Quote Quote  
  9. Member
    Join Date
    Aug 2017
    Location
    United States
    Search PM
    You need to stop using Bifrost if you want to avoid the colors getting moved to adjacent frames. The filter is flawed and always has been. There’s a masked and motion-compensated procedure in the mvtools guide that you can plug almost any temporal filter into. Use that procedure with the old dfmderainbow() and you’re golden.

    https://forum.doom9.org/showthread.php?t=171715&highlight=detail-safe
    Quote Quote  
  10. Here's something that works moderately well. It includes no temporal filtering.

    Code:
    Mpeg2Source("Motion Sample 3.demuxed.d2v", CPU2="ooooxx", Info=3) 
    TFM()
    TDecimate()
    before = last
    
    MergeChroma(Blur(0.0, 1.0).Sharpen(0.0, 0.6).KNLMeansCL(d=0, a=3, h=4.0, channels="UV").aWarpSharp2(depth=10)) # blur the chroma to reduce rainbows
    
    BlackLines = mt_edge(mode="cartoon", thY1=10, thY2=10) # find black outlines
    BlackLines = Overlay(BlackLines, BlackLines, x=-1, y=-1) # shift them up and left
    NearLines = BlackLines.mt_expand().mt_expand().mt_expand().Blur(1.5) # expand them for a mask of areas near black lines
    BlackLines = BlackLines.Blur(1.0) # a blurry mask of the black lines
    
    Overlay(last, before, mask=BlackLines) # overlay the original black chroma over the black lines.
    Overlay(before, last, mask=NearLines) # overlay the this new image over the original image -- only in areas near black lines
    
    # compare before, after, masks
    Interleave(before, last, BlackLines.GreyScale(), NearLines.GreyScale())
    StackHorizontal(last, StackVertical(UtoY(), VtoY()))
    Some rainbows are left behind. You might increase the blurring (radius and strength) with KNLMeans to reduce them more. Maybe thin the BlackLines mask a little more.

    I didn't address the dot crawl or any other issues.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!