VideoHelp Forum
+ Reply to Thread
Page 1 of 2
1 2 LastLast
Results 1 to 30 of 32
Thread
  1. I have this fragment, from a video obtained from a DVD from a few years ago, but it is impossible for me to achieve a clean and deinterlaced image of it.
    Image
    [Attachment 78978 - Click to enlarge]

    Image
    [Attachment 78979 - Click to enlarge]

    Image
    [Attachment 78980 - Click to enlarge]

    Image
    [Attachment 78981 - Click to enlarge]


    fragment
    Image Attached Files
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    In Avisynth
    Code:
    bwdif(field=3) # bob deinterlace
    srestore()        # match the proper fields
    seems to work OK, revert the clip to 23.976 fps
    Image Attached Files
    Quote Quote  
  3. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    Here's my go! I like that hqdn Dave.

    AVISynth code:
    Code:
    LWLibavVideoSource("H:\Videohelp\DMForever98\VTS_27_1 videohelp.mkv")
    ConvertToYV12(interlaced=true)
    AssumeTFF()
    QTGMC(preset="Fast", EdiThreads=8)
    srestore()
    hqdn3d(6.5)
    VDub2-64 bit: JPSDR Deinterlaced, bit of Temp Smoothing, a bit of CCD filter
    Image Attached Files
    Quote Quote  
  4. Originally Posted by Alwyn View Post
    Here's my go! I like that hqdn Dave.
    Removes noise and kills the details. See for example the strings of the guitar, pattern on the floor .....
    Don't overdo with denoising.
    Quote Quote  
  5. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    It's not "killing" anything, Sharc. The strings are better-off for hqdn. As for the floor, I'm not looking at the floor. Everything's a tradeoff.
    Quote Quote  
  6. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    @sharc, just curious, how would you tackle this video?
    Quote Quote  
  7. Originally Posted by Alwyn View Post
    It's not "killing" anything, Sharc. The strings are better-off for hqdn. As for the floor, I'm not looking at the floor. Everything's a tradeoff.
    Look at the strings to the right of the thumb, around frame 130. 3 strings celarly visible in the left picture, while almost gone on the right picture. Not sure which filter contributed most to the smoothing, I didn't check.
    Similar with other low-contrast details. Tradeoff, yes. Not to critizise or prefering anything, just a hint.
    Image Attached Thumbnails Click image for larger version

