tacman1123
10th July 2008, 13:46
I'm trying to use AviSynth to create a chapters list, and am experiencing very inconsistent behavior with FileWriteEnd. Perhaps there's a better way for me to be doing this.
chapter_string = ""
FR=25
f=BlankClip(fps=FR).KillAudio().Trim(0, 1)
# Version() <--- uncommenting this helps, a little.
chapter_string = chapter_string + f.chapter("One")
f = f + ColorBars().Trim(0, 10).AssumeFPS(F).KillAudio()
chapter_string = chapter_string + f.chapter("Two")
f = f + ColorBars().Trim(0, 25).AssumeFPS(F).KillAudio()
WriteFileEnd("chapters.txt", """ chapter_string """)
f
function chapter(clip, title) {
return String(clip.FrameCount) + " " + title + "\n"
}
When I run this, I get the error "Invalid Arguments to WriteFileEnd". By trial and error, I discovered that if I put something on the stack, e.g. a simple Version() call that doesn't do anything, at least the script runs, but it doesn't print anything to chapters.txt:
What I'm trying to do is take a bunch of smaller scripts (one.avs, two.avs) and create a chapter list that indicates the frame start when they're appended together, so the final file would be something like
0 One
10 Two
35 Three
Perhaps there's a better way to do this, but I'd still like to understand how to use FileWriteEnd, as often I'd like to write things out while processing or at the end, and I'm not understanding how to do something as simple as write something to a file.
Thx,
Tac
chapter_string = ""
FR=25
f=BlankClip(fps=FR).KillAudio().Trim(0, 1)
# Version() <--- uncommenting this helps, a little.
chapter_string = chapter_string + f.chapter("One")
f = f + ColorBars().Trim(0, 10).AssumeFPS(F).KillAudio()
chapter_string = chapter_string + f.chapter("Two")
f = f + ColorBars().Trim(0, 25).AssumeFPS(F).KillAudio()
WriteFileEnd("chapters.txt", """ chapter_string """)
f
function chapter(clip, title) {
return String(clip.FrameCount) + " " + title + "\n"
}
When I run this, I get the error "Invalid Arguments to WriteFileEnd". By trial and error, I discovered that if I put something on the stack, e.g. a simple Version() call that doesn't do anything, at least the script runs, but it doesn't print anything to chapters.txt:
What I'm trying to do is take a bunch of smaller scripts (one.avs, two.avs) and create a chapter list that indicates the frame start when they're appended together, so the final file would be something like
0 One
10 Two
35 Three
Perhaps there's a better way to do this, but I'd still like to understand how to use FileWriteEnd, as often I'd like to write things out while processing or at the end, and I'm not understanding how to do something as simple as write something to a file.
Thx,
Tac