VideoHelp Forum

+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 54 of 54
Thread
  1. You need the RemoveDirtMC filter. There are several variations around. Here's the one that I used.

    Code:
    #####################################################################
    #
    # https://forum.videohelp.com/threads/382527-Need-help-setting-up-avisynth-pls%21?p=2477423&viewfull=1#post2477423
    #
    ######################################################################
    
    #REMOVE DIRT FUNCTION
    #......................................................................................................................................................................
    function RemoveDirt(clip input, int "limit", bool "_grey")
    {
      clensed=input.Clense(grey=_grey, cache=4)
      alt=input.RemoveGrain(2)
      return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=30,cthreshold=8, gmthreshold=40,dist=3,dmode=2,debug=false,noise=limit,noisy=4, grey=_grey)
    
      # Alternative settings
      # return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=4,cthreshold=6, gmthreshold=40,dist=1,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=true)
      # return RestoreMotionBlocks(clensed,input,alternative=alt,pthreshold=6,cthreshold=8, gmthreshold=40,dist=3,tolerance= 12,dmode=2,debug=false,noise=limit,noisy=12,grey=_grey,show=false)
    }
    
    function RemoveDirtMC(clip, int "limit", bool "_grey")
    {
      _grey=default(_grey, false)
      limit = default(limit,6)
    
    #  prefiltered = fft3dfilter(clip,sigma=1,sigma2=2,sigma3=3,sigma4=5,bw=64,bh=64)
      
      prefiltered = RemoveGrain(clip,2)
      superfilt = MSuper(prefiltered, hpad=32, vpad=32,pel=2)
    
      super=MSuper(clip, hpad=32, vpad=32,pel=2)
    
      bvec = MAnalyse(superfilt,isb=true,  blksize=16, overlap=2,delta=1, truemotion=true)
      fvec = MAnalyse(superfilt,isb=false, blksize=16, overlap=2,delta=1, truemotion=true)
    
    # Increase thSAD if moving objects are being removed!!
      bvec_re = Mrecalculate(super,bvec,blksize=8, overlap=0,thSAD=20)
      fvec_re = Mrecalculate(super,fvec,blksize=8, overlap=0,thSAD=20)
    
      backw = MFlow(clip,super,bvec_re,thSCD1=900,thSCD2=200)
      forw  = MFlow(clip,super,fvec_re,thSCD1=900,thSCD2=200)
    
      clp=interleave(forw,clip,backw)
      clp=clp.RemoveDirt(limit,_grey)
    
    
    # Alternative to RemoveDirt call above
    #  clp     = clp.DeSpot(p1=20, p2=4, pwidth=30, pheight=30, mthres=22, merode=33, sign=1,  seg=0, color=false, \
    #                       motpn=false, fitluma=true, mark_v=255)
    
    #  clp     = clp.invert.DeSpot(p1=12, p2=6, pwidth=18, pheight=16, mthres=22, merode=25, p1percent=10, sign=1, show=Show, seg=1, \
    #                       color=true, motpn=false, mark_v=255).invert
    
    
      clp=clp.SelectEvery(3,1)
      return clp
    }
    Put that in an AVSI file in the plugins64+ folder. Or plugins+ for 32 bit.

    I'm not sure if it requires any other filters you don't already have...
    Last edited by jagabo; 15th Jan 2022 at 10:49.
    Quote Quote  
  2. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    OK I finally got back to this project after a busy week, had to download AWarpSharp & CAS and I finally got it to load in Vdub2... so now I shall convert things....

    Thanks for all your help!!!
    Quote Quote  
  3. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    ok so things were goin just fine then it got stuck on a frame in the full length video.... and it's been stuck there for 4 hours lol

    here's my status dump

    Code:
    =================
    Processing thread
    =================
    
    Completed:         No
    Error encountered: No
    Video push ended:      No
    Video ended:           No
    Flushing compressor:   No
    Codec frames buffered: 0
    
    Video input pipe:
      0/32 buffers active (0 non-preload frames)
      No buffers pending.
    
    Pending source frames: 32
      Frame 6242 | Batch 6242 | Pending
      Frame 6243 | Batch 6243 | Pending
      Frame 6244 | Batch 6244 | Pending
      Frame 6245 | Batch 6245 | Pending
      Frame 6246 | Batch 6246 | Pending
      Frame 6247 | Batch 6247 | Pending
      Frame 6248 | Batch 6248 | Pending
      Frame 6249 | Batch 6249 | Pending
      Frame 6250 | Batch 6250 | Pending
      Frame 6251 | Batch 6251 | Pending
      Frame 6252 | Batch 6252 | Pending
      Frame 6253 | Batch 6253 | Pending
      Frame 6254 | Batch 6254 | Pending
      Frame 6255 | Batch 6255 | Pending
      Frame 6256 | Batch 6256 | Pending
      Frame 6257 | Batch 6257 | Pending
      Frame 6258 | Batch 6258 | Pending
      Frame 6259 | Batch 6259 | Pending
      Frame 6260 | Batch 6260 | Pending
      Frame 6261 | Batch 6261 | Pending
      Frame 6262 | Batch 6262 | Pending
      Frame 6263 | Batch 6263 | Pending
      Frame 6264 | Batch 6264 | Pending
      Frame 6265 | Batch 6265 | Pending
      Frame 6266 | Batch 6266 | Pending
      Frame 6267 | Batch 6267 | Pending
      Frame 6268 | Batch 6268 | Pending
      Frame 6269 | Batch 6269 | Pending
      Frame 6270 | Batch 6270 | Pending
      Frame 6271 | Batch 6271 | Pending
      Frame 6272 | Batch 6272 | Pending
      Frame 6273 | Batch 6273 | Pending
    
    Pending output frames: 32
      Frame 6242 | Batch 6242 | Hold 0 | Null 0 | Direct 0
      Frame 6243 | Batch 6243 | Hold 0 | Null 0 | Direct 0
      Frame 6244 | Batch 6244 | Hold 0 | Null 0 | Direct 0
      Frame 6245 | Batch 6245 | Hold 0 | Null 0 | Direct 0
      Frame 6246 | Batch 6246 | Hold 0 | Null 0 | Direct 0
      Frame 6247 | Batch 6247 | Hold 0 | Null 0 | Direct 0
      Frame 6248 | Batch 6248 | Hold 0 | Null 0 | Direct 0
      Frame 6249 | Batch 6249 | Hold 0 | Null 0 | Direct 0
      Frame 6250 | Batch 6250 | Hold 0 | Null 0 | Direct 0
      Frame 6251 | Batch 6251 | Hold 0 | Null 0 | Direct 0
      Frame 6252 | Batch 6252 | Hold 0 | Null 0 | Direct 0
      Frame 6253 | Batch 6253 | Hold 0 | Null 0 | Direct 0
      Frame 6254 | Batch 6254 | Hold 0 | Null 0 | Direct 0
      Frame 6255 | Batch 6255 | Hold 0 | Null 0 | Direct 0
      Frame 6256 | Batch 6256 | Hold 0 | Null 0 | Direct 0
      Frame 6257 | Batch 6257 | Hold 0 | Null 0 | Direct 0
      Frame 6258 | Batch 6258 | Hold 0 | Null 0 | Direct 0
      Frame 6259 | Batch 6259 | Hold 0 | Null 0 | Direct 0
      Frame 6260 | Batch 6260 | Hold 0 | Null 0 | Direct 0
      Frame 6261 | Batch 6261 | Hold 0 | Null 0 | Direct 0
      Frame 6262 | Batch 6262 | Hold 0 | Null 0 | Direct 0
      Frame 6263 | Batch 6263 | Hold 0 | Null 0 | Direct 0
      Frame 6264 | Batch 6264 | Hold 0 | Null 0 | Direct 0
      Frame 6265 | Batch 6265 | Hold 0 | Null 0 | Direct 0
      Frame 6266 | Batch 6266 | Hold 0 | Null 0 | Direct 0
      Frame 6267 | Batch 6267 | Hold 0 | Null 0 | Direct 0
      Frame 6268 | Batch 6268 | Hold 0 | Null 0 | Direct 0
      Frame 6269 | Batch 6269 | Hold 0 | Null 0 | Direct 0
      Frame 6270 | Batch 6270 | Hold 0 | Null 0 | Direct 0
      Frame 6271 | Batch 6271 | Hold 0 | Null 0 | Direct 0
      Frame 6272 | Batch 6272 | Hold 0 | Null 0 | Direct 0
      Frame 6273 | Batch 6273 | Hold 0 | Null 0 | Direct 0
    
    Video filter system
    -------------------
    Current Log
    Image
    [Attachment 63085 - Click to enlarge]


    Any ideas??

    EDIT: Oh and did I mention when I click abort, it doesn't really stop and I have to kill the vdub2 process.....
    Last edited by Lord Rakim; 25th Jan 2022 at 11:02.
    Quote Quote  
  4. Sometimes just trying again will work. If you're using a lot of threads using fewer will usually help.
    Quote Quote  
  5. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by jagabo View Post
    Sometimes just trying again will work. If you're using a lot of threads using fewer will usually help.
    Well I'm on try #4 right now... it seems to have gotten further than the last time lol

    Using Lagarith for output (stopped on fram 6242).... think I'm gonna try Grass Valley Lossless for output and see if that comes out any better

    EDIT:GV Lossless stopped at frame 8840

    Gonna try ProRes next.... it froze too

    So I'm just gonna go uncompressed... hell I have the room lol it seems to be working just fine.... at 10700/16855 frames!

    So i rebooted the PC, started just Vdub2 and let it do uncompressed and it actually finished!
    Last edited by Lord Rakim; 25th Jan 2022 at 15:53. Reason: adding some output codec details
    Quote Quote  
  6. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by jagabo View Post
    Code:
    AssumeFPS(27.54)
    Is there are reason you used 27.54 instead of the original 29.97 fps??

    I'm goin to remux the finished video with the audio and I'm wondering if it's gonna be a problem....
    Quote Quote  
  7. Originally Posted by Lord Rakim View Post
    Originally Posted by jagabo View Post
    Code:
    AssumeFPS(27.54)
    Is there are reason you used 27.54 instead of the original 29.97 fps??
    DeDup removes frames but doesn't change the frame rate. Since there are now fewer frames reducing the frame rate maintains the original running time.

    Of course, 27.54 fps isn't suitable from some purposes. Making a DVD for example.
    Quote Quote  
  8. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by jagabo View Post
    DeDup removes frames but doesn't change the frame rate. Since there are now fewer frames reducing the frame rate maintains the original running time.

    Of course, 27.54 fps isn't suitable from some purposes. Making a DVD for example.
    O ok.... nah not making a DVD but the audio isn't in sync when I remux'd it back....

    guess I'll play around with the audio & video til I get it in sync.....
    Quote Quote  
  9. The timecodes (timestamps) keep it in sync "blah.times.txt" . They compensate for the dropped duplicate frames by adjusting the timestamps. You mux that into the container, such as with mkvmerge or mp4fpsmod

    Or, if you want to re-introduce the (hard) duplicates (now clean) you can use VFR to CFR which will read the timestamps , or timecodefps
    http://avisynth.nl/index.php/VfrToCfr
    https://github.com/Asd-g/TimecodeFPS
    Quote Quote  
  10. Originally Posted by Lord Rakim View Post
    the audio isn't in sync when I remux'd it back....
    If you didn't use the exact same clip and the exact same settings you won't get the same change. You can take the original number of frames and the number of frames after dedup to calculate the correct frame rate:

    Code:
    new frame rate = old frame rate *  dedup frame count / original frame count
    Note that keeping the running time does not mean the audio will be in sync all the way through the video. Only the start and end are going to be in sync. But if your duplicate frame distribution isn't too irregular it should be alright.

    Originally Posted by poisondeathray View Post
    The timecodes (timestamps) keep it in sync "blah.times.txt" . They compensate for the dropped duplicate frames by adjusting the timestamps. You mux that into the container, such as with mkvmerge or mp4fpsmod
    Yes, that's another way to keep the running time. In fact it's better as it will keep the audio and video in sync all the way through.
    Quote Quote  
  11. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    soooo I got VfrtoCFr (and FFMS2 to use FFVideoSource) and created this script

    Code:
    FFVideoSource( "d:\videos\new\misc\clean up dungeon video-27fps.avi", timecodes="d:\videos\temp\blah.times.txt" )
    vfrtocfr( timecodes="d:\videos\temp\blah.times.txt", fpsnum=30000, fpsden=1001 )
    
    audiodub( FFAudioSource("d:\videos\temp\at_the_dungeon.clips.wav") )
    the video file is

    Code:
    Complete name                            : d:\videos\new\misc\clean up dungeon video-27fps.avi
    Format                                   : AVI
    Format/Info                              : Audio Video Interleave
    Format profile                           : OpenDML
    File size                                : 13.0 GiB
    Duration                                 : 10 min 12 s
    Overall bit rate                         : 183 Mb/s
    Writing library                          : VirtualDub2 build 44282/release
    and the audio file is

    Code:
    Complete name                            : D:\videos\temp\at_the_dungeon.clips.wav
    Format                                   : Wave
    File size                                : 107 MiB
    Duration                                 : 10 min 37 s
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 1 411 kb/s
    Writing application                      : Lavf57.65.100
    I used Pazera Free Audio Extractor 2.11 to convert to a WAV file which uses FFMPEG to convert... this may have been my problem in getting the files to sync... I'm goin to extract the original audio (which is VBR) just using Vdub2 to see if it makes a difference because the audio around the 2-3 min mark slowly drifts out of sync....

    I feel like I'm almost there lol

    EDIT: Used vdub to create a WAV file after getting a warning about VBR and here is the result

    Code:
    Complete name                            : d:\videos\temp\at_the_dungeon.clips-fromvdub1.wav
    Format                                   : Wave
    File size                                : 107 MiB
    Duration                                 : 10 min 37 s
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 1 411 kb/s
    using vdub 2 with no VBR warning

    Code:
    Complete name                            : D:\videos\temp\at_the_dungeon.clips-fromvdub2.wav
    Format                                   : Wave
    File size                                : 107 MiB
    Duration                                 : 10 min 37 s
    Overall bit rate mode                    : Constant
    Overall bit rate                         : 1 411 kb/s
    and the 3 WAV file look according to MediaInfo virtually indentical.... the filesizes are slightly different

    pazera - 112,541,262
    vdub1 - 112,508,820
    vdub2 - 112,508,700
    Last edited by Lord Rakim; 27th Jan 2022 at 11:25.
    Quote Quote  
  12. FFVideoSource( "d:\videos\new\misc\clean up dungeon video-27fps.avi", timecodes="d:\videos\temp\blah.times.txt"
    FFVideoSource timecodes="" is for writing timecodes, not reading timecodes
    ("timecodes" and "timestamps" are the samething BTW)

    So if you ran that, you overwrote the original blah.times.txt data from dedup

    When you run the original script, and mux in timecodes (timestamps) with either mkvmerge or mp4fpsmod (or encode with x264 with the --tcfile-in option), that becomes VFR and in sync

    But if you wanted CFR , you can add vfr2cfr or timecodefps to the original script after dedup and the denoising ; or reading a VFR file directly
    Last edited by poisondeathray; 27th Jan 2022 at 11:26.
    Quote Quote  
  13. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by poisondeathray View Post
    FFVideoSource( "d:\videos\new\misc\clean up dungeon video-27fps.avi", timecodes="d:\videos\temp\blah.times.txt"
    FFVideoSource timecodes="" is for writing timecodes, not reading timecodes
    ("timecodes" and "timestamps" are the samething BTW)

    So if you ran that, you overwrote the original blah.times.txt data from dedup
    Ooops lol

    When you run the original script, and mux in timecodes (timestamps) with either mkvmerge or mp4fpsmod (or encode with x264 with the --tcfile-in option), that becomes VFR and in sync

    But if you wanted CFR , you can add vfr2cfr or timecodefps to the original script after dedup and the denoising ; or reading a VFR file directly
    I'm a bit confused, so with my 2nd script loading the AVI from the 1st script, I need to remove the "timecodes=" from the FFVideoSource line?

    So it looks like this?

    Code:
    FFVideoSource( "d:\videos\new\misc\clean up dungeon video-27fps.avi")
    vfrtocfr( timecodes="d:\videos\temp\blah.times.txt", fpsnum=30000, fpsden=1001 )
    
    audiodub( FFAudioSource("d:\videos\temp\at_the_dungeon.clips.wav") )
    Sounds like it might be better the redo the 1st script and encode the audio with the video to keep things timely.....
    Last edited by Lord Rakim; 27th Jan 2022 at 12:05.
    Quote Quote  
  14. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by poisondeathray View Post
    But if you wanted CFR , you can add vfr2cfr or timecodefps to the original script after dedup and the denoising ; or reading a VFR file directly

    Code:
    LWLibavVideoSource("at_the_dungeon.clips.avi", cache=false, prefer_hw=2) 
    Crop(0,8,-0,-16)
    
    #DupMC(log="blah.dup.txt") return(last)
    
    
    DeDup(threshold=5.0, trigger2=22, maxcopies=4, maxdrops=4, show=false, log="blah.dup.txt", times="blah.times.txt")
    
    SMDegrain (tr=9, thSAD=3000, refinemotion=false, contrasharp=false, PreFilter=0, mode=0, truemotion=true, plane=4, chroma=true)
    RemoveDirtMC()
    QTGMC(InputType=2, sharpness=0.3)
    CAS(0.5)
    nnedi3_rpow2(2, cshift="Spline36Resize")
    aWarpSharp2(depth=5)
    CAS(0.5)
    
    AssumeFPS(29.97)
    
    vfrtocfr( timecodes="d:\videos\temp\blah.times.txt", fpsnum=30000, fpsden=1001 )
    audiodub( FFAudioSource("d:\videos\temp\at_the_dungeon.clips.wav") )
    Ok so the new modified original script should look like this? And should I be adding in the audio at this step?

    EDIT: so i tried it this way and it ALMOST is perfectly in sync..... gonna try puttin the VFR & audio lines before AssumeFPS and see what happens....
    Last edited by Lord Rakim; 29th Jan 2022 at 09:22.
    Quote Quote  
  15. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    neither way has worked BUT i did find what I think is the original MPG i had before I encoded it into XVID... so maybe this will work better with the script to keep my audio in sync...
    Quote Quote  
  16. -For the 1st script after the 2nd pass encode, you add in the timecodes(timestamps) to make it in sync. You could use mkvtoolnix. This is producing VFR. Done. This will make it in sync. You do not have to add audio to the script, you can add original audio (no quality loss)

    -VFRtoCFR is for after you mux in timecodes . If you want to convert VFR BACK to CFR for some reason. It's a separate script . It essentially reverses (1) by adding in new duplicates where they were dropped. The difference is they are now clean duplicates. Duplicates were removed in the first place because they impair temporal filtering effectiveness
    Quote Quote  
  17. You can convert a VFR soure to CFR with source filters like LSMASHVideoSource() and ffVideoSource(). Just add numerator and denominator arguments.

    Code:
    LSMASHVideoSource("filename.mp4", fpsnum=NUM, fpsden=DEN)
    That will convert a VFR source to CFR at the frame rate NUM/DEN. For example, 24000/1001 for NTSC film. Of course, the source must be a proper VFR video with timecodes.
    Quote Quote  
  18. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    Originally Posted by poisondeathray View Post
    -For the 1st script after the 2nd pass encode, you add in the timecodes(timestamps) to make it in sync. You could use mkvtoolnix. This is producing VFR. Done. This will make it in sync. You do not have to add audio to the script, you can add original audio (no quality loss)
    How do I use MKVToolnix with the timecodes??? Talk to me like I'm 7 lol

    Been busy with other projects for work so my brain is not working right..... but I wanna learn how do this right if I have some similar projects that come up like a lot of old family footage....
    Quote Quote  
  19. Originally Posted by Lord Rakim View Post
    Originally Posted by poisondeathray View Post
    -For the 1st script after the 2nd pass encode, you add in the timecodes(timestamps) to make it in sync. You could use mkvtoolnix. This is producing VFR. Done. This will make it in sync. You do not have to add audio to the script, you can add original audio (no quality loss)
    How do I use MKVToolnix with the timecodes??? Talk to me like I'm 7 lol


    when you run the 1st pass there is a file produced times="blah.times.txt" . That "blah.times.txt" are the timecodes (timestamps) that keep everything in sync for VFR (duplicates were dropped from dedup, those timestamps compensate for those drops)

    If you're using the mkvtoolnix GUI , when you add your video, select the video track (left click) , and on the right column there is a field "Timpstamp file" . Push the button to the right and select the location for "blah.times.txt". Push start multiplexing
    Quote Quote  
  20. Tha Great
    Join Date
    Feb 2004
    Location
    DFW from the GoIll
    Search Comp PM
    [QUOTE=poisondeathray;2647559]
    Originally Posted by Lord Rakim View Post


    when you run the 1st pass there is a file produced times="blah.times.txt" . That "blah.times.txt" are the timecodes (timestamps) that keep everything in sync for VFR (duplicates were dropped from dedup, those timestamps compensate for those drops)

    If you're using the mkvtoolnix GUI , when you add your video, select the video track (left click) , and on the right column there is a field "Timpstamp file" . Push the button to the right and select the location for "blah.times.txt". Push start multiplexing
    Image
    [Attachment 63263 - Click to enlarge]


    OK I think I got this..... got it running now and it looks successful!

    Thank you!

    EDIT: it looks a lil off near the end of the video, so I'm gonna try the other WAV I extracted with vdub2 and see if it works better....
    Last edited by Lord Rakim; 10th Feb 2022 at 13:39. Reason: almost there
    Quote Quote  
  21. what an interesting thread i agree the results looked magical. i hate dealing with scripting but man the results !!! i am going to download the file and give it a go in resolve but i dont expect anything as good as what i see but ill do my best for a comparison
    Quote Quote  
  22. heres my first go at it with 5 mins in davinchi resolve studio used the noise reduction and sharpening tools
    Image Attached Files
    Quote Quote  
  23. i took a run at it with veai using the proteus fine tune model i upped the revert compression setting but let it auto choose the rest of settings i think a pass like this then using davinchis dirt removal could have a good result i am late for bed but posted this up on a facebook resolve group to see what they could come up with
    Image Attached Files
    Quote Quote  
  24. Originally Posted by Lord Rakim View Post

    EDIT: it looks a lil off near the end of the video, so I'm gonna try the other WAV I extracted with vdub2 and see if it works better....

    Make sure you used the clean timestamps from the dedup 1st pass. You used the same file name and overwrote the data earlier

    (Do not add VFRtoCFR to the 2nd pass encoding script, that's if you wanted to make it CFR after you've muxed it)
    Quote Quote  



Similar Threads