VideoHelp Forum



Support our site by donate $5 directly to us Thanks!!!

Try StreamFab Downloader and download streaming video from Netflix, Amazon!



+ Reply to Thread
Results 1 to 25 of 25
  1. Years ago, I used one of those old DVD/VCR combos to rip VHS tapes onto a lot of DVDs.
    It was done carelessly, with no thought for quality.
    Unfortunately, I currently have no way to capture better video from those VHS tapes.

    Image
    [Attachment 90061 - Click to enlarge]


    Now, I've tried using StaxRip to improve a test clip of about 5 minutes as much as possible
    before working on the hundreds of clips I'll have in total.

    Image
    [Attachment 90058 - Click to enlarge]

    Image
    [Attachment 90059 - Click to enlarge]


    Thank you!
    Last edited by Angy86; 6th Dec 2025 at 16:06.
    Quote Quote  
  2. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    The source is interlaced TFF, and is not in good shape.

    There are corrupted frames (4, 5, 1288, 5862, 5863, 5876, 5877), comets (the white moving spots) and other defects.

    The levels are OK.

    I do not use any GUI, so following is an AviSynth flow.

    As first, I would deinterlace with QTGMC.

    Then I would motion interplate the corrupted frames, for instance with MVTools (MFlowInter)

    Let's stop here for now, let us know if you need assistance running this filtering. We'll try to fix the others defects later. However, do not expect miracles.
    Quote Quote  
  3. I do not use any GUI, so following is an AviSynth flow.
    Ok! I installed Avisynth+ for the first time in my life.

    I downloaded some plugins: FFmpegSource, QTGMC and its essential plugins.
    I put the 64-bit versions of the plugins in the AviSynth+\plugins64+ folder
    Image
    [Attachment 90083 - Click to enlarge]

    I also downloaded AvsPmod_64, AVSInfoTool_113 and VirtualDub2

    I created a basic starting script and it seems to work
    Image
    [Attachment 90084 - Click to enlarge]


    How did you figure out which frames were corrupted?
    How do I motion interplate the corrupted frames?

    Sorry but I'm a newbie, Here is the current script:
    Code:
    SetFilterMTMode ("QTGMC", 2)
    FFMPEGSource2("VTS_01_1.VOB", atrack=1)
    AssumeTFF()
    QTGMC(preset="Slower", EdiThreads=3)
    Prefetch(10)
    Quote Quote  
  4. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    For yor source use a preset with less denoise as possible, because we will apply later some spot removal and denoise, so something like:
    Code:
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    or similar.

    Concerning detection of corrupted frames, there is some automatic procedure (like the one developped here: https://forum.doom9.org/showthread.php?t=183582), but nothing beats a visual inspection, better at slow speed (very time consuming), for example with a code like this, played for instance in VirtualDub:
    Code:
    video_org=AviSource("your file")
    
    video_org_no_audio_slow_motion=video_org.killaudio().AssumeFPS(10, true)
    
    return(video_org_no_audio_slow_motion)
    About the replacement of corrupted frames, let's start with a basic procedure:
    Code:
    video_org=AviSource("your file")
    
    video_org_rep=video_org_rep\
    .interpolate_1frame(frame_number=4)\
    .interpolate_1frame(frame_number=5)\
    .interpolate_1frame(frame_number=1288)\
    .interpolate_2frames(frame_number=5862)\
    .interpolate_2frames(frame_number=5876)
    
    return(video_org_rep)
    
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\"
    
    # a x   x    b
    # a x   b    b
    # a iab b    b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    Once you are able to run it come here and we'll see the spot removal.
    Quote Quote  
  5. Code:
    FFMPEGSource2("VTS_01_1.VOB", atrack=1)
    SetFilterMTMode ("QTGMC", 2)
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    Prefetch(10)
    
    video_org=FFMPEGSource2("VTS_01_1.VOB")
    video_org_rep=video_org_rep\
    .interpolate_1frame(frame_number=4)\
    .interpolate_1frame(frame_number=5)\
    .interpolate_1frame(frame_number=1288)\
    .interpolate_2frames(frame_number=5862)\
    .interpolate_2frames(frame_number=5876)
    
    return(video_org_rep)
    
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Program Files (x86)\AviSynth+\plugins64+\"
    
    # a x   x    b
    # a x   b    b
    # a iab b    b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    Code:
    ---------------------------
    File open error
    ---------------------------
    Avisynth open failure:
    I don't know what 'video_org_rep' means.
    (D:\FileScaricati\VHS.avs, line 13)
    ---------------------------
    OK   
    ---------------------------
    Code:
    video_org=AviSource("your file")
    does not open .VOB file
    Quote Quote  
  6. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Angy86 View Post
    does not open .VOB file
    Use FFmpegSource2 instead of AviSource
    Quote Quote  
  7. Thanks for your help and patience, but I also got the error message with FFmpegSource2 as I wrote in my post
    Quote Quote  
  8. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Sorry, it should be:

    Code:
    video_org_rep=video_org\
    .interpolate…
    Btw, better to use the same type of code style for the whole script (the deinterlacing part does not use variable assignement for each command)
    Quote Quote  
  9. Thanks Lollo! Now it seems to work!

    Code:
    SetFilterMTMode ("QTGMC", 2)
    FFMPEGSource2("VTS_01_1.VOB")
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    Prefetch(10)
    
    processed_clip = last
    
    video_org=FFMPEGSource2("VTS_01_1.VOB")
    repaired_clip=processed_clip\
    .interpolate_1frame(frame_number=4)\
    .interpolate_1frame(frame_number=5)\
    .interpolate_1frame(frame_number=1288)\
    .interpolate_2frames(frame_number=5862)\
    .interpolate_2frames(frame_number=5876)
    
    return(repaired_clip)
    
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Program Files (x86)\AviSynth+\plugins64+\"
    
    # a x* *x* * b
    # a x* *b* * b
    # a iab b* * b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    Once you are able to run it come here and we'll see the spot removal.
    ok I'm waiting for a good plugin and script
    Last edited by Angy86; 6th Dec 2025 at 16:06.
    Quote Quote  
  10. just for fun:
    QTGMC+AutoWhite+SpotLess+Small_Deflicker+Crop+Bala nceBorders+CAS+MCTemporalDenoise+AddGrain. (VapourSnyth script)

    (replacing broken frames with interpolated one might still be a good idea)

    Cu Selur
    Image Attached Files
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  11. OMG! Selur, your result is incredible! Thank you!
    The image is so clean! Great work!

    I only found a few imperfections:

    • The audio is inaudible
    • At the beginning, the video freezes for a few frames
    • The AutoWhite filter does a great job on the exteriors, but in the interiors, there seems to be a blue light, or am I wrong?

    Now, though, I'm a little confused... VapourSynth?

    I have a lot of videos similar to this one to restore, which way should I go? What's better and faster?

    Your script talks about Hybrid; is that your famous program/GUI? Should I use this? Can I import your script or template?

    Then I'll have to upload them to YouTube, so I need 720p or 1080p to use 50fps.
    Last edited by Angy86; 6th Dec 2025 at 16:07.
    Quote Quote  
  12. I only found a few imperfections:

    The audio is inaudible
    At the beginning, the video freezes for a few frames
    The AutoWhite filter does a great job on the exteriors, but in the interiors, there seems to be a blue light, or am I wrong?
    +
    Should I use this?
    No. This script was just-for-fun to show an alternative of what filters could be used, none of the filters were really adjusted.

    Can I import your script or template?
    In Hybrid? Not without at least adjusting the paths. If you use Hybrid better, recreate the script inside Hybrid instead of using it as input.

    Now, though, I'm a little confused... VapourSynth?
    Everything I used is available in Avisynth too so no need to switch to Vapoursynth or use Hybrid.
    (I suspect that StaxRip will have all the filters I used in the script for both Avisynth and Vapoursynth available.)
    I used Hybrid to generate the script.
    The sample just was meant to show the effect of the used filters.
    You can limit filters to only filter specific parts of the clip, no need to apply them to the whole clip.

    I have a lot of videos similar to this one to restore, which way should I go? What's better and faster?
    no clue, whatever seems easier to understand and use.
    Vapoursynth might be a bit faster when multithreading is properly used, but it probably does not really matter that much.

    Your script talks about Hybrid; is that your famous program/GUI?
    The script includes libraries from my Hybrid/64bit/Vapoursynth/vsfilters-folder since I use a portable Vapoursynth where you need to explicitly load dependencies.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  13. no clue, whatever seems easier to understand and use.
    You're right. Avisynth+ is complicated for a beginner. StaxRip doesn't have all the filters.

    I tried Hybrid, it's really complete and I like it.

    I have 100 videos, I can't do them individually, I have to do them all at once.
    I can't use filters only at certain times, like AutoWhite.

    Is it a good or bad idea to add a filter to remove shaking?

    QTGMC+AutoWhite+SpotLess+Small_Deflicker+Crop+Bala nceBorders+CAS+MCTemporalDenoise+AddGrain
    I think these filters are a great start, do they just need adjusting?
    Quote Quote  
  14. I think these filters are a great start, do they just need adjusting?
    BalanceBorder does not make any sense with generic settings that are adjusted and placed after Crop.
    SpotLess and Small_Deflicker can be really destructive when used on some sources.
    MCTemporalDenoise depending on the settings will so some heavy denoising, which will remove details.
    => Definitely.

    Is it a good or bad idea to add a filter to remove shaking?
    If you configure a de-shaking filter and your source is shaking, it is a good idea, otherwise bad, since it might add artifacts.

    I can't use filters only at certain times, like AutoWhite.
    Sure you can. Either by writing a custom script or even in Hybrid when Vapoursynth is used.

    Disclaimer:
    a. Hybrid is not for everyone.
    Hybrid is intended for advanced users. It's not intended to be a tool used by everyone. It's not intended to please amateurs who need a wizard-like interface.. If you don't know the basics about containers, video formats, etc. Hybrid is not meant for you.
    source: https://www.selur.de
    b. There are next to no guides or tutorials out there, which is why machine learning tools often give bad advice about it.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  15. I think these filters are a great start, do they just need adjusting?
    BalanceBorder does not make any sense with generic settings that are adjusted and placed after Crop.
    SpotLess and Small_Deflicker can be really destructive when used on some sources.
    MCTemporalDenoise depending on the settings will so some heavy denoising, which will remove details.
    => Definitely.

    Is it a good or bad idea to add a filter to remove shaking?
    If you configure a de-shaking filter and your source is shaking, it is a good idea, otherwise bad, since it might add artifacts.

    I can't use filters only at certain times, like AutoWhite.
    Sure you can. Either by writing a custom script or even in Hybrid when Vapoursynth is used.

    Disclaimer:
    a. Hybrid is not for everyone.
    Hybrid is intended for advanced users. It's not intended to be a tool used by everyone. It's not intended to please amateurs who need a wizard-like interface.. If you don't know the basics about containers, video formats, etc. Hybrid is not meant for you.
    source: https://www.selur.de
    b. There are next to no guides or tutorials out there, which is why machine learning tools often give bad advice about it.

    Cu Selur

    Ps.: If you are accustomed with StaxRip it might be easier to add stuff to StaxRips script than to find your way around Hybrid, which has quite a few options:

    (and still is lacking others)
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  16. I'm paralyzed. I can't write a good general-purpose script on Avisynth for my videos, and then you tell me Hybrid is only for advanced users. Can you provide me a good script or settings for StaxRip?

    The other videos I have are the same, shot with the same camera and extracted in the same quality. A universal solution?
    Quote Quote  
  17. Hybrid does offer tons of options, but that also means there are tons of ways to mess stuff up, especially when you don't know what you are doing.

    My point is: There is no good general solution you can apply to any source, even when it's from the same camera.
    You already noticed that AutoWhite for example isn't good for your indoor content, similar problems can occur with any filter.
    => sticking with the filters that StaxRip offers might be the saver way, especially when using it on tons of files and not having the time/motivation to adjust to every source.

    Cu Selur
    users currently on my ignore list: deadrats, Stears555, marcorocchini
    Quote Quote  
  18. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Angy86 View Post
    Once you are able to run it come here and we'll see the spot removal.
    ok I'm waiting for a good plugin and script
    You are in good hands with Selur support, but let's continue step-by-step the restoration process.

    After deinterlacing and interpolation of bad frames, you can apply SpotLess (it needs MVTools and MedianBlur2 dependencies to run) to remove the comets and other defects (a_1.avs opened at the beginning is the previuos script):

    Code:
    video_org=AviSource("a_1.avs")
    
    ### cleaning
    cleaned=video_org.SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    
    /*
    stackhorizontal(\
    subtitle(video_org,"video_org",size=20,align=2),\
    subtitle(cleaned,"cleaned",size=20,align=2)\
    )
    */
    
    return(cleaned)
    Some sample:

    Click image for larger version

Name:	spotless1.png
Views:	21
Size:	1.68 MB
ID:	90109

    Click image for larger version

Name:	spotless2.png
Views:	20
Size:	1.97 MB
ID:	90110

    SpotLess (and all similar filters) is destructive so use it with caution and play with its parameters for best results, in particolar RadT for the temporal radius of the frame repair and ThSAD), and may be apply it only to concerned segments of the video.

    If you feel confortable, then we can later address denoise/degrain.

    edit: for a major defect like in frame 1288 of the original source SpotLess is not enough, you can either replace this frame by interpolation or apply FixRipsp2 as in this example: https://forum.videohelp.com/threads/403553-Restoring-VHS-Tapes-with-Damage-(White-Hori...n)#post2635329 (again, a very destructive filter, so apply it with caution)

    Click image for larger version

