VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. I'm not 100% sure why, but I keep getting these lines across random parts of the video that look like it did not TIVTC or deinterlace correctly.

    Here are a couple screenshot examples.

    https://forum.videohelp.com/images/imgfiles/JpCDRMQ.png
    https://forum.videohelp.com/images/imgfiles/CmzpSwf.png



    Here is the script I have used

    Code:
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\dgindex\DGDecode.dll")
    DGDecode_mpeg2source("C:\Users\Admin\Desktop\Encoding\WM\Episode 5\VTS_01_1.d2v", info=3)
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\avisynth_plugin\ColorMatrix.dll")
    ColorMatrix(hints=true, interlaced=true, threads=0)
    LoadPlugin("C:\Program Files (x86)\MeGui\tools\avisynth_plugin\TIVTC.dll")
    tfm(order=-1)
    crop( 2, 0, -2, 0)
    LanczosResize(848,480) # Lanczos (Sharp)
    dehalo_alpha(rx=1.1, ry=1.1, darkstr=0, lowsens=0, highsens=100, ss=1.0)
    ChromaShiftSP(x=0.00, y=1.00)
    mergechroma(awarpsharp2(depth=3, blur=1, type=1), chromaweight=0.5)
    blur(0.015)


    Here is a demuxed sample. The frame I took screenshots from is about frame #537 in the sample.

    https://mega.nz/file/xoggiCDS#7abTFV_eld2X0LDXYzS52LzbUyXXhxYfTuoIQU5VxWE



    I have tried adjusting tfm in many ways and played with almost every option I see it offers in the wiki, but nothing tfm has for me to adjust, seems to stop these from being in the video.

    Is there a reason for these and a way to stop them? Perhaps an alternative to TFM that might be better?
    Quote Quote  
  2. vinverse after TFM.

    This artifact is common with hard telecined material. Compression artifacts lead to small differences between the two matching fields.
    Last edited by jagabo; 24th Apr 2020 at 07:45.
    Quote Quote  
  3. I find vinverse to be pretty destructive to small details and can move lines around a bit. Sometimes it makes things look aliased too.

    Is that my only option you can think of at the moment? I'm still trying other things, looking for something.
    Quote Quote  
  4. You can try using an edge mask like mt_edge() to protect edges. Protecting other small details is more difficult. You might be able to use a 2d convolution to build a mask of alternating bright/dark horizontal lines to use as a mask.
    Quote Quote  
  5. I'm not real good with GeneralConvolution but here's an example:

    Code:
    ###################################################
    #
    # build a mask of areas where there are 
    # alternating horizontal lines
    #
    ##################################################
    
    function AltHzLineMask(clip v)
    {
        Subtract(v, v.blur(0.0, 1.0).Sharpen(0.0, 0.6))
        Levels(120,1,136,0,255)
        ConvertToRGB()
        GeneralConvolution(0, "
            0  8  8  8  0
           -0 -8 -8 -8 -0 
            0  8  8  8  0
           -0 -8 -8 -8 -0
            0  8  8  8  0")
        ConvertToYV12()
        mt_binarize(150)
        mt_expand()
        mt_inpand()
        Blur(1.0)
    }
    
    ##################################################
    
    Mpeg2Source("VTS_01_1.demuxed(1).d2v", CPU2="ooooxx", Info=3) 
    TFM(d2v="VTS_01_1.demuxed(1).d2v", clip2=nnedi3()) 
    TDecimate() 
    src = last
    
    hzlmask = AltHzLineMask()
    emask = mt_edge(thY1=8, thY2=8).mt_expand().Blur(1.0) # build a mask of edges
    hzlmask = Overlay(hzlmask, emask, mode="Subtract").GreyScale() # subtract edge mask from hzlmask
    Overlay(src, vinverse(), mask=hzlmask) # overlay vinverse only where hzlmask
    
    Interleave(src, last, hzlmask) # show before, after, mask
    Oh, I also noticed that you sample images came orphaned fields. So I used clip2 in TFM for antialiasing. And there are shots that aren't 23.976 fps.
    Quote Quote  
  6. Yeah, I think some of this anime is 23.976fps in most scenes and 29.970fps in other scenes.

    I noticed when I tdecimate to 23.976fps, most everything looks fine, but a few scenes look like its missing entire frames or just jumps as it pans. While if I use TFM only and do not tdecimate to 23.976fps, those scenes that jumped are now smooth, but the rest looks abnormally smooth or is slightly bouncy when panning.

    I tried hybrid=1 in tdecimate and it seems to have fixed that jumping issue, but I do not like the blends it put in those couple of scenes that looked like they were missing entire frames or jumping wildy as it panned. The rest remained pretty much the same.
    Quote Quote  
  7. I discovered that GeneralConvolution works with YV12 if you're using AviSynth+. I also streamlined a few other things:

    Code:
    ###################################################
    #
    # build a mask of areas where there are 
    # alternating horizontal lines
    #
    ##################################################
    
    function AltHzLineMask(clip v)
    {
        Subtract(v, v.blur(0.0, 1.0).Sharpen(0.0, 0.6))
        GeneralConvolution(0, "
            0  8  8  8  0
           -0 -8 -8 -8 -0 
            0  8  8  8  0
           -0 -8 -8 -8 -0
            0  8  8  8  0", chroma=false, alpha=false)
        mt_lut("x 125 - abs")
        mt_binarize(2) # threshold, higher values --> less area covered
        mt_inpand() # get rid of very thin lines, single pixels
        mt_expand(chroma="-128")
    }
    
    ##################################################
    
    Mpeg2Source("VTS_01_1.demuxed(1).d2v", CPU2="ooooxx", Info=3) 
    TFM(d2v="VTS_01_1.demuxed(1).d2v", field=0, clip2=nnedi3()) 
    TDecimate()
    src = last
    
    hzlmask = AltHzLineMask().Blur(1.0)
    emask = mt_edge(thY1=8, thY2=8).mt_expand().Blur(1.0) # build a mask of edges
    hzlmask = Overlay(hzlmask, emask, mode="Subtract").mt_expand().GreyScale()  # subtract edge mask from hzlmask
    Overlay(src, vinverse(), mask=hzlmask)
    
    Interleave(src, last, hzlmask) # show before, after, mask
    Before:
    Image
    [Attachment 52853 - Click to enlarge]


    After:
    Image
    [Attachment 52854 - Click to enlarge]


    hzlmask:
    Image
    [Attachment 52855 - Click to enlarge]
    Last edited by jagabo; 24th Apr 2020 at 17:49.
    Quote Quote  
  8. Does this video look like it has banding in it to you? I usually only see it on Blu-Ray but I think I see it in the dark areas in this.
    Quote Quote  
  9. Thanks for introducing me to convolution. I will have to play with that some. That actually did a nice job like the antialiaser I tried, but looks like it altered even less details. It's nice to learn about this.


    So far I have found 3 things that I got to fix the artifacts I originally asked about.

    Using Santiag(strv=0, nns=4, nsize=5) cleans them. It still looks filthy, but all those lines are gone. I do not like the side effect of this filter though, which is it adds halos and sharpening artifacts all over the place. It also pulls lines out of place, and or smudges smaller details away.

    Using Xaa with settings that mimic Santiag() and turning the mask off. Xaa(mode="div2 nnedi3", mask=0, chroma=0, nns=4, cstr=0, mthr=8, mtype="TEMmod1"). This cleans just as well as Santiag, but does not add nearly as visible halo or sharpening artifacts. It still adds some, but its not nearly as visible as Santiag(). It also retains detail much better and alters lines less than Santiag(). This is better than the first option, but If I can avoid antialiasing all together to protect detail and not get artifacts, I would prefer it.

    Using QTGMC not only cleaned as well as Santiag and Xaa, but it also completely removed all those splotches and messy artifacts where the lines were located. QTGMC warps all the lines and details around and or makes thing appear slightly less detailed than TFM though. I dislike QTGMC because of that reason. Even sourcematch=3 and lossless mode are not as good looking as TFM.
    Then I remembered you teaching me about clip2 in TFM a couple months ago. I used it in clip2 and while it did not catch all of the lines like the antialiasers did, it got around 95%+ of them like QTGMC, and cleaned like QTGMC. I'm fairly happy with this result.
    tfm(order=-1, pp=3, cthresh=8, clip2=QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", FPSDivisor=2, sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)).tdecimate(mode=1,hybrid=0)


    The QTGMC looks much better and cleaned that messy stuff away. The Antialiasers got rid of the lines, the QTGMC did that, and made it look better. Check out the comparisons.

    Source vs Santiag/Xaa
    https://slow.pics/c/ApaZZgwr

    Source vs TFM Clip2=QTGMC
    https://slow.pics/c/lSPE4s7h


    Source vs TFM Clip2=QTGMC 2
    https://slow.pics/c/83VZy4kL
    Quote Quote  



Similar Threads

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