Name:	strings.png
Views:	36
Size:	718.8 KB
ID:	78995  

    Quote Quote  
  8. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    You can always use HQDN3d with a lower setting; it's all a compromise.
    I just found a strength of 6.5 seemed to be OK for that video with the guys and gals dancing in the desert
    from a couple of days ago.
    I gravitate towards this kind of relatively fast filter because my PC is old and slow!
    Quote Quote  
  9. Originally Posted by Alwyn View Post
    @sharc, just curious, how would you tackle this video?
    Perhaps something like this (left video is based on post#2 as a source plus filtered with MCDegrainSharp)
    See the text jaggies in the 2nd example.
    Image Attached Thumbnails Click image for larger version

Name:	strings2.png
Views:	29
Size:	756.8 KB
ID:	78999  

    Click image for larger version

Name:	jaggies.png
Views:	32
Size:	632.8 KB
ID:	79000  

    Quote Quote  
  10. Originally Posted by davexnet View Post
    I gravitate towards this kind of relatively fast filter because my PC is old and slow!
    Yes, speed is just one more dimension of "quality".
    Quote Quote  
  11. smoothed
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  12. Originally Posted by Selur View Post
    It doesn't blame anyone for what I think is the fault of the original video, but there is some reason why the fps are slower or the image looks strange after deinterlacing, obviously taking out the original slow motion effects. I feel that in some parts it slows down and speeds up or there are strange movements, but in general it is a slow video (after deinterlacing) is there a way to solve it?
    Last edited by DMFOREVER98; 10th May 2024 at 15:27.
    Quote Quote  
  13. smoother motion
    Image Attached Files
    Quote Quote  
  14. Originally Posted by jagabo View Post
    smoother motion
    What did you use to obtain that?
    Quote Quote  
  15. I used AviSynth:

    Code:
    LWLibavVideoSource("DMForever98\VTS_27_1 videohelp.mkv") 
    AssumeTFF()
    QTGMC(preset="fast")
    
    SelectEvery(4, 0, 1, 3)
    
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:l=>rgb:709:709:f")
    Rife(gpu_thread=1, model=8, sc=true, sc_threshold=0.12)
    z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:f=>709:709:709:l")
    
    SelectEvery(6, 0, 2, 3, 4)
    
    
    prefetch(8)
    First I used QTGMC() to turn each field into a frame (double rate deinterlace). After that it was obvious there was a duplicate, out of place frame in every group of 4 frames. I used SelectEvery() to discard that out of place duplicate. After that it was obvious there was a missing frame where the out of place frame was removed. I used Rife() to generate motion interpolated frames to double the frame rate. You can use another frame rate converter if you prefer faster/easier processing -- though the interpolation probably won't be as good. One of the interpolated frames was the the missing frame. So I used SelectEvery() to select the original frames and the one reconstructed missing frame.

    You will probably find that the phase of the duplicate/out-of-place frame will vary later in the video (ie instead of being the third frame of the four it may switch to another). If that's the case you'll have to modify the code to account for that.
    Quote Quote  
  16. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    @Sharc, what actual code did you use for your MCDegrainSharp example in post #9?
    Last edited by Alwyn; 11th May 2024 at 00:33.
    Quote Quote  
  17. You will probably find that the phase of the duplicate/out-of-place frame will vary later in the video (ie instead of being the third frame of the four it may switch to another). If that's the case you'll have to modify the code to account for that.
    or use something like FillDrops or similar,...
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  18. Attempt with M_QTGMC + Deblock. Though I am stll not understand why increasing TR2 to max (6) makes close to no more denoise but restores more details. And Deblock only slightly fix blockiness and acts as some visible full-frame denoiser.

    Lots of scene changes and at each scene change original MPEG (2 ?) encoder makes lots of distortions. It can not be good handled by simple thSAD-based MDegrain. I think better to test some denoise AI like TopazVEAI after deinterlace.

    Also added Nyx1 model processed for attempt to denoise in Topaz VEAI (no Deblock in AVS). It still left many blocks from MPEG2 - looks like special anti-blockiness AI model also required.
    Image Attached Files
    Last edited by DTL2023; 11th May 2024 at 09:24.
    Quote Quote  
  19. Originally Posted by DTL2023 View Post
    Attempt with M_QTGMC + Deblock. Though I am stll not understand why increasing TR2 to max (6) makes close to no more denoise but restores more details. And Deblock only slightly fix blockiness and acts as some visible full-frame denoiser
    I ended up with custom selective deblock function (by testing each frame vs blockiness thr), so I can use very strong effect only to the worst frames.
    For the rest it's just usual mvtools based denoiser (with some prefilter/masking thou)

    As for
    smoother motion
    , just use assumebff.qtgmc().selecteven and problem solved, and no need for srestore() too, imo

    Code:
    assumebff.qtgmc(preset="fast").selecteven
    crop(12,0,-12,-8)
    Deblock2 (selective=true, info=1, thr=1.88, dstr=40)
    Denoiser_vhs (blocksize=8, tr=2, dct=0)
    Image Attached Files
    Quote Quote  
  20. I haven't looked at the original video, but I've skimmed through the fixes people have tried.

    After recovering the video with SRestore, if there are duplicates, but also some obvious drops, I did create a script to fix that:

    Automatically fix dups followed (eventually) by drops
    Quote Quote  
  21. Originally Posted by buzz1891 View Post
    As for
    smoother motion
    , just use assumebff.qtgmc().selecteven and problem solved,...
    Really? Leaves you with dropped/repeated frames IMO, means jerky playback (frames 100 ...200).
    Quote Quote  
  22. Originally Posted by Sharc View Post
    Originally Posted by buzz1891 View Post
    As for
    smoother motion
    , just use assumebff.qtgmc().selecteven and problem solved,...
    Really? Leaves you with dropped/repeated frames IMO, means jerky playback (frames 100 ...200).
    Yes, for selectodd, but not for selecteven.. for whatever reason
    Quote Quote  
  23. Originally Posted by buzz1891 View Post
    Originally Posted by Sharc View Post
    Originally Posted by buzz1891 View Post
    As for
    smoother motion
    , just use assumebff.qtgmc().selecteven and problem solved,...
    Really? Leaves you with dropped/repeated frames IMO, means jerky playback (frames 100 ...200).
    Yes, for selectodd, but not for selecteven.. for whatever reason
    ok, makes a difference. The source framerate is 25fps interlaced. You loose some temporal resolution with the framerate reduced to 25fps progressive. Watching it realtime looks ok though. Deblocking/denoising is nice.
    Last edited by Sharc; 11th May 2024 at 17:31.
    Quote Quote  
  24. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    @Buzz1891, do you have a source for Deblock2? I can't find it anywhere.
    Quote Quote  
  25. Originally Posted by Alwyn View Post
    @Buzz1891, do you have a source for Deblock2? I can't find it anywhere.
    It's custom script function:
    Code:
    function Deblock2 (clip c, bool "selective", int "info", float "thr", string "algo", int "dstr", bool "mc", int "thSAD", int "dct") {
      selective = default (selective, false)
      global info  = default ( info,      0 )
      global thr   = default ( thr,     1.9 )
      global algo  = default ( algo,  "h264")
      global dstr  = default ( dstr,     25 )
      dct   = default ( dct,       0 )
      thSAD = default ( thSAD,   400 )
      mc    = default ( mc,     true )
      c
      BlockDetect()
      if (selective==true) {
      ScriptClip("""
       blockiness = (propGetAny("blockiness_y")*2 + propGetAny("blockiness_u") + propGetAny("blockiness_v"))/4
       badflag = blockiness > thr ? true : false
       if (info==1) {subtitle(string(badflag) + string(blockiness) +"("+ string(thr)+")")}
       fixed = simpleD ()
       ConditionalFilter(last, fixed, last, "badflag", "==", "true", false)
       """)
       } else { simpleD () } #algo=algo, dstr=dstr
    
      if (mc==true) {
        addborders(8,8,16,8)
        bs = 8
        tr = 1
        mt=false
        sc_full = MSuper(hpad=0,vpad=0)
        sc_ds  =  BicubicResize (width/2,height/2).MSuper(hpad=0,vpad=0)
        mv_ds  =  sc_ds.MAnalyse (multi=true, delta=tr, dct=dct, blksize=bs, mt=mt)
        mv_dsr =  sc_ds.MRecalculate (mv_ds, tr=tr, dct=dct, blksize=bs/2, overlap=bs/4, thSAD=150, mt=mt)
        mv     =  mv_dsr.MScaleVect(2)
        MDegrainN (sc_full, mv, tr, thSAD=thSAD, thSAD2=400, limit=10, mt=mt)
        crop(8,8,-16,-8) }
      return last
     }
    
      function simpleD (clip c) { #, string "algo", int "dstr"
         c
         if (algo=="pp7") { vsDeblockPP7(qp=dstr,mode=2) }
         if (algo=="h264") { 
         h0 = height()
         Deblock (quant=dstr, aOffset=0, bOffset=0, planes="yuv")
         diff = h0 - height()
         (diff > 0 ) ? crop(0,0,0,-diff) : last }
        }
    Quote Quote  
  26. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    @Buzz1891, thanks, now stuck on "Denoiser_vhs". There is a reference to it on Gleitz in 2008 but nowhere else.
    Quote Quote  
  27. Originally Posted by Alwyn View Post
    @Buzz1891, thanks, now stuck on "Denoiser_vhs". There is a reference to it on Gleitz in 2008 but nowhere else.
    That's also custom script. I did shared it but not here, and it's not visible to google, because it's sort of all-in-1 package (hopefully)adapted for beginners
    https://www.youtube.com/watch?v=2NilYO-9YvM (download links is in the video description there)

    The code of Denoiser_vhs function:
    Code:
    function Denoiser_VHS (clip c, int "blocksize", int "dct", int "tr", bool "force8bit") {
    
      blocksize = default ( blocksize,  16)
      dct       = default ( dct,        0 )
      tr        = default ( tr,         9 )
      force8bit  = default ( force8bit, false)
      force8bit ? c.ConvertBits(8, dither=1) : c
    
      fc = D()   ### filtered clip to be used along with mask in the next stage
      #return fc
      if ( true ) {   [* selective denoise via masks. Set to 'false' to disable *]
      m_fpx = mt_motion (thY1=7, thY2=7, thT=25, chroma="-128")                    ### flickering pixels
      m_edges = mt_edge (mode="prewitt", thY1=35, thY2=85, chroma="-128")          ### edges to substract
      m_motion = mt_logic (m_edges, m_fpx, mode="andn")                            ### flick px minus edges
      m_shadows = mt_binarize (threshold=70, upper=true, chroma="-128")            ### shadows mask
      m_combined = mt_logic(m_motion, m_shadows, mode="or")                        ### combined 3-in-1 mask
      mt_merge (fc, m_combined, luma=true) }                                       ### merge of source and fc via created mask
      Prefetch(4,4) ### it's placed here specifically to make fft3dfilter work ~2x faster
      [* To see the mask uncomment the line below *]
         #return m_fpx
         #return m_edges
         #return m_motion
         #return m_shadows
         #return m_combined
      #return last
      #### Filtering options, for info about parameters check documentation folder
      function A (clip c) {c.RemoveGrain(7)}                             ### rg modes by strength: [0,1,2,7,8,22,17,12,19]
      function B (clip c) {c.vsDegrainMedian(5,5,modeY=2)}
      function C (clip c) {c.FluxSmoothT(7)}
      function D (clip c) {c.FFT3Dfilter (wintype=1, bt=2, sigma=2, sigma2=2, sigma3=8.0, sigma4=5.0, beta=2, plane=0, ncpu=2)}
      function E (clip c) {c.neo_vd (threshold=3, method=1, nsteps=5, y=2,u=3,v=3, percent=70)}
      function F (clip c) {c.hqdn3d (ls=0,cs=0, lt=6,ct=3, y=3,u=3,v=3)}
      
      [* Next parameters have major influence on result:
           tr - Temporal radius in frames. Larger radius => less grain. But also slower and less sharp. Reasonable range: [1..6]
           bs - Block size. Larger blocks are faster, but also less accurate. Most used sizes: [8,12,16,24,32,48,64]
        thSAD - Larger means stronger filtering. But too large values can produce ghosting/blur (Default is 400).
       thSAD2 - Soft threshold for the furthest frames. Setting thSAD2 < thSAD allows large temporal radius and good efficiency while reducing the risk of blurring *]
      
      mt=false  tr=tr  bs=blocksize  thSAD=1000  thSAD2=200  scaleCSAD=0  limit=255
      if ( Fmod(bs, 8) > 0 ) { overlap=2 } else { overlap=bs/4 }
      
      AddBorders(8,8,16,8)
      pre = B()
      sc_full = pre.MSuper(hpad=0,vpad=0, mt=mt)
      tmp = pre.BicubicResize (width/2,height/2)
      emask = tmp.mt_edge (mode="prewitt", thY1=25, thY2=25, chroma="-128")
      if ( true ) {
        pre_ds = mt_merge (tmp, RemoveGrain(tmp,0), emask, luma=true).vsDegrainMedian(5,5,modeY=2)
        sc_ds  = pre_ds.MSuper (hpad=0,vpad=0, mt=mt)
        mv_ds  =  sc_ds.MAnalyse (multi=true, delta=tr, blksize=bs, mt=mt, scaleCSAD=scaleCSAD, dct=dct)
        mv_dsr =  sc_ds.MRecalculate (mv_ds, tr=tr, blksize=bs/2, overlap=overlap, thSAD=100, mt=mt, scaleCSAD=scaleCSAD, dct=dct)
        mv     =  mv_dsr.MScaleVect(2)
        MDegrainN (sc_full, mv, tr, thSAD=thSAD, thSAD2=thSAD2, limit=limit, mt=mt) }
      Crop(8,8,-16,-8)
      
      #### Optional post-denoise sharpening
      #CAS(0.5)
     }
    Quote Quote  
  28. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    @Buzz, thank you, working well now.
    Quote Quote  
  29. Slightly different interpolating approach

    Code:
    ffms2("VTS_27_1 videohelp.mkv")
    assumeTFF()
    QTGMC(preset="fast")
    Selectevery(4,1,3) #25fps
    #25->50 interpolation:
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:l=>rgb:709:709:f")
    RIFE(gpu_thread=1, model=28, fps_num=50000, fps_den=1000, sc=true, sc_threshold=0.12)
    z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:f=>709:709:709:l")
    Image Attached Files
    Quote Quote  
  30. Originally Posted by Sharc View Post
    Slightly different interpolating approach

    Code:
    ffms2("VTS_27_1 videohelp.mkv")
    assumeTFF()
    QTGMC(preset="fast")
    Selectevery(4,1,3) #25fps
    #25->50 interpolation:
    z_ConvertFormat(pixel_type="RGBPS", colorspace_op="709:709:709:l=>rgb:709:709:f")
    RIFE(gpu_thread=1, model=28, fps_num=50000, fps_den=1000, sc=true, sc_threshold=0.12)
    z_ConvertFormat(pixel_type="YUV420P8", colorspace_op="rgb:709:709:f=>709:709:709:l")
    Interesting, is there a way to try it in StaxRip?
    Quote Quote  



Similar Threads

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