VideoHelp Forum

Try DVDFab and copy Ultra HD Blu-rays and DVDs! Or rip iTunes movies and music! Download free trial !
+ Reply to Thread
Results 1 to 23 of 23
Thread
  1. I have a very small section of an interlaced source that has been resized. In the past I've had success dealing with this issue by running vInverse on each field, but this workaround is only effective when the combing artefacts are 2 px high, which is not the case here. I'm not really sure this clip can be repaired, thoughts? https://mega.nz/file/L4xiGArR#aehp68-Ba5CXdVl-W0neDm-uezEV5dB51GSZDcOVXKk

    Thank you.
    Quote Quote  
  2. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    That file seems to be interlaced. Give Qtgmc a try (or Yadif)
    Quote Quote  
  3. No I know it's interlaced. But there are extra artefacts after the deinterlacing process.
    Quote Quote  
  4. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    Oops-yes I see it. As well as the resize while interlaced, it's also encoded to progressive AVC - Another blow
    to the quality.
    I think jagabo and possibly johnmeyer were talking about this recently.
    might have to do a forum search
    You could try blend deinterlace followed by vertical resize by half and then back,
    but this source is so poor.
    cant you find a better source?
    Quote Quote  
  5. Yes, this is virtually identical to the wrongly-resized interlaced concert footage that I was able to significantly improve. Here is the link to the doom9.org thread. You'll see that it took several days, and lots of help from other people, but we ended up making the video look a heck of a lot better:

    repair bad deinterlacing

    I re-imported all of the pictures for my posts, but the Photobucket debacle has killed quite a few of the photos in other people's posts. I think you'll still be able to figure out what to do.
    Quote Quote  
  6. I'll try to get it to work on this clip. I understand the basic idea so hopefully I can manage. Thankfully the broken section is very short (the clip is actually the whole thing) so it should be fast enough.
    Quote Quote  
  7. Alas, I am stuck

    Code:
    source = DGSource("D:\Ripping\VOB\V02-P01-00.dgi").AssumeTFF().QTGMC(preset="fast", fpsdivisor=2).selectEven()
    prev = selectEvery(source, 1, -1)
    
    super = MSuper(prev, pel=2)
    vfe=manalyse(super,truemotion=true,isb=false,delta=1)
    vbe=manalyse(super,truemotion=true,isb=true,delta=1)
    prev_est = mflowinter(prev, super,vbe,vfe,time=50)
    
    source = source.convertToRGB()
    prev_est = prev_est.convertToRGB()
    
    c1 = crop(source,0,5,576,2)
    c2 = crop(prev_est,0,7,576,3)
    c3 = crop(source,0,10,576,2)
    c4 = crop(prev_est,0,12,576,3)
    c5 = crop(source,0,15,576,2)
    c6 = crop(prev_est,0,17,576,3)
    c7 = crop(source,0,20,576,2)
    c8 = crop(prev_est,0,22,576,3)
    c9 = crop(source,0,25,576,2)
    c10 = crop(prev_est,0,27,576,3)
    c11 = crop(source,0,30,576,2)
    c12 = crop(prev_est,0,32,576,3)
    c13 = crop(source,0,35,576,2)
    c14 = crop(prev_est,0,37,576,3)
    c15 = crop(source,0,40,576,2)
    c16 = crop(prev_est,0,42,576,3)
    c17 = crop(source,0,45,576,2)
    c18 = crop(prev_est,0,47,576,3)
    c19 = crop(source,0,50,576,2)
    c20 = crop(prev_est,0,52,576,3)
    c21 = crop(source,0,55,576,2)
    c22 = crop(prev_est,0,57,576,3)
    c23 = crop(source,0,60,576,2)
    c24 = crop(prev_est,0,62,576,3)
    c25 = crop(source,0,65,576,2)
    
    t = blankClip(length=FrameCount(source), width=720, height=576, fps=25, color=$000000)
    t1 = overlay(t ,c1,0,5)
    t1 = overlay(t1,c2,0,7)
    t1 = overlay(t1,c3,0,10)
    t1 = overlay(t1,c4,0,12)
    t1 = overlay(t1,c5,0,15)
    t1 = overlay(t1,c6,0,17)
    t1 = overlay(t1,c7,0,20)
    t1 = overlay(t1,c8,0,22)
    t1 = overlay(t1,c9,0,25)
    t1 = overlay(t1,c10,0,27)
    t1 = overlay(t1,c11,0,30)
    t1 = overlay(t1,c12,0,32)
    t1 = overlay(t1,c13,0,35)
    t1 = overlay(t1,c14,0,37)
    t1 = overlay(t1,c15,0,40)
    t1 = overlay(t1,c16,0,42)
    t1 = overlay(t1,c17,0,45)
    t1 = overlay(t1,c18,0,47)
    t1 = overlay(t1,c19,0,50)
    t1 = overlay(t1,c20,0,52)
    t1 = overlay(t1,c21,0,55)
    t1 = overlay(t1,c22,0,57)
    t1 = overlay(t1,c23,0,60)
    t1 = overlay(t1,c24,0,62)
    t1 = overlay(t1,c25,0,65)
    
    return t1.converttoyuy2()
    Had to selectEven because the clip also has duplicates and effectively contains only 12.5 fps worth of information. Also had to convert to RGB otherwise the non-mod2 cropping would not work. It looks to me that there are 5 garbage pixels at the top then an alternating pattern of 2 px and 3 px. However it does not work. I think I'm messing up which part should be taken from which clip maybe? I've tried reversing but no luck.
    Quote Quote  
  8. You have to get rid of pure duplicates before you can do anything else. It's probably a film source, so TFM/TDecimate should work (i.e., inverse telecine).
    Last edited by johnmeyer; 21st Aug 2020 at 09:30. Reason: typo
    Quote Quote  
  9. It's not a film source however. That's the problem, I believe. They may all be orphaned fields. The source is 25i, however frames are interlaced on themselves (I don't know if that makes sense) so that in reality it's only 25p. If you deinterlace the clip you can clearly see that it must be done with qtgmc(fpsdivisor=2) but after *that* you are still left with one dupe per deinterlaced frame. It's some sort of VFX and it's a hell of a mess...
    Quote Quote  
  10. Maybe I'm doing something wrong, but it appears to me to be 12.5 fps with every other frame missing.
    Quote Quote  
  11. What do you mean by "every other frame missing"? If I decimate to 12.5 (with qtgmc(fpsdivisor=2).selectEven()) I'm left with no duplicates and no apparent missing frames in the motion.
    Quote Quote  
  12. Originally Posted by ZetaStax View Post
    What do you mean by "every other frame missing"? If I decimate to 12.5 (with qtgmc(fpsdivisor=2).selectEven()) I'm left with no duplicates and no apparent missing frames in the motion.
    Examine the fields with SeparateFields(). You have groups of 4 consecutive fields that belong the the same moment in time. So the content is 12.5 fps. If there was 2 in a row, it would be 25p . If was different every field, it would be real interlaced 25i (50 different fields/s)
    Quote Quote  
  13. See, that's what I don't understand. I'm saying it's 12.5 from the start. Or are you saying that it cannot be fixed because of those missing frames from the original 25i?
    Quote Quote  
  14. Originally Posted by ZetaStax View Post
    See, that's what I don't understand. I'm saying it's 12.5 from the start. Or are you saying that it cannot be fixed because of those missing frames from the original 25i?
    You only have 12.5 fps "worth" of information. Check the fields in the source

    If you "fix" the resizing issue, you might be able to interpolate it back to 25p (but you will have artifacts on this type of content)
    Quote Quote  
  15. I don't even know what you mean by "fixed." You are missing a huge amount of temporal information. If it really was interlaced video to start with, then at one point you had 50 events per second (25 frames, but 50 interlaced fields). You now have only two moments in time for every four fields, so you have lost 50% of the temporal information.

    You have to fix the temporal problems before you can do anything about any resizing problems. The simple thing is to decimate the duplicate frame, leaving you with a 12.5 fps interlaced video. You could then fix the resizing mess and, after doing that, use motion estimation to bring the video speed back up to 25 fps progressive or 50 fps interlaced.

    It won't look very good, even after all that work.
    Quote Quote  
  16. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    I notice with some amusement that the clip i commented on above is not the same clip
    associated with this thread. Somehow I downloaded this file but then analyzed a shoot up and explosion video.
    I would also ask what would be an acceptable result?
    Here's an example of using TFM to match the fields, vertical BilinearResize down and up, 25 FPS
    Image Attached Files
    Quote Quote  
  17. Originally Posted by johnmeyer View Post
    You have to fix the temporal problems before you can do anything about any resizing problems. The simple thing is to decimate the duplicate frame, leaving you with a 12.5 fps interlaced video.
    Isn't this exactly what I'm doing? QTGMC deinterlaces the clip to 50p, brought down to 25p by fpsdivisor, brought down to 12.5 by selectEven. There's something I'm missing from what you are all saying. I understand it's a misunderstanding or misconception from my part, but I just can't see it.

    Originally Posted by davexnet
    I would also ask what would be an acceptable result?
    I'm clearly not excepting some kind of magic here. Fortunately it's a small segment. I'd like to get rid of the combing, which is very distracting, even if it means a major loss in details.
    Quote Quote  
  18. Member
    Join Date
    Mar 2008
    Location
    United States
    Search Comp PM
    You can add blur; it's still visible, reduced a little
    Code:
    mpeg2source("C:\Users\davex\Desktop\guitar.d2v")
    tfm()
    blur(0,1.5)
    BilinearResize(width,height/2)
    BilinearResize(width,height*2)
    What did you try yourself? Did you get anything promising?
    Quote Quote  
  19. Originally Posted by ZetaStax View Post
    I'd like to get rid of the combing, which is very distracting, even if it means a major loss in details.
    Code:
    Spline36Resize(width, height/4).Spline36Resize(width, height).SelectEven()
    Quote Quote  
  20. Originally Posted by jagabo View Post
    Code:
    Spline36Resize(width, height/4).Spline36Resize(width, height).SelectEven()
    Now that's quite good actually! Why do you downscale to a quarter exactly? It woud make sense to me if the artifacts were 4 px high.

    Originally Posted by davexnet
    What did you try yourself? Did you get anything promising?
    I was trying to apply the idea of johnmeyer of manually cropping stripes from the frames to stitch back together. However I cannot find another frame that it would match with (probably, it's lost).
    Quote Quote  
  21. Originally Posted by ZetaStax View Post
    Originally Posted by jagabo View Post
    Code:
    Spline36Resize(width, height/4).Spline36Resize(width, height).SelectEven()
    Now that's quite good actually! Why do you downscale to a quarter exactly? It woud make sense to me if the artifacts were 4 px high.
    I tried height/2, and height/3. Both still had obvious banding. At height/4 the banding was nearly gone. You could try other heights but a quick test shows visible banding over 144 lines, not much improvement below 144 lines (and the picture gets blurrier).

    Code:
    function DownUp(clip v, int height)
    {
        v.Spline36Resize(v.width, height)
        Spline36Resize(v.width, v.height)
        Subtitle(string(height))
    }
    
    Mpeg2Source("2020-08-20.demuxed.d2v", CPU2="ooooxx", Info=3) 
    Trim(34,0) # pick one frame
    Loop(576,0,0) #repeat it 576 times
    ConvertToYV24() # YV24 so odd heights are ok
    Animate(0,560, "DownUp", last,576, last,16) # show them
    You might try something sharper for upscaling -- like nnedi3_rpow2() and some aWarpSharp2() and Sharpen(0.0, 0.x)

    This looks pretty good:

    Code:
    SelectEven()
    Spline36Resize(width, height/4)
    # instead of Spline36Resize(width, height*4):
    aWarpSharp2(depth=5)
    Sharpen(0.0, 0.3)
    nnedi3_rpow2(4, cshift="Spline36Resize", fwidth=width, fheight=height*4)
    aWarpSharp2(depth=5)
    Sharpen(0.0, 0.5)
    Last edited by jagabo; 21st Aug 2020 at 17:38.
    Quote Quote  
  22. I spent a little time with this and realized that the decimation may not be just 2:1 but may actually be 4:1. If you play the original clip, posted in #1 above, isn't it already playing at twice normal speed? If so, given that it only has 12.5 actual frames per second, to get it to play at 25 fps at normal speed will require inserting three new frames between each existing frame. This will give you a 4x increase in the number of frames which, when starting from 12.5 fps, is going to introduce some pretty spectacular motion-estimation artifacts.

    So, I punted on slowing it down.

    Here is the code I used to get it be 25 fps, but at the speed of the original clip. Note that I threw away the bad field and then did a simple Bob to create the other field from the existing field (I may not have the Bob parameters set correctly. It was a quick and dirty way to get rid of 80% of the horizontal line problem.

    I have attached the result of the script below:

    Code:
    loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
    loadPlugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\TIVTC.dll")
    loadPlugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\Film Restoration\Script_and_Plugins\RemoveGrain.dll")
    
    AVISource("e:\fs.avi").killaudio().converttoYV12()
    
    AssumeTFF()
    
    #Remove all the duplicate fields
    tfm(display=false)  #consider adding cthresh=255
    tdecimate(display=false,mode=0,cycleR=2,cycle=4) #18 fps  # 3:3:4 field count
    
    #Create full frames from each field
    bob(0.0,1.0)
    
    #Select the better of the two frames
    source = selecteven()
    
    #Create a new frame between each existing frame in order to go from 12.5 fps to 25.0 fps.
    prefiltered = RemoveGrain(source,22)
    super = MSuper(source,hpad=16, vpad=16, levels=1) # one level is enough for MRecalculate
    superfilt = MSuper(prefiltered, hpad=16, vpad=16) # all levels for MAnalyse
    backward = MAnalyse(superfilt, isb = true, blksize=16,overlap=4,search=3,dct=0)
    forward = MAnalyse(superfilt, isb = false, blksize=16,overlap=4,search=3,dct=0)
    forward_re = MRecalculate(super, forward, blksize=8, overlap=2, thSAD=100)
    backward_re = MRecalculate(super, backward, blksize=8, overlap=2, thSAD=100)
    output=MFlowFps(source,super, backward_re, forward_re, num=25, den=1,ml=200,mask=2)
    
    #Take the motion-estimated frame and interleave it with the original frames (probably not needed but it 100% ensures that you only get 50% motion
    #estimate frames, and the other 50% are the frames from the Bob().
    output=output.selectodd()
    interleave(source,output)
    To get it to play at the correct speed I changed num to num=50, and got rid of the last two statements. The only problem is that the motion estimation artifacts become really ugly because, when starting from only 12.5 fps, the temporal gaps are just too large for the motion estimation to fill in correctly.
    Image Attached Files
    Last edited by johnmeyer; 21st Aug 2020 at 18:36. Reason: added comments to the code
    Quote Quote  
  23. Thank you all for your hard work. In the end I prefer jagabo's solution. Considering the length of the section compared to that of the whole 90 min. footage, the loss in details is pretty much cannot be noticed. And it has the advantage of getting rid of the artefacts.
    Quote Quote  



Similar Threads