This code works fine until the prefetch is set to anything more than 1 thread. The more threads added to the prefetch, the more the random streaking.
Are there any workarounds for this? Even 2 threads would be a good improvement.
Code:SetFilterMTMode("DEFAULT_MT_MODE", 2) SetFilterMTMode("LWLibavVideoSource", 3) SetFilterMTMode("AviSource", 3) SetFilterMTMode("QTGMC", 2) SetFilterMTMode("DePanEstimate", 2) SetFilterMTMode("DePanStabilize", 2) SetFilterMTMode("Overlay", 2) SetFilterMTMode("Tweak", 2) SetFilterMTMode("Subtract", 2) SetFilterMTMode("Levels", 2) SetFilterMTMode("RgTools_RemoveGrain", 2) SetFilterMTMode("ConvertToYV12", 2) SetFilterMTMode("ConvertToYUY2", 2) # X = LWLibavVideoSource("C:\...\1.mkv", cache=false, prefer_hw=2).AssumeTFF().ConvertToYV12(interlaced=true).vsCnr2(ln=35,lm=192,un=47,um=255,vn=47,vm=255).ConvertToYUY2()#.DePulse() # source = LWLibavVideoSource("C:\...\1.mkv", cache=false, prefer_hw=2).AssumeTFF().ConvertToYUY2(interlaced=true)#.DePulse() #X = AviSource("C:\...\1.avi").AssumeTFF().ConvertToYUY2(interlaced=true)#.DePulse() source = AviSource("C:\...\1.avi").AssumeTFF().ConvertToYUY2(interlaced=true).SeparateFields()#.DePulse() # Preprocess source for reuse function Preprocess(clip src) { src.spatialsoften(1, 255, 127).ConvertToYV12().Greyscale().Tweak(0.0, 1.0, 0, 1.0, true, false) } function ProcessPass(clip src, clip preprocessed) { ghostA = preprocessed.VSLGhost(mode=3, shift=4, intensity=-128).Tweak(0.0, 1.01, 0, 1.25, true, false) ghostB = preprocessed.VSLGhost(mode=3, shift=1, intensity=-128).Tweak(0.0, 1.01, 0, 1.25, true, false) diffA = Subtract(ghostA, preprocessed).Levels(127, 1, 129, 0, 255).Invert().RgTools_RemoveGrain() diffB = Subtract(ghostB, preprocessed).Levels(127, 1, 129, 0, 255).Invert().RgTools_RemoveGrain() diff2 = Subtract(ghostA, ghostB).Invert() mask = diff2.Levels(50, 0.5, 255, 0, 255).Crop(2, 0, -0, -0).AddBorders(0, 0, 2, 0) halo_removed = Overlay(src, diff2, mask=mask, mode="subtract", opacity=0.5) halo_removed.Tweak(bright=12) } # Apply preprocessing and halo removal passes preprocessed = Preprocess(source) halo_rem1 = ProcessPass(source, preprocessed) preprocessed2 = Preprocess(halo_rem1) halo_rem2 = ProcessPass(halo_rem1, preprocessed2) preprocessed3 = Preprocess(halo_rem2) halo_rem3 = ProcessPass(halo_rem2, preprocessed3) preprocessed4 = Preprocess(halo_rem3) halo_rem4 = ProcessPass(halo_rem3, preprocessed4).ConvertToYV16() # Weave back + final processing afinal_output = halo_rem4.Dehalo_Alpha(rx=2, ry=2, lowsens=50, highsens=100).Blur(1, 0).ConvertToYUY2()#.Stab(dxmax=0,dymax=12) final_output = MergeChroma(afinal_output, source).Weave().ConvertToYV16(interlaced=true).Crop(4, 0, -8, -0).AddBorders(4, 0, 8, 0)#.Prefetch(2)#.BicubicResize(1920, 1440) return final_output
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 9 of 9
Thread
-
-
Is 1.mkv an I-frame format ?
Try cache=True for LWLibavVideoSource for that version. Cache=false can lead to non frame accurate seeks
For the 1.avi version, is 1.avi an I-frame format ?
You can also try adding Preroll(some value) before the prefetch if you're having linear access problems and mixed up frames
http://avisynth.nl/index.php/PrerollLast edited by poisondeathray; 27th Jul 2024 at 12:26.
-
Preroll works to remove it, but only when the value is so high that everything slows down again, but thanks for the suggestion.
Last edited by useraxe; 27th Jul 2024 at 13:08.
-
Does it make a difference between using LWLibavVideoSource and AviSource?
users currently on my ignore list: deadrats, Stears555 -
LWLibavVideoSource has it's own threads argument, although the docs says the default of threads=0 determines the number of threads automatically.
I'd try downloading the MT Modes script via the "AviSynth+ MT modes" link here:
http://avisynth.nl/index.php/AviSynth%2B#Help_filling_MT_modes
Save it with an avsi extension and put it in the Avisynth+ plugins folder so it auto-loads, remove all the SetFilterMTMode lines from your script and try Prefetch again to see if that works any better. If you have avstp.dll auto-loading you should remove it, although the script I linked to above disables avstp's multi-threading anyway.
Edit 1: I know they're commented out in your script, but Prefetch() should be the last line in the script unless there's a Return line, but I've never tried chaining it to a previous function the way you appear to be using it, so I've no idea if it'd be applied to the whole script that way. I'd normally do:
Code:MergeChroma(afinal_output, source).Weave().ConvertToYV16(interlaced=true).Crop(4, 0, -8, -0).AddBorders(4, 0, 8, 0).BicubicResize(1920, 1440) Prefetch(2)
Code:final_output = MergeChroma(afinal_output, source).Weave().ConvertToYV16(interlaced=true).Crop(4, 0, -8, -0).AddBorders(4, 0, 8, 0).BicubicResize(1920, 1440) Prefetch(2) return final_output
https://avisynthplus.readthedocs.io/en/latest/avisynthdoc/syntax/syntax_internal_funct...ading_new.html
Plugins that automatically register their MT mode with Avisynth+ won't use the MT mode you specify unless you add force=true to SetFilterMTMode()
Since Avisyth+ 3.6 it's possible to use Prefetch() more than once in a script, but obviously it's something I haven't tried myself yet.Last edited by hello_hello; 28th Jul 2024 at 20:33.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
I suspect the culprit is VsLGhost.
I tried messing around with your script to see what I could see, and with only a single processing pass there was obvious artifacts in places.
Code:function Preprocess(clip src) { src.ConvertToYUY2().spatialsoften(1, 255, 127).ConvertToYV24().Greyscale().Tweak(0.0, 1.0, 0, 1.0, true, false) } function ProcessPass(clip src, clip preprocessed) { ghostA = preprocessed.VSLGhost(mode=3, shift=4, intensity=-128).Tweak(0.0, 1.01, 0, 1.25, true, false) ghostB = preprocessed.VSLGhost(mode=3, shift=1, intensity=-128).Tweak(0.0, 1.01, 0, 1.25, true, false) diffA = Subtract(ghostA, preprocessed).Levels(127, 1, 129, 0, 255).Invert().RgTools_RemoveGrain() diffB = Subtract(ghostB, preprocessed).Levels(127, 1, 129, 0, 255).Invert().RgTools_RemoveGrain() diff2 = Subtract(ghostA, ghostB).Invert() mask = diff2.Levels(50, 0.5, 255, 0, 255).Crop(2, 0, -0, -0).AddBorders(0, 0, 2, 0) halo_removed = Overlay(src, diff2, mask=mask, mode="subtract", opacity=0.5) halo_removed.Tweak(bright=12) } preprocessed = Preprocess(source) halo_rem1 = ProcessPass(source, preprocessed) afinal_output = halo_rem1.Dehalo_Alpha(rx=2, ry=2, lowsens=50, highsens=100) MergeChroma(afinal_output, source).ConvertToYV16()
SetFilterMTMode("VsLGhost", 2, force=true)
Here's the sort of thing I was seeing in places.
No multi-threading.
The artifacts are mostly along the edge of the door.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
VsLGhost must register itself as an MT_NICE_FILTER. At least I assume it does, but does anyone know if there's a way to determine the MT mode a plugin is using?
Code:int __stdcall SetCacheHints(int cachehints, int frame_range) { return cachehints == CACHE_GET_MTMODE ? MT_NICE_FILTER : 0; }
Cu Selurusers currently on my ignore list: deadrats, Stears555
Similar Threads
-
[Avisynth] moving image effect
By maudit in forum Newbie / General discussionsReplies: 21Last Post: 28th Nov 2022, 23:29 -
JVC HR-D721EN black image only sound
By langeloso in forum MediaReplies: 1Last Post: 11th Feb 2022, 10:44 -
avisynth+ with mpg file: green frames added to preview
By pooksahib in forum EditingReplies: 1Last Post: 13th Dec 2021, 22:57 -
Can somone help me with these black bars/cropped image?
By Habibi in forum Software PlayingReplies: 3Last Post: 21st Mar 2021, 09:57 -
Adding solid black frames with avisynth?
By killerteengohan in forum RestorationReplies: 21Last Post: 28th Aug 2020, 08:33