Log in

View Full Version : AviSynth Video problem? please...


NLPguy
31st March 2021, 14:28
Hi folks,

I have a script that runs perfectly on Windows 7 64 bits.

But when I run it on Windows 10 it creates a kind of "ghost effect/problem". It normally happens at the beginning of the video.


(There is an example video below with before/after results and all Windows 7 and 10 features I quoted below)


When I run it on Windows 7 64bits it does not happen.

I'm using AviSynth (https://www.videohelp.com/software/Avisynth) 2.6

And I'm using these plugins:

SetMemoryMax(512)
SetMTMode(3)
LoadPlugin("m:\temp2\RemoveGrain.dll")
LoadPlugin("m:\temp2\MaskTools2-25.dll")
LoadPlugin("m:\temp2\Depan.dll")
LoadPlugin("m:\temp2\DepanEstimate.dll")
LoadPlugin("m:\temp2\MVTools2.dll")



Example:

- Raw Video: https://drive.google.com/file/d/1PTiXiqNmK-GzzdQipJt3GDCCVY89viES/view

- Video with AviSynth Scripts Windows 10 with this ghost image problem: https://drive.google.com/file/d/1s38WbZj89OiKJd0_2HfDq51ULseThTjr/view



Does someone knows why it is happening?

Maybe there is/are some Plugin that has been updated to Windows 10?



Windows 7 Features


Microsoft Windows 7 Ultimate Operating System Name
Version 6.1.7601 Service Pack 1 Build 7601
Other Operating System Information Not available
Operating System Manufacturer Microsoft Corporation
System name CASA-PC
System manufacturer To be filled by O.E.M.
System model To be filled by O.E.M.
System type x64-based PC
AMD FX (tm) -8350 Processor Eight-Core Processor, 4000 Mhz, 4 Core (s), 8 Logical Processor (s)
BIOS version / date American Megatrends Inc. 2603, 06/26/2015
SMBIOS version 2.7
Windows folder C: \ Windows
System folder C: \ Windows \ system32
Boot device \ Device \ HarddiskVolume4
Brazil
Hardware Abstraction Layer Version = "6.1.7601.24520"
Username CASA-PC \ Tony
Time zone Brazil official time
Installed Physical Memory (RAM) 16 GB
Total physical memory 11.9 GB
8.52 GB available physical memory
Total virtual memory 23.8 GB
Available virtual memory 19.3 GB
Paging file space 11.9 GB
Paging file C: \ pagefile.sys




Windows 10 Features

Microsoft Windows 10 Pro Operating System Name
Version 10.0.19042 Build 19042
Other Operating System Description Not available
Operating System Manufacturer Microsoft Corporation
System name TONY-PC
System manufacturer System manufacturer
System Product Name System model
X64-based PC system type
SKU system SKU
AMD Ryzen 7 Processor 2700 Eight-Core Processor, 3200 Mhz, 8 Core (s), 16 Logical Processor (s)
BIOS version / date American Megatrends Inc. 2407, 07/01/2020
SMBIOS version 3.2
Embedded Controller Version 255.255
Legacy BIOS mode
BaseBoard manufacturer ASUSTeK COMPUTER INC.
BaseBoard Product TUF GAMING X570-PLUS_BR
BaseBoard Rev X.0x Version
Desktop Platform Role
Secure Boot State Not supported
PCR7 Configuration Connection Impossible
Windows folder C: \ WINDOWS
System folder C: \ WINDOWS \ system32
Boot device \ Device \ HarddiskVolume1
Brazil
Hardware Abstraction Layer Version = "10.0.19041.844"
Username Tony-PC \ Tony
Time zone Brazil official time
Installed Physical Memory (RAM) 16 GB
Total physical memory 15.9 GB
Available physical memory 11.1 GB
Total virtual memory 31.9 GB
26.5 GB available virtual memory
Paging file space 16.0 GB
Paging file C: \ pagefile.sys
Kernel DMA Protection Disabled
Virtualization-based security Not enabled
Device Encryption Support Reasons for Automatic Device Encryption Failure: Unusable TPM, PCR7 Association Not Compatible, Hardware Security Test Interface Failed, and the device is not in Modern Standby, Bus / DMA compliant devices not allowed detected, unusable TPM
Hyper-V - VM Monitor Mode Extensions Yes
Hyper-V - Second Level Address Translation Extensions Yes
Hyper-V - Virtualization Enabled on Firmware No
Hyper-V - Data Execution Protection Yes



