View Full Version : Avisynth error after encode
aking80
23rd May 2008, 19:34
This is a really strange error. I've now encoded this video 4 different times, and it errors out every time. The video starts out fine during playback but the video blacks out and there's just "Avisynth: Unknown Exception" at the top of the video in red text. During my 4 encodes, I haven't changed any MeGUI or avs settings... it's all the same yet when I encode again the error pops up at a different time, every time. It's a 28 minute video source, first time it error after 2 minutes, next encode around 6 minutes etc.
I have no problems encoding my music videos (~5 minutes each) and I use the same settings and filters (MeGUI avisynth script creator tool but modified to my own taste a little) for the music videos as I am using with this. Any ideas?
unskinnyboy
23rd May 2008, 20:04
Add a SetMemoryMax(512) to the top of your script and retry.
aking80
24th May 2008, 19:32
Add a SetMemoryMax(512) to the top of your script and retry.
Thank you, it worked. Can you (or anyone else) explain why it did this? Am I going to have to do this with all my encodes that are longer than say, 10 minutes or whenever the memory gets too high?
unskinnyboy
25th May 2008, 00:21
What happened:
Your previous script possibly resulted in a memory leak which crashed Avisynth which resulted in the error message Avisynth: Unknown Exception + the blackness. This black screen with the error message was in turn passed onto your encoder. Your encoder accepted it as an RGB32 input source and encoded it just as it would encode a normal video input.
Why it happened:
This memory leak usually happens when Avisynth chews up all the memory available to it, and then attempts to start writing into the memory set aside for other applications. By restricting the memory available to Avisynth using the SetMemoryMax(512) command, we restricted Avisynth to using just 512 MB of memory, and nothing more, even if more was available.
Why it worked for short videos:
Memory leaks build up over time. When you encode just ~5 min videos, the duration is quite short for the memory leak to build up and cause a crash.
Closing remarks:
SetMemoryMax(512) isn't set in stone. Depending on how much RAM you have, you can try and raise the value from 512. At some point you would find a sweet spot at which it would still work, and anything above that value would result in a crash.
aking80
25th May 2008, 20:55
^Gotcha. Thank you much for the info unskinnyboy.
las7h0p3
12th October 2010, 19:04
I know that this thread is old but I have the same problem even when I try this: SetMemoryMax(512) on the top of my script
cretindesalpes
12th October 2010, 20:01
Open a task manager and watch the AviSynth memory usage while it is encoding. It will crash when becoming close to 2 GB. Try to reduce the SetMemoryMax value until it doesn't crash anymore. If AviSynth becomes hyperslow or stalls, it means it is really short on memory, so increase again the value. If you cannot find a good value for SetMemoryMax, try to split your script in multiple passes. If you still watch the memory usage grow regularly and reach 2GB far before the end of the encoding, try to split temporally your script.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.