Log in

View Full Version : mtmodes.avsi Error help?


SKY4
17th June 2025, 16:39
Hello, I have a script that is trying to reference mtmodes.avsi. I have downloaded the text that supposedly has the most up to date info that is supposed to go into it.

Says ‘Unexpected character “è”. So I can’t get the script to load.

The only file I could find for mtmodes.avsi was some text file that the tutorial says to save as that. This seems to be my primary road block.

I honestly just need an mtmodes.avsi as I really need to run this script. I’ve tried searching for results but I just can’t find anything that works. It’s an invalid character error - but I used the exact script.

I don’t even care if I am able to remove mtmodes from the code - I just need this thing running so I can finish my project.

Any help would be very much appreciated.

hello_hello
17th June 2025, 17:44
If mtmodes.avsi is this script (https://publishwith.me/ep/pad/view/ro.rDkwcdWn4k9/latest), it's not absolutely needed and functions shouldn't reference it as such. It configures the multithreading mode for older plugins that don't register their MT mode automatically with Avisynth+. The idea is to put it in the auto-loading plugins folder, so Avisynth+ will load it when it runs.

The version I linked to above contains a lot of non-English characters. I don't know if that's the version you're using, but you could try this one (https://gist.github.com/tp7/8899021) instead.

qyot27
18th June 2025, 00:36
Yeah, that publicpad instance has had people tampering with it again. I can't tell if it's maliciousness or just plain incompetence, but considering that the warning text about not opening it in machine translation was removed, and the links were mangled...

The last proper revision appears to be 1011 from Jan 2024:
https://publishwith.me/ep/pad/view/ro.rDkwcdWn4k9/rev.1011

All of the revisions after that are just increasingly messed up. Like randomly translating 'SetFilter' and 'Mode' (but not 'MT') to Chinese characters (it looks too dense to be Kanji, but with technical terminology, maybe I'm wrong), removing the warning about machine translation, mangling the links to the gist, etc. No actual filter changes occurred.

SKY4
24th June 2025, 00:01
Ok, the mtmodes.avsi error is gone now, but NOW I am getting ANOTHER error:

When I open it in VirtualDub, I get:
https://i.imgur.com/CzjjW7Q.jpeg

(text version of error below)
"AviSynth Open Failure:
SeperateFields: YUV Height must be multiple of 4"

It references Zs_RF_Shared.avsi, line 1607, QTGMC.avsi, line 520, and the video file path itself, Line 22."

I then decided to re-encode the video to 720x480 instead of 720x486, and it gave me THIS error:

https://i.imgur.com/JkK1aQl.jpeg

Not gonna lie, this is REALLY ticking me off at this point. What can I do to get this script to just execute and run in VirtualDub?

qyot27
24th June 2025, 02:08
Install a VFW codec to handle planar 10-bit 4:2:0. Nothing to do with the script at that point, apart from downsampling back to 8-bit (http://avisynth.nl/index.php/ConvertBits).

Or stop messing around with VirtualDub and the VFW requirements and just encode using ffmpeg. Preview it in mpv if you have to (I would say ffplay, except that ffplay doesn't tonemap when the script is HDR, and mpv is just a more normal media player, control-wise).

SKY4
24th June 2025, 05:37
Update - I got it working fine with the 720x480. This worked. Thanks! Looks great. However, I'd really like to have it run in its native resolution of 720x486, as I will have to graft. How can I get it to not give an error at 720x486?

It's a simple MP4 file, AVC1. This is what GSpot tells me as far as codecs are concerned:

https://i.imgur.com/x28eizd.jpeg

I hear you re: ffmpeg. It is logical to use it. However, the simple reason for me not using ffmpeg is I just don't know how to use it or its syntax right now. It's on the list in the future of stuff to learn after this project is done, but for now, my deadline doesn't allow the luxury for me to learn another script/language/package.

VirtualDub is what I know, and I can wrap my head around the AviSynth/scripts. It's been working great for me so far, I just want to get this working. :-)

Everybody has been amazing with helping me out with this, so if I haven't said it, it's hugely appreciated. I'm definitely getting closer to the finish line.

For the record, here is the code I was given to load it:

ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\LSMASHSource.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\MedianBlur2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\grunt.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\Average.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\TIVTC.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\mvtools2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\masktools2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\RgTools.dll")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\mtmodes.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\Srestore.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\Zs_RF_Shared.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\QTGMC.avsi")
# loading source: D:\AAA-AVISYNTH\TEST\FILE.mp4
# color sampling YV12@8, matrix: bt709, scantyp: top field first, luminance scale: limited
LWLibavVideoSource("D:\AAA-AVISYNTH\TEST\FILE.mp4",cache=false,format="YUV420P8", prefer_hw=0)
# current resolution: 720x486
# deinterlacing
AssumeTFF()
QTGMC(Preset="Fast", ediThreads=2)
# removing ghosting
srestore(frate=23.976,omode=6)
Preroll(Int(last.FrameRate()))
# Converting from 8 to 10bit for encoder
ConvertBits(10)
# setting output fps to 23.976fps
AssumeFPS(24000,1001)
# output: color sampling YV12@10, matrix: bt709, scantyp: progressive, luminance scale: limited
return last

Emulgator
26th June 2025, 00:22
That's a mangler.
Without seeing the source nobody can tell if that script you were given makes sense.
Besides, it loads plugins which are not even needed.
You may reconsider the goal: restoration, playability on which device ?
Why forcing YUV420P8 from sourcefilter ? Source may contain better chroma resolution.
If source is 29.97p, why QTGMC ? QTGMC was made for interlaced sources.
Why forcing srestore 23.976p onto the result ? Was there pulldown involved ? Then better IVTC.
10bits, well. Did the source contain any higher bitness ? Maybe yes. But you killed 2 LSB by ordering sourcefilter to decode as YUV420P8.
Did your processing reveal more bitdepth by clever dithering ? No.
And why Assumefps 23.976 again...
Best would be to assess the nature of the given source, finding all faults, then decide what's necessary to reverse them.
Otherwise one might try spicing a a stone, trying to slice it, then add salt + sugar + pepper + vinegar.

SKY4
26th June 2025, 02:00
Emulgator, most of those are pretty easily answered by going through the thread. That is the code I was given by someone who was very gracious on this forum to help me - as my goal was to get it working, and it does. For this I am extremely grateful.

25+ year broadcast veteran here, but new to AviSynth. Goal 1 is to get it working. I already know what I need, and this script does it quite nicely. I only need to know how to have it display in 720x486, and how to make the code do that.

These things are always considered, but if I were not new to AviSynth I wouldn't need to ask people how to execute it within the program.

Thanks for your input.

qyot27
26th June 2025, 02:30
The problem with 486 height is that some filters have resolution mod requirements (this is precisely what that first error message said; SeparateFields requires YUV420 to use a mod4 resolution; 486 is not mod4).

Change the YUV420P8 in the LWLibavVideoSource line to YUV422P8.

FranceBB
26th June 2025, 23:22
Emulgator is right, we could probably improve it and write something better once we know what your source is and what you're trying to do, but I also understand that you can't share it for obvious reasons. Sometimes I'm in the same position as I can't share something that hasn't gone on air.

Anyway, by taking your script and trying to change it as little as possible with just some guess work, I'd say that this could work


#indexing
LWLibavVideoSource("D:\AAA-AVISYNTH\TEST\FILE.mp4")

#Converting to yv24
ConverttoYUV444(matrix=Rec.601, interlaced=true)

#Deinterlacing
AssumeTFF()
QTGMC(Preset="Medium")

#Decimating
srestore(frate=23.976, omode=6)

#Preroll
Preroll(Int(last.FrameRate()))

#Converting to yv12
ConverttoYUV420(matrix=Rec.601, interlaced=false)

return last


Let me know how it goes.

SKY4
7th August 2025, 21:05
Update: When I changed the line to "YUV422P8", now it gives me an error about trying to load LSMASHSource as a 32 bit in VirtualDub2 (64). Which makes no sense to me because I used the exact same script (just changed format="YUV422P8". The DLL is in there for sure.

It works great when it is 720x480, but this thing absolutely does NOT want to give it to me at 720x486.

StainlessS
8th August 2025, 06:31
Everything must be same 'bittage'.
VirtualDub2 x64 will load avisynth x64, which must use x64 plugins.

I dont use same plugins setup as you (ie in "Program Files (x86)") but this looks wrong to me.


ClearAutoloadDirs()
SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\LSMASHSource.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\MedianBlur2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\grunt.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\Average.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\TIVTC.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\nnedi3.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\mvtools2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\masktools2.dll")
LoadPlugin("C:\Program Files (x86)\AviSynth+\plugins\RgTools.dll")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\mtmodes.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\Srestore.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\Zs_RF_Shared.avsi")
Import("C:\Program Files (x86)\AviSynth+\plugins64+\QTGMC.avsi")

In red seems to be x86 plugins, (which is wrong if using VDub x64 and Avs+ x64).
In blue is where avisynth+ x64 plugins should be.

If you correct the load x64 LSMASHSource.dll from plugins64, it would then fault at next line for MedianBlur2.dll.
All must be corrected.

EDIT: If there is a "plugins64", then should have x64 plugins in there. (where "plugins64+"
would be for avisynth + supporting plugins, only).

EDIT: OK, I've just installed standard avs setup, with both x86 and x64 install.
It installs in "C:\Program Files (x86)",
Avisynth+/plugins
Avisynth+/plugins+
Avisynth+/plugins64
Avisynth+/plugins64+
You want to use only the bolded plugs folders for x64 avisynth and Vdub2.
If you are only gonna use x64 avisynth, then maybe uninstall/reinstall only avisynth+ x64 (untick the 32 bit Avs+ during setup).
(where I assume that the 32 bit plugs directories will not exist and lessen future confusion).

EDIT: Oh, by the way, dll's in the standard plugins folders are already auto loaded, you dont need to explicitly load them, so
skip all of the LoadPlugins stuff in the script, and remove ClearAutoloadDirs() which will prevent plugins autoload.
(you can get more fancy when better aquainted with avs+)

so something like (from YOUR original script, only changed to "YUV422P8")

SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: D:\AAA-AVISYNTH\TEST\FILE.mp4
# color sampling YV12@8, matrix: bt709, scantyp: top field first, luminance scale: limited
LWLibavVideoSource("D:\AAA-AVISYNTH\TEST\FILE.mp4",cache=false,format="YUV422P8", prefer_hw=0)
# current resolution: 720x486
# deinterlacing
AssumeTFF()
QTGMC(Preset="Fast", ediThreads=2)
# removing ghosting
srestore(frate=23.976,omode=6)
Preroll(Int(last.FrameRate()))
# Converting from 8 to 10bit for encoder
ConvertBits(10)
# setting output fps to 23.976fps
AssumeFPS(24000,1001)
# output: color sampling YV12@10, matrix: bt709, scantyp: progressive, luminance scale: limited
return last


And here:- http://avisynth.nl/index.php/AviSynth%2B_x64_plugins
list of current x64 plugins from wiki, just incase all the plugs you have are 32 bit dll's.

SKY4
26th August 2025, 18:53
What I don’t understand is why it worked before Iput the YUV422. In theory shouldn’t it not work at all for either of them if it were the folder? I’m still having a hard time getting this to work.

StainlessS
27th August 2025, 07:43
Assuming that you have uninstall/re-installed Avisynth x64 only, and that you have proper bittage dll's in the proper plugins folders,
and using VDub x64 only. [and delete any plugins and plugins+ folders in the Avisynth directory in "Program Files" dir.]


SetFilterMTMode("DEFAULT_MT_MODE", MT_MULTI_INSTANCE)
# loading source: D:\AAA-AVISYNTH\TEST\FILE.mp4
# color sampling YV12@8, matrix: bt709, scantyp: top field first, luminance scale: limited
LWLibavVideoSource("D:\AAA-AVISYNTH\TEST\FILE.mp4",cache=false,format="YUV422P8", prefer_hw=0)
Return info
# current resolution: 720x486
# deinterlacing
AssumeTFF()
QTGMC(Preset="Fast", ediThreads=2)
# removing ghosting
srestore(frate=23.976,omode=6)
Preroll(Int(last.FrameRate()))
# Converting from 8 to 10bit for encoder
ConvertBits(10)
# setting output fps to 23.976fps
AssumeFPS(24000,1001)
# output: color sampling YV12@10, matrix: bt709, scantyp: progressive, luminance scale: limited
return last

Run the above code [EDIT: load into VDub2 x64], where it will return info on the blue line.
If that works OK, then move the "Return Info" line to follow after the next line that does something, ie after "AssumeTFF()",
repeat untill there is a problem and post what that problem is, ie the error message.

borgdm
14th September 2025, 21:54
I had the exact same issue, the mtmodes.avsi was saved in the wrong encoding and caused errors. After saving it again as ANSI, my script ran without any problems.