View Full Version : Forcing AviSynth to error
deanmarktaylor
6th June 2006, 10:53
Hi,
I wish to get AviSynth to actually error instead of producing a video containing the error...
I would like it to cause an error so that the video program uses its default error handling.
So if I was to open a .AVS file in Media Player (mplayer2) it would say "unable to find supported codecs" or simular.
Is there anyway to do this?
Perhaps just a general error and log the real error out to a log file?
foxyshadis
6th June 2006, 11:47
The video application has to specifically support avisynth hooks. For instance virtualdub and megui do, but media player definitely doesn't. Maybe if you wrapped the script to make vdub frameserve it (vfapi), you could get an error from vdub, but I've never tried that.
Hmm, You could also use try/catch in the script (see the manual or stickboy's plugins) to get to the error, log it to a file, and throw your own though. There's an idea.
deanmarktaylor
11th June 2006, 14:15
Many thanks,
I ended up encapsulating everything in a try catch block; in the catch block I added invalid video output which causes the program I am using to error.
Here is an example:
##############
# ****** Catch all error handling
Try {
##############
# <<<< Normal AVS script code goes here >>>>
##############
# ****** Catch all error handling
}
Catch(err_msg) {
return BlankClip(length = 0, fps=1.0, width=8, height=8, audio_rate=0)
}
##############
And obviously there is some scope for outputting the err_msg (error message) to a log file in the catch statement.
:thanks: Thanks for your help,
If anybody else has any comments on this let me know.
deanmarktaylor
21st August 2006, 14:04
For everybody's reference this method of capturing exceptions doesn't seem to always work with "Access Violations"...
The specific case is if you have an function calling another function which when causes an access violation... i.e.
##############
# ****** Catch all error handling
Try {
##############
Function LoadMovieFileNamedBob() {
themovie = DirectShowSource("bob.wmv", fps = 25, convertfps=true, audio = true)
return themovie
}
Function LoadMovieFile() {
themovie = LoadMovieFileNamedBob();
return themovie;
}
return LoadMovieFile()
##############
# ****** Catch all error handling
}
Catch(err_msg) {
return BlankClip(length = 0, fps=1.0, width=8, height=8, audio_rate=0)
}
##############
So if an exception is thrown on the "DirectShowSource" line then it is not caught with the catch block...
you can resolve this by adding a catch block around the "DirectShowSource" call.
Its a bit odd, perhaps a bug?
Using AviSynth version 2.5.6.0.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.