VideoHelp Forum

+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Hi,

    I've got this capture (unfortunately I don't have access to the original tape) that I'm trying to restore. The frame is stable and the luma doesn't flicker throughout most of the video, except at two points lasting a couple of minutes each. I've tried to remove, or at least reduce, the flickering at those points with the deflicker plugin in avisynth, but I've had absolutely no luck in reducing the flickering. I'm thinking that the issue on the capture might not even be flickering and that it might need to be treated in a different way. It'd be amazing if anyone could tell me what's up with this capture and how I should correct the flickering (or whatever issue it is) that plagues it.

    Thanks
    Image Attached Files
    Quote Quote  
  2. That looks like an OTA recording where an airplane flew nearby. I used to see this all the time back in the 1960s when I lived in Chicago near O'Hare airport.

    You might try using the MDegrain part of MVTools2. Just use the lines from one of the examples in the documentation. However, to remove flicker, change DCT in the MAnalyze line from the default of DCT=0 to DCT=1. It makes the script run really slow, but it can often perform miracles on flicker. In addition, you'll be able to get rid of the considerable noise in that capture.
    Quote Quote  
  3. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Ran the script and it was extremely slow, so that's a good sign
    The script has definitely improved the flickering situation, but there's still a lot left. Do you reckon it'd be possible to run this processed file through some more deflickering filters to get better results?
    Image Attached Files
    Quote Quote  
  4. Code:
    clip = havsfunc.QTGMC(Input=clip, Preset="Fast", TFF=False) # new fps: 25
    # make sure content is preceived as frame based
    clip = core.std.SetFieldBased(clip, 0)
    clip = clip[::2]
    # rainbow removal using SSIQ
    clip = core.ssiq.SSIQ(clip=clip, interlaced=0)
    # removing grain using TemporalDegrain
    clip = havsfunc.TemporalDegrain(inpClip=clip)
    QTGMC for deinterlacing, TemporalDegrain for grain removal, SSIQ for rainbow removal looks decent (additional tweaking and some color adjustments might also help further)

    additionally some dehaloing migth also be a good idea.

    Okay, forget that. I used Vapoursynth not Avisynth.
    But similar and better should be easily doable with Avisynth and some tweaking.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Thanks for that! I'm on linux so I already have to use a combination of vapoursynth, avisynth+ and avisynth running through wine to cover my needs, so it being a vapoursynth script definitely is not a problem. Is this script meant to be run on the (somewhat) deflickered file or the original, unprocessed mpg? If it was on the deflickered file wouldn't denoising twice get rid of an unnacceptable amount of detail?
    Quote Quote  
  6. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    I've now tried running my video through the VDub filter 'MSU Deflicker' (comparison clip attached) The results aren't as good as what I achieved with MDegrain. I'm seriously considering manually adjusting the gamma levels myself, as tedious as that would be. Are there any kind of tools I could use that would make that sort of task less tedious to do?
    Image Attached Files
    Quote Quote  
  7. Is this script meant to be run on the (somewhat) deflickered file or the original, unprocessed mpg
    I didn't look at the deflickered file, but used the mpg file as source.
    (don't really see anything I would call flickering, I mainly see chroma noise, rainbows and normal noise,..)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  8. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Well the gamma/brightness level definitely fluctuates at several points in the sample I posted. At 55 seconds in the video is definitely flickering.
    Quote Quote  
  9. Sorry, you are totally missed that part of the video *gig*
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  10. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    No worries Selur, it's an easy enough mistake to make. Reckon I might just adjust the gamma manually using an NLE (thank god for keyframes!) I've also made this script to stabilise the video for when it occasionally becomes unstable. Any improvements I could make to it?

    Code:
    from vapoursynth import core
    import havsfunc as haf
    
    clip = core.lsmas.LWLibavSource(source='Sample.mpg')
    clip = haf.QTGMC(clip, Preset='Slow', TFF=False)
    clip = core.std.Crop(clip, top=2, bottom=16, left=8, right=8)
    data = core.mv.DepanEstimate(clip, dymax=0)
    clip = core.mv.DepanStabilise(clip, data, dymax=0)
    clip = core.std.Crop(clip, 28, 6, 0, 0)
    clip = core.std.AddBorders(clip, 28, 6, 0, 0)
    clip.set_output()
    Last edited by servese; 2nd Aug 2021 at 04:03.
    Quote Quote  
  11. Member
    Join Date
    May 2005
    Location
    Australia
    Search Comp PM
    Neat video.
    Image Attached Files
    Quote Quote  
  12. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Change of plan. Manually adjusting the luma is definitely something I'd put into the 'easier said than done' category. I'll play around with some more filters and see what results I can get. Also I found this thread which looks interesting:

    https://forum.videohelp.com/threads/341188-Still-have-flicker-after-Denoising-with-AviSynth
    Quote Quote  
  13. I haven't been following this thread too closely, but I finally got onto my office computer and used the following script to produce this:

    https://www.mediafire.com/file/pmln13v8csd0a1k/Deflickered.mp4/file

    There is still some back and forth shimmer from the multi-path interference, and there is still some flickering at the end, but most of the flicker before that is reduced or eliminated. If this was for my own use, and I had the time, I'd play around with the Deflicker parameters and see if I could tune out more of the flicker.

    Code:
    #Deflicker for interlaced video using MDegrain2
    #SetMemoryMax(768)
    
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\QTGMC\mvtools2.dll")
    LoadPlugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\Cnr2.dll")
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\Film Restoration\Script_and_Plugins\Deflicker.dll")
    Loadplugin("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\Film Restoration\Script_and_Plugins\autolevels.dll")
    #Import("E:\Documents\My Videos\AVISynth\AVISynth Plugins\plugins\Film Restoration\Script_and_Plugins\LimitedSharpenFaster.avs")
    
    #Modify this line to point to your video file
    source=AVISource("E:\fs.avi").killaudio()
    
    output=MDegrain2i2(source,8,4,400,1)  #The DCT=1 setting really helps nail the flicker
    
    #stackhorizontal(source,output)
    
    return output
    
    /*
    Interleave(
    \    source
    \  , output
    \ )
    */
    
    # Enable MT!
    Prefetch(6)
    
    #-------------------------------
    
    function MDegrain2i2(clip source, int "blksize", int "overlap", int "denoising_strength", int "dct")
    {
    overlap=default(overlap,0) # overlap value (0 to 4 for blksize=8)
    dct=default(dct,0) # use dct=1 for clip with light flicker
    
    fields=source.SeparateFields()
    
    fixed_fields=fields.deflicker(debug=false,scene=200,percent=60,lag=25,lmax=225,lmin=20,noise=10,border=0)
    
    super = fixed_fields.MSuper(pel=2, sharp=1)
    backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
    forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
    backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
    forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
    
    MDegrain2(fixed_fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=denoising_strength) 
    
    Weave()
    }
    Quote Quote  
  14. Member
    Join Date
    Dec 2019
    Location
    Australia
    Search Comp PM
    Thanks so much! That really does an amazing job at getting rid of the flickering.
    Quote Quote