View Full Version : [HELP] Help with upscale and sharpening
mcabel
7th May 2023, 22:00
Hi, I'm new with avisynth upscaling. I installed that + Avsmod.
I was impressed with the results of videoFred's post (https://forum.doom9.org/showthread.php?t=144271) , and I want to achieve the same (or any improved method) in old 1970's footage.
I downloaded the scripts and tried to run them on avsPmod but got the error "Cannot load a 32 bit dll in 64 bit avisynth". This is odd because avisynth+ was installed automatically in programfilesx86 by default, which makes me think that it was a 32 bit version. I'm using windows 11, if that helps.
I'm willing to use other script(s )if they are available and produce equivalent or better results. Please help!
Typically AVS+ installs both 32 and 64bit versions. But if your plugins 32bit - you need to run 32bit application to load 32bit AVS and plugins. Many old plugins are not updated to 64bit (mostly because of lots of handcrafted 32bit asm inside and new compilers can not autocompile it to 64bit). So you need first to separate all you found 32bit plugins from 64bit and try to arrange your workflow with using either only 32bit or 64bit only plugins.
mcabel
7th May 2023, 23:48
Typically AVS+ installs both 32 and 64bit versions. But if your plugins 32bit - you need to run 32bit application to load 32bit AVS and plugins. Many old plugins are not updated to 64bit (mostly because of lots of handcrafted 32bit asm inside and new compilers can not autocompile it to 64bit). So you need first to separate all you found 32bit plugins from 64bit and try to arrange your workflow with using either only 32bit or 64bit only plugins.
How do I make Avsmod run 32bit avisynth+ rather than 64bit?
How do I make Avsmod run 32bit avisynth+ rather than 64bit?
Go here and get it.
https://www.videohelp.com/software/AvsP/old-versions
I would suggest you try Topaz Video AI.
mcabel
8th May 2023, 00:42
Go here and get it.
I would suggest you try Topaz Video AI.
Thanks, I was able to run it, although the error is not "avs cannot load file specified module could not be found" ...but the ""plugins/removegrain.dll"" is in the directory mentioned in the error... I also tried running on admin mode but same error.
About Topaz AI.... on 4x proteus, it creates ugly artifacts on faces. On 2x, I feel that the output is rather not that well enhanced; at least on this type of old footage using porteus, or otherwise(I've seen good results in HD-to-4k, but not in old-footage to 2x or higher ).
https://ibb.co/7NxrJqx
https://ibb.co/7NxrJqx
Thanks, I was able to run it, although the error is not "avs cannot load file specified module could not be found" ...but the ""plugins/removegrain.dll"" is in the directory mentioned in the error... I also tried running on admin mode but same error.
You might be able to update that .dll..
http://avisynth.nl/index.php/RemoveGrain_v0.9
About Topaz AI.... on 4x proteus, it creates ugly artifacts on faces. On 2x, I feel that the output is rather not that well enhanced; at least on this type of old footage using porteus, or otherwise(I've seen good results in HD-to-4k, but not in old-footage to 2x or higher ).
Oh, yes, I know exactly what you mean, I have seen even worse results than your sample, on some older stuff I've tried, I don't think Topaz is all it's cracked up to be :(
mcabel
8th May 2023, 04:57
You might be able to update that .dll..
http://avisynth.nl/index.php/RemoveGrain_v0.9
:(
Thanks. I updated it but same error. I suspect there might be a mystery dependency that I'm not aware of >__<
poisondeathray
8th May 2023, 05:38
Did you try rgtools ?
http://avisynth.nl/index.php/RgTools
https://github.com/pinterf/RgTools/releases
Thanks. I updated it but same error. I suspect there might be a mystery dependency that I'm not aware of >__<
I just downloaded and had a look at "Fred's" scripts, I think it might be that they are pretty old, and due to that they are probably mostly 32bit :(
https://forum.doom9.org/showthread.php?p=1237054#post1237054
LoadPlugin("plugins/Deflicker.dll")
Loadplugin("plugins/Depan.dll")
LoadPlugin("plugins/DepanEstimate.dll")
Loadplugin("plugins/removegrain.dll")
LoadPlugin("plugins/removedirt.dll")
LoadPlugin("plugins/MVTools.dll")
LoadPlugin("plugins/MVTools2.dll")
Loadplugin("plugins/warpsharp.dll")
LoadPlugin("plugins/autolevels_06.dll")
LoadPlugin("plugins/Motion_06Dec05B.dll")
Import("plugins/03_RemoveDirtMC.avs")
Unless he has a more up to date "set".
What is your preferred encoding app ??
Maybe a more informative error message might help...
The new upscalers may be designed to process max possible sharp 'video' into larger size. For old very soft film transfers and VHS captures may not detect any fine details and no textures for enchance.
For very soft sources it may be tested some medium(/low)-frequencies convolution sharpener like described in https://github.com/AviSynth/AviSynthPlus/issues/343
Current AVS working example is like
GeneralConvolution(0, "
-1 -2 -2 -2 -1
-2 -2 -3 -2 -2
-2 -3 70 -3 -2
-2 -2 -3 -2 -2
-1 -2 -2 -2 -1", auto=true, luma=true, chroma=false)
And adjusting center member in range about 60..100 it is now possible to adjust 'strength'. Where 60 is very strong, 100 is very weak and 50 is sort of high-pass filter only.
For even more soft sources it is require to design even larger spatial sized kernel of 7x7.
mcabel
8th May 2023, 15:41
I just downloaded and had a look at "Fred's" scripts, I think it might be that they are pretty old, and due to that they are probably mostly 32bit :(
What is your preferred encoding app ??
Maybe a more informative error message might help...
I've been trying with meGui and avspmod, but I'm open to suggestions if anything is either better/easier to make it work. Megui 32bits gives me the same error message: "cannot load the file ...removegrain.dll Platform returned code 126: the specified module could not be found"
May be required MSVC redistributable not installed :
Requirements
MSVCR71.DLL
Good to found how is named redistributable installation file for MSVCR71.DLL . Also it must be 32bit too.
It may be - Microsoft Visual c++ 2003 redistributable (or something around .NET 1.1 and SDK ?) https://stackoverflow.com/questions/1596167/where-to-download-microsoft-visual-c-2003-redistributable
mcabel
8th May 2023, 15:45
The new upscalers may be designed to process max possible sharp 'video' into larger size. For old very soft film transfers and VHS captures may not detect any fine details and no textures for enchance.
For very soft sources it may be tested some medium(/low)-frequencies convolution sharpener like described in https://github.com/AviSynth/AviSynthPlus/issues/343
Current AVS working example is like
GeneralConvolution(0, "
-1 -2 -2 -2 -1
-2 -2 -3 -2 -2
-2 -3 70 -3 -2
-2 -2 -3 -2 -2
-1 -2 -2 -2 -1", auto=true, luma=true, chroma=false)
And adjusting center member in range about 60..100 it is now possible to adjust 'strength'. Where 60 is very strong, 100 is very weak and 50 is sort of high-pass filter only.
For even more soft sources it is require to design even larger spatial sized kernel of 7x7.
Sounds interesting. How would I put this in practice in meGui avsPmod or any encoding tool?
Put it into your AVS script.
After source load and before final Prefetch().
mcabel
8th May 2023, 16:44
May be required MSVC redistributable not installed :
Requirements
MSVCR71.DLL
Good to found how is named redistributable installation file for MSVCR71.DLL . Also it must be 32bit too.
It may be - Microsoft Visual c++ 2003 redistributable (or something around .NET 1.1 and SDK ?) https://stackoverflow.com/questions/1596167/where-to-download-microsoft-visual-c-2003-redistributable
After installing an old version of the redistributable, and finding other dependencies that came after that error, things evolved into:
"DePanestimate: can not load FFTw3.dll "-_-
It is separately distributed .dll from https://www.fftw.org/ . Also you need 32bit and 64bit versions for different execution environments.
mcabel
8th May 2023, 17:04
It is separately distributed .dll from https://www.fftw.org/ . Also you need 32bit and 64bit versions for different execution environments.
I downloaded the 32 bit version and put into system32/wow64 after renaming libfftw3f-3.dll file to "FFTW3.dll" as the author mentioned. There was no change after restarting. Am I missing something?
32bit .dlls in x64 windows go into syswow64 only. Try to put fftw3.dll into folder with depanestimate.dll. Also may be API version may change and no more compatible with old builds of depanestimate.dll - try some old version of fftw3.dll (may be dated of mid-200x or mid-201x years.
For mvtools latest builds with depanestimate you can try pinterf 2.7.45 - https://github.com/pinterf/mvtools/releases . But I not sure it is compatible with very old scripts - need testing. Also if script not used depan/depanestimate you can disable it load in scripts. For depan you can use MDepan from mvtools and not use depanestimate.
mcabel
8th May 2023, 19:24
Also if script not used depan/depanestimate you can disable it load in scripts.
This sounds like a good option, since I don't really need stabilizing in my video. But the code for "cleaning" makes references to variable stab2. Is there a way to modify the "cleaning code" so it takes the uncropped video instead?
(I also tried placing fftw3.dll in the plugins folder but that did not work either. I guess I have to give up on making that work... )
#STABILIZING/CROPPING
#...........................................................................................................................................
stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= stab.crop(CLeft,CTop,-CRight,-CBottom)
stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
WS= width(stab)
HS= height(stab)
stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
#CLEANING/PRESHARPENING/RESIZING
#..........................................................................................................................................
noise_baseclip= stab2.levels(0,gamma,255,0,255).tweak(sat=saturation)
cleaned= RemoveDirtMC(noise_baseclip,dirt_strenght).unsharpmask(USM_sharp_ness1,USM_radi_us1,0)\
.unsharpmask(USM_sharp_ness2,USM_radi_us2,0).Lanczos4Resize(W,H)
Try
#stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
#mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
#stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= source1.crop(CLeft,CTop,-CRight,-CBottom)
#stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
#WS= width(stab)
#HS= height(stab)
#stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
#stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
StainlessS
8th May 2023, 21:51
mcabel,
check out Groucho2004 Avisynth Info Tool [check your avisynth installation for problems]
https://forum.doom9.org/showthread.php?t=173259
kedautinh12
9th May 2023, 01:46
I think you lack some vc++ ver, try with full ver
https://github.com/abbodi1406/vcredist
And fftw3 latest ver (faster than 3.3.5 homepage)
https://forum.doom9.org/showthread.php?p=1965537#post1965537
mcabel
9th May 2023, 01:59
Try
#stab_reference= source1.crop(20,20,-20,-20).colorYUV(autogain=true).crop(est_left,est_top,-est_right,-est_bottom)
#mdata=DePanEstimate(stab_reference,trust=trust_value,dxmax=maxstabH,dymax=maxstabV)
#stab=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,mirror=15).deflicker()
stab2= source1.crop(CLeft,CTop,-CRight,-CBottom)
#stab3=DePanStabilize(source1,data=mdata,cutoff=cutoff_value,dxmax=maxstabH,dymax=maxstabV,method=0,info=true)
#WS= width(stab)
#HS= height(stab)
#stab4= stab3.addborders(10,10,10,10,$B1B1B1).Lanczos4Resize(WS,HS)
#stab5= Lanczos4Resize(stab2,W,H).sharpen(0.5)
Thanks, I commented this(and a few other things) and finally made it run! (noticeably sharper as well!)
The author, Fred, seems to have several results for comparison, so I'm not sure how to send one out for encoding purposes.
Also about this, I don't see a prefetch() in the script, do I have to add one (where?)
After source load and before final Prefetch().
Current AVS working example is like
GeneralConvolution(0, "
-1 -2 -2 -2 -1
-2 -2 -3 -2 -2
-2 -3 70 -3 -2
-2 -2 -3 -2 -2
-1 -2 -2 -2 -1", auto=true, luma=true, chroma=false)
Screenshot of megui (gui/encoder for avisynth) and the script renamed to .txt
https://ibb.co/gVyV90b
Screenshot of megui (gui/encoder for avisynth) and the script renamed to .txt
https://ibb.co/gVyV90b
This is a noobie mistake, attaching "attachments" like this can take forever, if ever, to be approved, so no one gets to see them.
You need to use a site like "Imgur" or similar to do this.
mcabel
9th May 2023, 05:06
This is a noobie mistake, attaching "attachments" like this can take forever, if ever, to be approved, so no one gets to see them.
You need to use a site like "Imgur" or similar to do this.
Ah I see, thanks letting me know!
Ill use paste bin for the code and imgur for the image:
https://pastebin.com/t1FwjUtP
https://imgur.com/a/uQ9rW13
PD: after my previous comment I read that to send a video for encode I can use "return result" at the end of the file, so I did.
The only thing I'm missing (I think) is where to add Prefetch() (what does that do? ) so I can do the GeneralConvolution.
Ah I see, thanks letting me know!
Ill use paste bin for the code and imgur for the image:
https://pastebin.com/t1FwjUtP
https://imgur.com/a/uQ9rW13
PD: after my previous comment I read that to send a video for encode I can use "return result" at the end of the file, so I did.
The only thing I'm missing (I think) is where to add Prefetch() (what does that do? ) so I can do the GeneralConvolution.
I have to admit, I don't & won't use either MeGUI or AvsPmod !!!
I think that Prefetch() may have to be early in the script...
http://avisynth.nl/index.php/AviSynth%2B#Example
Google might be your best friend.
Good luck.
Just out of curiosity, could you upload a sample of the clip you're trying to "clean up" ??? (MediaFire or similar)
"megui (gui/encoder for avisynth) and the script renamed to .txt"
You can not use any gui - you can write scripts in any text editor (free windows Notepad) and run encoding with x26x command line (.bat file also designed in notepad) with .avs input and monitor script output in VirtualDub (x32 and x64 versions for different running environments). Also FAR file manager have text editor and some AVS script highlignt if required.
So typical full working script example is about
LoadPlugin("ffms2.dll")
FFmpegSource2("myfile.mp4")
GeneralConvolution(0, "
-1 -2 -2 -2 -1
-2 -2 -3 -2 -2
-2 -3 70 -3 -2
-2 -2 -3 -2 -2
-1 -2 -2 -2 -1", auto=true, luma=true, chroma=false)
Prefetch(N) # N is your threads number for best performance - typically number of real cores of CPU
videoFred
9th May 2023, 13:52
The author, Fred, seems to have several results for comparison, so I'm not sure how to send one out for encoding purposes.
It is all explained in the included helpfile: you must change the variable "result" like this:
result="result1"
Or result2, result3 and so on.
Fred.
videoFred
9th May 2023, 14:00
The only thing I'm missing (I think) is where to add Prefetch() (what does that do? ) so I can do the GeneralConvolution.
Prefetch works only in Avisynth+, it speeds up a script.
Set this at the begin of the script:
SetFilterMTMode("DEFAULT_MT_MODE", 2)
And set this at the end of the script:
Prefetch(2)
But sometimes I get "out of memory" messages when loading this in VirtualDub so I do not use it any more.
Fred.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.