PDA

View Full Version : Subtitles from a changing text-file


Ferux
23rd August 2007, 14:11
I want to use AVISynth for a big display on a sports event (it's the biggest student happening of our country). Besides some video and sponsors, it should also display the actual ranking of the teams participating. I want to open the .avs-file directly with a media player so the video is generated in real-time. The only problem is that I can't find a method for reading text out of a changing file.

For example, I can assign 'global' strings in an .avsi file, but AVISynth only reads that file when the script is opened.

Any help is appreciated!

Ferux
23rd August 2007, 16:42
Hmm, i found out myself how to do it:


source = source.scriptclip("show")


function show(clip input)
{
Import("D:\Video Processing\test.avs")
Subtitle(input,lijn1)
}

In another file 'test.avs':


global lijn1 = "some text"


test.avs is read by AVISynth every frame, so when test.avs changes, the video changes too.

gzarkadas
23rd August 2007, 21:53
Very nice :). I was searching of an application of using Import in a runtime script to put it as an example in an article (http://avisynth.org/mediawiki/The_script_execution_model) at the AviSynth wiki; this definetly fits in!

It can be even more compact if test.avs simply contains the text inside quotes

"some text"

and the script uses directly the return value of Import:

source = source.ScriptClip("""SubTitle(Import("D:\Video Processing\test.avs"))""")