Name:	xxx.png
Views:	10
Size:	965.0 KB
ID:	90111
    Last edited by lollo; 6th Dec 2025 at 12:22. Reason: added info to process difficult bad frames
    Quote Quote  
  19. Code:
    FFMPEGSource2("VTS_01_1.VOB")
    SetFilterMTMode ("QTGMC", 2)
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    Prefetch(10)
    
    processed_clip = last
    
    video_org=FFMPEGSource2("VTS_01_1.VOB")
    repaired_clip=processed_clip\
    .interpolate_1frame(frame_number=4)\
    .interpolate_1frame(frame_number=5)\
    .interpolate_1frame(frame_number=1288)\
    .interpolate_2frames(frame_number=5862)\
    .interpolate_2frames(frame_number=5876)
    
    return(repaired_clip)
    
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Program Files (x86)\AviSynth+\plugins64+\"
    
    # a x* *x* * b
    # a x* *b* * b
    # a iab b* * b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    
    ### cleaning
    cleaned=video_org.SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    
    /*
    stackhorizontal(\
    subtitle(video_org,"video_org",size=20,align=2),\
    subtitle(cleaned,"cleaned",size=20,align=2)\
    )
    */
    
    return(cleaned)
    Quote Quote  
  20. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Your posted code will never work (wrong call of assigned variables). If you feel more confortable with direct calls here it is (I also corrected an arror in the interpolation sub-routine):
    Code:
    FFmpegSource2("VTS_01_1.VOB")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    Crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    ### repair bad frames 4-5, 1288, 5862-5863, 5876-5877
    interpolate_2frames(frame_number=4)
    interpolate_1frame(frame_number=1288)
    interpolate_2frames(frame_number=5862)
    interpolate_2frames(frame_number=5876)
    
    ### de-interlacing
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    
    ### cleaning
    SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    
    
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Users\giuse\Documents\VideoSoft\MPEG\AviSynth\extFilters\"
    
    # a x   x    b
    # a x   b    b
    # a iab b    b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    you can move the functions from the scripts to a specific(s) .avsi file, reducing the whole script to:
    Code:
    FFmpegSource2("VTS_01_1.VOB")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    Crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    ### repair bad frames 4-5, 1288, 5862-5863, 5876-5877
    interpolate_2frames(frame_number=4)
    interpolate_1frame(frame_number=1288)
    interpolate_2frames(frame_number=5862)
    interpolate_2frames(frame_number=5876)
    
    ### de-interlacing
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    
    ### cleaning
    SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    It that's ok, we'll see denoise, sharpening and upscale for youtube upload later
    Quote Quote  
  21. AviSynth+\plugins64+\Interpolate_bad_frames.avsi

    Code:
    function interpolate_1frame(clip c, int "frame_number")
    {
    	# interpolate bad frame
    sup = c.MSuper()\
    bv = MAnalyse(sup, isb=true, delta=2)
    fv = MAnalyse(sup, isb=false, delta=2)
    interpolated = MFlowInter(c, sup, bv, fv)
    
    	# replace bad frame with interpolated frame
    video_repaired = \
    	c.trim(0,frame_number-1)++\
    	interpolated.trim(frame_number-1,-1)++\
    	c.trim(frame_number+1,0)
    
    	# video repaired
    return(video_repaired)
    }
    
    function interpolate_2frames(clip c, int "frame_number")
    {
    # plugins directory
    plugins_dir="C:\Program Files (x86)\AviSynth+\plugins64+\"
    
    # a x   x    b
    # a x   b    b
    # a iab b    b
    # a iab iabb b
    
    	# replace second bad frame with a duplicate of its next frame
    video_repaired_tmp1 = \
    	c.trim(0,frame_number)++\
    	c.trim(frame_number+2,frame_number+2)++\
    	c.trim(frame_number+2,0)
    
    	# replace first bad frame with interpolated frame
    video_repaired_tmp2 = video_repaired_tmp1.interpolate_1frame(frame_number=frame_number)
    
    	# replace second bad frame with interpolated frame
    video_repaired = video_repaired_tmp2.interpolate_1frame(frame_number=frame_number+1)
    
    	# video repaired
    return(video_repaired)
    }
    VHS.avs

    Code:
    FFmpegSource2("VTS_01_1.VOB")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    Crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    ### repair bad frames 4-5, 1288, 5862-5863, 5876-5877
    interpolate_2frames(frame_number=4)
    interpolate_1frame(frame_number=1288)
    interpolate_2frames(frame_number=5862)
    interpolate_2frames(frame_number=5876)
    
    ### de-interlacing
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    
    ### cleaning
    SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    Thanks Lollo it seems to work now.

    is this the correct order?

    - Source (FFmpegSource2)
    - Cropping
    - Repair bad frames
    - de-interlacing (QTGMC)
    - cleaning (SpotLess)
    - Denoise
    - Sharpening
    - Upscale

    I'm waiting for the other plugins for denoise, sharpening and upscale.
    Quote Quote  
  22. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    Originally Posted by Angy86 View Post
    is this the correct order?

    - Source (FFmpegSource2)
    - Cropping
    - Repair bad frames
    - de-interlacing (QTGMC)
    - cleaning (SpotLess)
    - Denoise
    - Sharpening
    - Upscale
    The order is correct ;you can sharpen before or after upscale according to your preference.

    Originally Posted by Angy86 View Post
    I'm waiting for the other plugins for denoise, sharpening and upscale.
    Append this to previous script:
    Code:
    ### denoising
    TemporalDegrain2(degrainTR=3)
    
    ### change color matrix
    Colormatrix("Rec.601->Rec.709")
    
    ### add borders
    addborders((crop_left+crop_right)/2-1,(crop_top+crop_bottom)/2,(crop_left+crop_right)/2+1,(crop_top+crop_bottom)/2)
    
    ### upscale
    nnedi3_rpow2(rfactor=2, nns=4, qual=2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    
    ### sharpening
    LSFmod(defaults="slow")
    edit: I did not address any color correction, that is a “world of art” on its own
    Last edited by lollo; 7th Dec 2025 at 11:07.
    Quote Quote  
  23. final script VHS.avs

    Code:
    FFmpegSource2("VTS_01_1.VOB")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    Crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    ### repair bad frames 4-5, 1288, 5862-5863, 5876-5877
    interpolate_2frames(frame_number=4)
    interpolate_1frame(frame_number=1288)
    interpolate_2frames(frame_number=5862)
    interpolate_2frames(frame_number=5876)
    
    ### de-interlacing
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    
    ### cleaning
    SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    
    ### denoising
    TemporalDegrain2(degrainTR=3)
    
    ### change color matrix
    Colormatrix("Rec.601->Rec.709")
    
    ### add borders
    addborders((crop_left+crop_right)/2-1,(crop_top+crop_bottom)/2,(crop_left+crop_right)/2+1,(crop_top+crop_bottom)/2)
    
    ### upscale
    nnedi3_rpow2(rfactor=2, nns=4, qual=2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    
    ### sharpening
    LSFmod(defaults="slow")
    Thanks again

    1.16 fps.. unfortunately I have an old PC..
    2.35 fps with http://avisynth.nl/index.php/AVSTP

    CPU Intel Core i5-4590
    GPU GTX 1070 Ti
    RAM 16 GB 1600 MHz

    Do you think there is a way to maintain this quality but have more speed?
    maybe Prefetch has something to do with it?

    And
    1080p → AVC (H.264) with low bitrate
    1440p → VP9 (or AV1) with much higher bitrate

    Maybe a higher resolution is better for YouTube?
    Last edited by Angy86; 7th Dec 2025 at 17:11.
    Quote Quote  
  24. Member
    Join Date
    May 2005
    Location
    Australia-PAL Land
    Search Comp PM
    maybe Prefetch has something to do with it?
    Yes. Set your Prefetch to the number of "logical Processors" shown on the Performance tab of Task Manager.


    Maybe a higher resolution is better for YouTube?
    Yes. Any video with a height of at least 1152 will get you VP9.
    Quote Quote  
  25. Captures & Restoration lollo's Avatar
    Join Date
    Jul 2018
    Location
    Italy
    Search Comp PM
    In addition to Prefetch setting, the only way to deeply increase the speed is to split the script in two.

    1- create script1.avs
    Code:
    FmpegSource2("VTS_01_1.VOB")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    Crop(crop_left,crop_top,-crop_right,-crop_bottom)
    
    ### repair bad frames 4-5, 1288, 5862-5863, 5876-5877
    interpolate_2frames(frame_number=4)
    interpolate_1frame(frame_number=1288)
    interpolate_2frames(frame_number=5862)
    interpolate_2frames(frame_number=5876)
    
    ### de-interlacing
    AssumeTFF()
    QTGMC(preset="slow", matchpreset="slow", matchpreset2="slow", sourcematch=3, tr1=2, tr2=1, NoiseTR=2, sharpness=0.1)
    
    ### cleaning
    SpotLess(BlkSz=12, OLap=8/2, pel=2, Tm=false, Bblur=0.0, ThSAD=1000, RadT=3)
    2- open it in VirtualDub and create the output "script1.avi" compressing with HuffYUV (lossless)

    3- create script2.avs
    Code:
    AvoSource("script1.avi")
    
    # cropping 
    	crop_left=12	# | rimozione esatta delle bande nere sinistra, sopra, destra e del disturbo sotto	
    	crop_top=4	# | 720-(12+10)x576-(4+12)=698x560
    	crop_right=10
    	crop_bottom=12
    
    ### denoising
    TemporalDegrain2(degrainTR=3)
    
    ### change color matrix
    Colormatrix("Rec.601->Rec.709")
    
    ### add borders
    addborders((crop_left+crop_right)/2-1,(crop_top+crop_bottom)/2,(crop_left+crop_right)/2+1,(crop_top+crop_bottom)/2)
    
    ### upscale
    nnedi3_rpow2(rfactor=2, nns=4, qual=2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    
    ### sharpening
    LSFmod(defaults="slow")
    4- generate the final output of fed this script to ffmpeg for encoding

    This flow generates an additional temporary file (script1.avi) with consequent disk occupancy, which can be removed at the end of the processing.

    Originally Posted by Angy86 View Post
    And
    1080p → AVC (H.264) with low bitrate
    1440p → VP9 (or AV1) with much higher bitrate

    Maybe a higher resolution is better for YouTube?
    With your source, you won't notice any difference.
    Quote Quote  



Similar Threads

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