1

Is is there a programmatic way to test for errors in Avisynth scripts before seeing the black and red Error message in the output.

We are currently assembling Avisynth script files as a part of an automated encoding routine. When something goes wrong with Avisynth or the source file, Avisynth renders a big black and red error message. Our encoder sees this as a normal video file and keeps on encoding without raising an error.

What is the best way to check for these errors without actually being seeing the output from the video file.

jbrass
  • 941
  • 7
  • 26

1 Answers1

1

AviSynth has support for try-catch: http://avisynth.org/mediawiki/Control_structures#The_try..catch_statement

I'm not sure how you would signal an error to your encoder from there. As far as I know you must return a clip from the script, and a return statement inside a try/catch block does not return from the entire script anways: http://avisynth.org/mediawiki/The_full_AviSynth_grammar#Closing_Remarks

You can however log error messages to text files, so I've seen people doing this to test an AVS script for error before running it:

script = "file_to_test.avs"
try {
  Import(script)
} catch (err) {
  WriteFileStart(BlankClip(), "C:\logfile.txt", script, """ ": " """, err, append=true)
}
wutz
  • 3,204
  • 17
  • 13