Thank you so much in advance!

Boulder
31st March 2021, 15:46
Sounds more like a source filter issue.

You should post your whole script and also upgrade to Avisynth+. AVS 2.6 is more or less legacy, especially the MT support is very flaky compared to Plus.

StainlessS
31st March 2021, 16:56
Sounds like source filter to me too, or source codec [aint there some weird probs with W10 codecs ? (EDIT: and eg DirectShowSource)].
Also update those plugins too [as well as avs+] , current mvtools etc much better than of old.
[think every one of those plugins have seen Pinterf updates].

AVS+ v3.70 :- https://forum.doom9.org/showthread.php?p=1933223#post1933223
MvTools[and Depan], Masktools:- https://github.com/pinterf

Not sure where removegrain is, here extrnal filters:- http://avisynth.nl/index.php/External_filters
And x64 filters [for avs+ 64 only]:- http://avisynth.nl/index.php/AviSynth%2B_x64_plugins

manolito
31st March 2021, 17:41
For me the most reliable advice would be to stick with Win7 and ditch Win10... :p

I agree with the other posters that this is most likely a source filter issue. If you use a DirectShow based source filter you probably should install LAV Filters and then use the DS Filter Tweaker by CLSID to set all preferred DirectShow Filters to LAV instead of MS. Note that every Win10 update will reset these settings so you need to repeat the procedure.

Or you try to avoid using DirectShow based source filters altogether by using LSMASH or ffms2 instead.

Good luck...

Boulder
31st March 2021, 18:58
DirectShowSource is a huge no-no, just too much trouble. Those other two will most likely work although they also have their issues sometimes.

NLPguy
31st March 2021, 20:00
Sounds more like a source filter issue.

You should post your whole script and also upgrade to Avisynth+. AVS 2.6 is more or less legacy, especially the MT support is very flaky compared to Plus.


Hi Boulder,

That is the whole script in a PDF document (seems better to read): https://drive.google.com/file/d/1SLqIISkkK-3N2RLcgsIOQGo5FyGGyqzZ/view?usp=sharing

StainlessS
31st March 2021, 23:01
seems better to read
Not really, just means each and everybody that wants to try it out has to extract the text from PDF in a single text line [without formatting] and then
try to repair formatting and remove the added line numbers.
A bit of a tedious task for everybody that wants to help.

Dont ever do that again, please.
Just wrap the script in CODE tags, a code tag is the word CODE surrounded by '[' and ']' characters,
and at the end use the same code tag but insert '/' before CODE, eg swapping XCODEX for CODE


some script


