View Full Version : Avisynth Script Error: Confused
Moonbeam
29th April 2018, 00:09
Hi all,
I'm new to the forums and to Avisynth and I have a script error that I'm hoping will get resolved through someone's help.
So I'm trying to use the filter found here https://forum.doom9.org/showthread.php?t=170732 that emulates a CRT display but everytime I try to load the AVS file in VirtualDub I get this error:
https://preview.ibb.co/cWbFpH/error.png (https://ibb.co/kqQ89H)
My lines of code that the error is referencing are here:
Line 31: Dither_resize16 (src.Width (), src.Height())
Line 22: gen_gradient ()
Line 8: last + Trim (0, -1).gen_gradient_rgb () + Trim (0, -1).gen_test_pattern_rgb ()
My Avisynth Build is:
https://image.ibb.co/hcaapH/build.png (https://imgbb.com/)
and my plugin folder looks like this.
https://preview.ibb.co/ccCc3c/plugin_folder.png (https://ibb.co/f5Xc3c)
I've tried everything I could think of, putting different dlls in the plugin folder, rebooting the computer, trying Avisynth and Avisynth + yet nothing seems to be changing. Any help would be appreciated.
poisondeathray
29th April 2018, 00:52
You need the x86 version of dither.dll for x86 avisynth . It should be 616kb. Your screenshot shows dither.dll is 800kb which would be the x64 version
ChaosKing
29th April 2018, 10:19
Use avsmeter to check for "broken" plugins https://forum.doom9.org/showthread.php?t=174797
Moonbeam
30th April 2018, 02:02
You need the x86 version of dither.dll for x86 avisynth . It should be 616kb. Your screenshot shows dither.dll is 800kb which would be the x64 version
Cheers that worked.
However, I've got another problem now. Whenever I load the script in VirtualDub and save it as an AVI the video "flickers" applying the effects of the filter every 5 frames or so and the other frames are as if the filter isn't being applied at all. Would anyone happen to have any experience with this?
Correction: Every even numbered frame isn't changing, but every odd numbered frame has the filter applied
`Orum
30th April 2018, 03:16
Correction: Every even numbered frame isn't changing, but every odd numbered frame has the filter applied
Please post your entire script so we can have a look.
Moonbeam
30th April 2018, 03:30
SetMemoryMax(512)
Directshowsource("C:\Users\Matt\Desktop\ot1creation.mp4").converttorgb32
Import ("C:\Users\Matt\Desktop\crt_display.avsi")
#BlankClip (width=256, height=224, length=1, pixel_type="RGB32")
last + Trim (0, -1).gen_gradient_rgb () + Trim (0, -1).gen_test_pattern_rgb ()
o = last
par = 7.0 / 7.0 # Pixel Aspect Ratio
crt_display (4*par, 4, ppp=2*par, maskpp=2, blurh=1.1, vcs=0.071, cromaclear=1, scandist=1.5, glowgain=0.5, glowh=2, glowv=0.5, halgain=0.03, cutoff=0.9)
ref = o.smooth_pointresize (last.Width (), last.Height ())
Interleave (ref, last)
Function gen_gradient_rgb (clip src, string "pixel_type")
{
src
gen_gradient ()
dup_multicolor (pixel_type)
}
Function gen_gradient (clip src)
{
src.BlankClip (width=256, pixel_type="Y8")
mt_lutspa (mode="absolute", expr="x")
Dither_convert_8_to_16 ()
Dither_resize16 (src.Width (), src.Height())
DitherPost (mode=6)
}
Function gen_test_pattern_rgb (clip src, string "pixel_type")
{
src
gen_test_pattern ()
dup_multicolor (pixel_type)
}
Function gen_test_pattern (clip src)
{
w = src.Width ()
wn = w / 5
wr = w - wn * 5
src.BlankClip (width=wn, pixel_type="Y8")
a = mt_lutspa (mode="absolute", expr="x y + 2 % 255 *")
b = mt_lutspa (mode="absolute", expr="x 2 % 255 *")
c = mt_lutspa (mode="absolute", expr="y 2 % 255 *")
d = mt_lutspa (mode="absolute", expr="x y 2 * + 4 % 0 == 255 0 ?")
e = mt_lutspa (mode="absolute", expr="x y 2 * + 4 % 0 != 255 0 ?")
StackHorizontal (a, b, c, d, e)
(wr > 0) ? AddBorders (0, 0, wr, 0) : last
}
Function dup_multicolor (clip src, string "pixel_type")
{
src
w = Width ()
h = Height ()
r = Crop (0, 0, 0, h/4)
g = Crop (0, h/4, 0, h/4)
b = Crop (0, 2*(h/4), 0, h/4)
m = Crop (0, 3*(h/4), 0, 0)
m = MergeRGB (m, m, m, pixel_type=pixel_type)
z = r.mt_lut (y=0)
r = MergeRGB (r, z, z, pixel_type=pixel_type)
g = MergeRGB (z, g, z, pixel_type=pixel_type)
b = MergeRGB (z, z, b, pixel_type=pixel_type)
StackVertical (r, g, b, m)
}
Function smooth_pointresize (clip src, int dw, int dh)
{
src
w = Width ()
h = Height ()
rx = Max (dw / w, 1)
ry = Max (dh / h, 1)
(w > 1 || h > 1) ? PointResize (w * rx, h * ry) : last
BicubicResize (dw, dh, 0.5, 0.25)
}
`Orum
30th April 2018, 03:56
Interleave (ref, last)
This interleaves (i.e. shows one frame from one clip, then the same frame number of another clip, then repeats this indefinitely) the two (or more) clips you give to it, which is why you're seeing that effect. Interleave() is often used to compare the result of some filter(s) to a clip without them.
Did you copy/paste this script from somewhere, or did someone give it to you? Because if so, it's better to learn the basics first. The wiki (http://avisynth.nl/index.php/Main_Page) has a getting started section that's okay but if you already know the basics you may want to start with the Internal Functions (http://avisynth.nl/index.php/Internal_functions) page.
Moonbeam
4th May 2018, 17:54
Interleave (ref, last)
This interleaves (i.e. shows one frame from one clip, then the same frame number of another clip, then repeats this indefinitely) the two (or more) clips you give to it, which is why you're seeing that effect. Interleave() is often used to compare the result of some filter(s) to a clip without them.
Did you copy/paste this script from somewhere, or did someone give it to you? Because if so, it's better to learn the basics first. The wiki (http://avisynth.nl/index.php/Main_Page) has a getting started section that's okay but if you already know the basics you may want to start with the Internal Functions (http://avisynth.nl/index.php/Internal_functions) page.
I took this script from the link in my first post but thanks leaving interleave like this "interleave()" fixed my problem. Now the script finally works!
This is kind of off topic but I have another unrelated (but Avisynth) question. I'm trying something different now. Can I export batch image sequence like you can with a video file? I searched the forums and couldn't find the answer anywhere.
I tried using the "Avisynth Batch Scripter" program and used the import function to combine all 100 images into 1 script file but it was taking way too long to load in VirtualDub so I stopped it. Is there an easier way? Basically just want to batch convert avs to image.
StainlessS
4th May 2018, 18:30
http://avisynth.nl/index.php/ImageWriter
Moonbeam
4th May 2018, 20:10
http://avisynth.nl/index.php/ImageWriter
I forgot to mention I'm basically trying to batch process the same filter in the opening post to images now instead of video files. How really could I use ImageWriter for that? I used it earlier and it returned my image without the filter applied to it. My script works great when I go to export --> image sequence in Virtualdub but that can only be used one image at a time and VirtualDub's job control apparently only outputs .avi files not image formats. :(
poisondeathray
4th May 2018, 20:16
I forgot to mention I'm basically trying to batch process the same filter in the opening post to images now instead of video files. How really could I use ImageWriter for that? I used it earlier and it returned my image without the filter applied to it. My script works great when I go to export --> image sequence in Virtualdub but that can only be used one image at a time and VirtualDub's job control apparently only outputs .avi files not image formats. :(
Is it an image sequence ? e.g image001.png, image002.png....Or are they completely different images , with completely different naming conventions ?
Imagesource() can open sequences, so all the images are in 1 script
Or if you have multiple avs's , you can use ffmpeg to batch process each avs and export image sequences from each
StainlessS
4th May 2018, 20:39
PDR, The guy wants to save file, not read.
EDIT: if you want to write avi, then see TWriteAVi v2.
poisondeathray
4th May 2018, 21:15
PDR, The guy wants to save file, not read.
I was suggesting if it's a sequential image sequence, to load it as an image sequence with all the images, instead of having to create 100 or 1000 individual .avs's. Thus you could write it in vdub (or whatever tool) in 1 go
If not, then ffmpeg batch on the series of avs's is probably the easiest IMO
Moonbeam
4th May 2018, 21:21
Is it an image sequence ? e.g image001.png, image002.png....Or are they completely different images , with completely different naming conventions ?
Imagesource() can open sequences, so all the images are in 1 script
Or if you have multiple avs's , you can use ffmpeg to batch process each avs and export image sequences from each
Yes my images are sequenced as such: 000,001,002, etc..Would you happen to know the script that would allow me to do batch process with ffmpeg?
poisondeathray
4th May 2018, 21:27
Yes my images are sequenced as such: 000,001,002, etc..Would you happen to know the script that would allow me to do batch process with ffmpeg?
Then you don't need ffmpeg
Just load it with imagesource() and use vdub in 1 go with 1 script
e.g
if your images were
image000.png
image001.png
image002.png
.
.
.
ImageSource("image%03d.png", start=0, end=whatever, fps=whatever)
#whatever filters
Just fill in the start= , end= , and fps doesn't really matter if you're writing out an image sequence. And add your filters instead of "#whatever filters"
It's "%03d" because that's the number of placeholder digits. For example, if it was image0001.png , it would be image%04d.png
So this reassembles your images into 1 script , as if it was a video
StainlessS
5th May 2018, 01:04
I'm hopin' everybody is happy.
You OK Moonbeam, PDR probably put you just right :)
Moonbeam
5th May 2018, 01:29
Then you don't need ffmpeg
Just load it with imagesource() and use vdub in 1 go with 1 script
e.g
if your images were
image000.png
image001.png
image002.png
.
.
.
ImageSource("image%03d.png", start=0, end=whatever, fps=whatever)
#whatever filters
Just fill in the start= , end= , and fps doesn't really matter if you're writing out an image sequence. And add your filters instead of "#whatever filters"
It's "%03d" because that's the number of placeholder digits. For example, if it was image0001.png , it would be image%04d.png
So this reassembles your images into 1 script , as if it was a video
Yep, exactly what I wanted, thanks. :goodpost:
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.