If I actually inserted the proper tag word CODE [without the X's] then you would not be able to see them [in forum].
Also, if you hit the "Go Advanced" button, the '#' symbol will wrap marked text in code tags, so you can see them in the edit box.


Here is extracted script, I got sick of extractinig it and so not properley formatted, but about as much as I feel like doing at the moment.
[below is wrapped in CODE tags - code in code tags keeps its formatting so long as source script has TABs converted to SPACEs,
OR, your TAB step size is 8 characters, mine is 4 characters per TAB so I have to convert TABS to SPACE]

#Import("M:\temp2\source script2 Dr Paulo Pirej.avs")
# Plugins: - RemoveGrain
# - MaskTools2
# - Depan + DepanEstimate
# - MVTools2

SetMemoryMax(512)
SetMTMode(3)
LoadPlugin("M:\Temp2\RemoveGrain.dll")
LoadPlugin("M:\Temp2\MaskTools2-25.dll")
LoadPlugin("M:\Temp2\Depan.dll")
LoadPlugin("M:\Temp2\DepanEstimate.dll")
LoadPlugin("M:\Temp2\MVTools2.dll")

#mpeg2source("M:\Marcelo 27.5.20\1\01\01-1.d2v")
#mpeg2source("M:\Marcelo 999255703 - Fazer\01 ok 19m.d2v")
DirectShowSource("M:\Welington 3.11.20 - Fazer\07 WE 3capt V17JVCES10.mp4",fps=25,ConvertFPS=True)
#DirectShowSource("M:\Luis Tonini 14.1.20 - Fazer\01 V14ES10 e.mp4")
#DirectShowSource("E:\Tereza Soares 13.8.20 - Fazer\01 TS 8capt V17JVCES10.mp4", fps = 25, ConvertFPS = True ) # para AVI encapsulado AVI Xvid da Avermidia ou MP4 da Aple
#DirectShowSource("M:\Neogrid 5-10-17\090 4capt V13SVSDV.avi", fps = 25, ConvertFPS = True )
# para AVI encapsulado AVI Xvid da Avermidia
#AVISource("E:\Cleiton\Super 8mm\03\03 ok.avi")
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi", audio=true)
#AVISource("E:\Luiz Itapema 23.9.20 - Fazer\18 LI SD8.avi") # DV AVI
#AVISource("M:\Pedro 31-7-18\25 8capt V15ES10SDV.avi", audio=true)


SetMTMode(2)
#ConvertToYV12()29 #ConvertToyv411()
#Crop(0,20,-0,-30,true)
#bob(0,0.5)32 33 AssumeTFF()
SeparateFields()

a=last
clense(reduceflicker=false).merge(last,0.5).clense(reduceflicker=false)
mot=removegrain(11,0).removegrain(20,0).DepanEstimate(range=2)
take2=a.depaninterleave(mot,prev=2,next=2,subpixel=2)
clean1=take2.TMedian2().selectevery(5,2)

sup1= clean1.minblur(1).removegrain(11,0).removegrain(11,0)
\.mt_lutxy(clean1,"x 1 + y < x 2 + x 1 - y > x 2 - y ? ?",U=2,V=2)
\.msuper(pel=2,sharp=0)
sup2= a.msuper(pel=2,levels=1,sharp=2)
#bv23=sup1.manalyse(isb=true, truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv22=sup1.manalyse(isb=true,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
bv21=sup1.manalyse(isb=true,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv21=sup1.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
fv22=sup1.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)
#fv23=sup1.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=16,overlap=8,search=5,searchparam=4,DCT=5)

#a.mdegrain3(sup2,bv21,fv21,bv22,fv22,bv23,fv23,thSAD=499) # << this is the "2-fold" variant

interleave(a.mcompensate(sup2,fv22),a.mcompensate(sup2,fv21),a,a.mcompensate(sup2,bv21),a.mcompensate(sup2,bv22))
TMedian2().selectevery(5,2)

sup3=last.msuper(pel=2,sharp=2)
bv33=sup3.manalyse(isb=true,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv32=sup3.manalyse(isb=true,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
bv31=sup3.manalyse(isb=true,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv31=sup3.manalyse(isb=false,truemotion=false,global=true,delta=1,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv32=sup3.manalyse(isb=false,truemotion=false,global=true,delta=2,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)
fv33=sup3.manalyse(isb=false,truemotion=false,global=true,delta=3,blksize=8,overlap=4,search=5,searchparam=4,DCT=5)

last.mdegrain3(sup3,bv31,fv31,bv32,fv32,bv33,fv33,thSAD=499)# valor Original thSAD=49968 LSFMod(strength=60)
Interleave()70 Weave()

#stackvertical(a,last) # Alterado por mim.73 return(last)


#--------------------------------------------------------------
# Helper functions

functionMinBlur(clip clp,int r,int"uv")
{
uv=default(uv,3)
uv2=(uv==2)?1: uv
rg4=(uv==3)?4:-1
rg11=(uv==3)?11:-1
rg20=(uv==3)?20:-1
medf=(uv==3)?1:-200

RG11D=(r==0)?mt_makediff(clp,clp.sbr(),U=uv2,V=uv2)
\:(r==1)?mt_makediff(clp,clp.removegrain(11,rg11),U=uv2,V=uv2)
\:(r==2)?mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20),U=uv2,V=uv2)
\:mt_makediff(clp,clp.removegrain(11,rg11).removegrain(20,rg20).removegrain(20,rg20),U=uv2,V=uv2)S



RG4D=(r<=1)?mt_makediff(clp,clp.removegrain(4,rg4),U=uv2,V=uv2)
\:(r==2)?mt_makediff(clp,clp.medianblur(2,2*medf,2*medf),U=uv2,V=uv2
\:mt_makediff(clp,clp.medianblur(3,3*medf,3*medf),U=uv2,V=uv2)
DD=mt_lutxy(RG11D,RG4D,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?",U=uv2,V=uv2)
clp.mt_makediff(DD,U=uv,V=uv)
return(last)
}

# median of 5 clips from Helpers.avs by G-force
Function Median2(clip"input_1",clip"input_2",clip"input_3",clip"input_4"clip"input_5",string"chroma")
{
chroma=default(chroma,"process")#default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma =="process"?Clense(reduceflicker=false):Clense(reduceflicker=false,grey=true)
m1=selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2= input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3= input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma =="process"?Clense(reduceflicker=false):Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma =="copy first"?last.MergeChroma(input_1): chroma =="copy second"?last.MergeChroma(input_2):last
Return(last)
}

functionTMedian2(clip c){
Median2( c.selectevery(1,-2), c.selectevery(1,-1), c, c.selectevery(1,1), c.selectevery(1,2))
}


EDIT: And we have a winner !

DirectShowSource("M:\Welington 3.11.20 - Fazer\07 WE 3capt V17JVCES10.mp4",fps=25,ConvertFPS=True)

DirectShowSource it is, and probably bad windows 10 codec.
As sombody suggested install lav filters and use the filter tweaker as noted by Manolito.
[You could also use LSMash or ffmpegsource, but would want to fix dodgy filters too anyway]

EDIT: You could also have just zipped up the avs file and put that on google drive,
the maximum post size in Usage forum is 16KB, your script is about 6KB, so easily fits a single post.

EDIT: Or indeed Pastebin, as Wondkey Donkey says below, I remembered Paste but not the Bin bit :)
EDIT: LSmashVideoSource() is very reliable for mp4, in my limited experience.
[I usually convert to AVI lossless with ffmpeg, and use AviSource].

wonkey_monkey
31st March 2021, 23:52
You can also paste scripts to PasteBin and specify Avisynth syntax highlighting:

https://pastebin.com/tYAkeBGR

videoh
1st April 2021, 12:29
If I actually inserted the proper tag word CODE [without the X's] then you would not be able to see them [in forum].

You are not creative enough. ;)


some script

wonkey_monkey
1st April 2021, 13:43
Witchcraft!

StainlessS
1st April 2021, 15:37
There is a better way rather than VH abuse of size [ size matters :) ],
someone posted bout this some time ago, but I forgot the tag word, NOPARSE,
here many more:- https://www.vbulletin.org/forum/misc.php?do=bbcode

It would NOT be the worst idea in the world to add a sticky somewhere in Forum / Site Suggestions & Help pointing to that vBulletin link.

NLPguy
2nd April 2021, 15:59
Thank you so much StainlessS and all the members that posted here.

You are right it worked when I changed the DirectShowSource to the LSMash.


My VHS tapes are in bad condition (very oxidized). Because of that, my VHS video capture are very problematic.

Till now I couldn't find out how to compare 5 captures of the same VHS. I mean, frame by frame and choosing the best frames.

Do you have knowledge about a script or/and could you give me an example of a script that does that?

How can I synchronize the captures, so that they are in the same time frame?


Thank you again!

Boulder
2nd April 2021, 16:20
You can use Trim to match the clips. I suppose the capture method will just drop (i.e. duplicate) frames so the amount of frames per clip would be identical if you just get them to start at the same frame.

By the way, there is a method to average those different captures to produce a higher quality result and reduce the line dropouts in the image. I don't recall the exact name for the whole thing but you can find it in this or the Avisynth development forum.

EDIT: Actually not here, but at videohelp.com: https://forum.videohelp.com/threads/362361-Median()-plugin-for-Avisynth